Home > Community > Blogs > Digital Implementation > selecting pointers with dbget and dbselectobj
 
Login with a Cadence account.
Not a member yet?
Create a permanent login account to make interactions with Cadence more conveniennt.

Register | Membership benefits
Get email delivery of the Digital Implementation blog (individual posts).
 

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

Encounter How-To: Selecting Objects By Pointer With dbGet And dbSelectObj

Comments(2)Filed under: Digital Implementation, dbGet, database access, Encounter Digital Implementation

I just got back from a trip to California where I met with a couple of customers and presented database access with dbGet in the Encounter Digital Implementation System (EDI for short).  I took notes on the questions that came up- in particular those common between both sets of users.  One item in particular that was helpful was understanding how to select objects by pointer with dbGet.  In this post, I'll explain the basics of object selection by type with existing mechanisms in Encounter, and then show how you would use dbSelectObj in conjunction with dbGet to select objects by criteria and pointer.

Say for example, you'd like to select all of the instances in the design that have the cell master "BUFX1".  How could we do that?

First, we naturally like to use the most polished, productized piece of functionality available that does what we're looking for.  There is a nice piece of functionality that can select many different objects by name, type and criteria under: Edit->Find/Select Object... If we ask it to select all instances whose "Cell" Matches "BUFX1" it will find, display, and select 11 instances in my design:

 

 

If we look at our .cmd file (which logs the commands executed at the command line -or- via GUI actions) we see:

selectObjByProp Instance <Cell>Match<BUFX1>

We could certainly use this command to select a number of objects by type, and this is a useful utility.  But invariably, our requirements are become more complex than what the utility supports.  Say we want to find and select all the hard macros in the design with an area greater than some amount so we can set them FIXED?  How would we do that?

This is where db access can be useful.  In EDI, dbGet provides a simple but powerful way to probe the database.  We can use it to find objects based on a number of criteria.  For example, if we wanted to perform the same action as we did above with the Find/Select Object utility using dbGet we'd do it like this:

dbGet -p2 top.insts.cell.name BUFX1
0x2aa72affb8 0x2aa72b0050 0x2aa72b00e8 ... (truncated, but 11 pointers would be returned)

This would return a list of all the pointers to instances in the design that are of cell type "BUFX1".  BUFX1 is used as a filter in this case, and we use "-p2" to instruct dbGet to "walk" 2 levels back up the structure that was traversed to get inst pointers.  Let's say that we wanted to select all of those instances- how would we do that?  One way to do this is get a list of the inst *names* (as opposed to pointers):

dbGet [dbGet -p2 top.insts.cell.name BUFX1].name
DTMF_INST/TDSP_CORE_INST/i_10181 DTMF_INST/TDSP_CORE_INST/i_10155 DTMF_INST/TDSP_CORE_INST/i_10084 ...

...and then select them using selectInst within a foreach loop:

foreach instName [dbGet [dbGet -p2 top.insts.cell.name BUFX1].name] {
     selectInst $instName
}

->This would find -and- select all of these instances, similarly as Find/Select Object did

But what if the object you're trying to select isn't easily identified by name because it's a floorplanning object?  Like placement obstructions for example?  For things like this, it is often more conventient (or even mandatory) to select by pointer.  We can use the dbSelectObj command for this:

foreach pBlkg [dbGet top.fplan.pBlkgs] {
     dbSelectObj $pBlkg
}

For our BUFX1 example above, it would look like this (we select by pointer instead of by name):

foreach instPtr [dbGet -p2 top.insts.cell.name BUFX1] {
     dbSelectObj $instPtr

To make things easier and not require a foreach loop, dbSelectObj is being enhanced to operate on lists of pointers.  In 9.1.USR1 (not released yet) we'll be able to use dbSelect Obj as follows:

dbSelectObj [dbGet top.fplan.pBlkgs]

As you work with dbGet, I think you'll find lots of situations where by selecting by pointer is more sensible than selected by name.

Further Reading:

Hope this is helpful,
Bob Dwyer

 

Comments(2)

By eminemshow on December 17, 2009
Bob,
Glad to see your post again. dbGet really make the work easier, in the past I have write dbForEach* loops to get the pointers I want. Now just 1 command. And I am really looking forward to the enhancement of dbSelectObj, by nature, this command should adopt a 'list'.
Thank you for this great post.

By BobD on December 18, 2009
Hi Em,
Good to hear from you.  Thanks for the kind words on the post.  We've got some other cool things in the works in this space I think you'll like.  Stay tuned!
-Bob

Leave a Comment


Name
E-mail (will not be published)
Comment
 I have read and agree to the Terms of use and Community Guidelines.
Community Guidelines
The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.