• Home
  • :
  • Community
  • :
  • Blogs
  • :
  • Digital Implementation
  • :
  • A dbGet Code Example

Digital Implementation Blogs

  • Subscriptions

    Never miss a story from Digital Implementation. Subscribe for in-depth analysis and articles.

    Subscribe by email
  • More
  • Cancel
  • All Blog Categories
  • Breakfast Bytes
  • Cadence Academic Network
  • Cadence Support
  • Computational Fluid Dynamics
  • CFD(数値流体力学)
  • 中文技术专区
  • Custom IC Design
  • カスタムIC/ミックスシグナル
  • 定制IC芯片设计
  • Digital Implementation
  • Functional Verification
  • IC Packaging and SiP Design
  • In-Design Analysis
    • In-Design Analysis
    • Electromagnetic Analysis
    • Thermal Analysis
    • Signal and Power Integrity Analysis
    • RF/Microwave Design and Analysis
  • Life at Cadence
  • Mixed-Signal Design
  • PCB Design
  • PCB設計/ICパッケージ設計
  • PCB、IC封装:设计与仿真分析
  • PCB解析/ICパッケージ解析
  • RF Design
  • RF /マイクロ波設計
  • Signal and Power Integrity (PCB/IC Packaging)
  • Silicon Signoff
  • Solutions
  • Spotlight Taiwan
  • System Design and Verification
  • Tensilica and Design IP
  • The India Circuit
  • Whiteboard Wednesdays
  • Archive
    • Cadence on the Beat
    • Industry Insights
    • Logic Design
    • Low Power
    • The Design Chronicles
Kari
Kari
28 Jan 2009

A dbGet Code Example

I've been having a lot of fun with power switch cells lately. That's a whole other story (and perhaps a future blog entry), but in my experiments I was able to use dbGet in some neat ways. I posted previously about getting started with dbGet here.

After you've experimented with dbGet for a while, the natural next step is to start using it in scripts or pieces of code.

The scenario: All of my switch cells were the largest size. (This particular design utilizes switch cells placed in columns on every row.) This caused my block to be too congested and therefore unroutable. I needed to reduce area without sacrificing too much IR drop, so I only wanted to change every other row to a smaller switch cell. My first thought was to key off of the orientation. As you go up the column, the switch cell orientations are R0, MX, R0, MX, etc. So I could swap out all the R0 or all the MX to get what I want.

The plan: Select all the switch cells. (I used the design browser to get all cells of type SWITCH32X, but you could script this part too.) Grab only the ones that are R0 orientation. Deselect everything. Now select all the R0 cells. Set their status from FIXED to PLACED (otherwise ecoChangeCell won't work). Cycle through the list of cells and change them from SWITCH32X to SWITCH16X. Finally, set their status back to FIXED so they don't get moved later in the flow.

The code:

#all switch cells are selected to begin with
set or R0
set insts [dbGet -p selected.orient $or]
deselectAll
foreach inst $insts {selectInst [dbGet $inst.name]}
dbSet [dbGet -p selected].pStatus placed
set changes [dbGet -p selected]
foreach change $changes {ecoChangeCell -inst [dbGet $change.name] -cell SWITCH16X}
dbSet [dbGet -p selected].pStatus fixed


While this is a good example of using dbGet selected and selectInst, as well as a good visual way to make sure I'm grabbing the cells I want, I realized it wasn't the most efficient code. So I revised it to look like this:

set or R0
set s32 [dbGet -p2 top.insts.cell.name SWITCH32X]
set s32R0 [dbGet -p $s32.orient $or]
dbSet [dbGet -p $s32R0].pStatus placed
foreach inst $s32R0 {ecoChangeCell -inst [dbGet $inst.name] -cell SWITCH16X}
dbSet [dbGet -p $s32R0].pStatus fixed


Let's break that down line-by-line:

set or R0 --> create a variable for the orientation
set s32 [dbGet -p2 top.insts.cell.name SWITCH32X] --> grab the database pointers to all SWITCH32X cells in the design
set s32R0 [dbGet -p $s32.orient $or] --> grab the database pointers for all SWITCH32X cells that have orientation matching R0 (or whatever the variable $or is set to)
dbSet [dbGet -p $s32R0].pStatus placed --> change the placement status from FIXED to PLACED so the next line will work
foreach inst $s32R0 {ecoChangeCell -inst [dbGet $inst.name] -cell SWITCH16X} --> change all R0 SWITCH32X cells to SWITCH16X cells
dbSet [dbGet -p $s32R0].pStatus fixed --> change the new cells from PLACED back to FIXED


You'll notice the use of -p and -p2 in the dbGet commands. Using -p will return the database pointers of what you're examining with dbGet. This is important because certain commands need the database pointers to the instance or cell and not the instance name or cell name. In the dbGet -p2 line, we used -p2 because we want to step back two places in the sequence to grab our pointers. (In the sequence top.insts.cell.name, stepping back one place from name would give us a pointer to the cell; stepping back two places gives us the pointers to the insts.) In the next line, we used -p (which is the same as -p1) because we want to step back one item in the sequence to grab the pointers. (In the sequence $s32.orient, we step back one item from orient to get the pointers for $s32.) The use of -p can be confusing at first, but you'll get the hang of it after you try it a few times.

I hope this has inspired some of you to start using dbGet in your scripts. Happy coding, everyone!

Tags:
  • database access |
  • SoC-Encounter |
  • dbGet |
  • dbSet |
  • Digital Implementation |