A while back, I posted a blog called Getting Started with dbGet. It was a brief introduction to this database access mechanism. Well, dbGet is only half the story - there is also a command called dbSet, which can give you even more power in your scripting or manipulating of the design database.
It works in much the same way as dbGet. As a quick review, let's say we wanted to find out the placement status of the instances in our design. If we didn't remember the exact syntax, we would start with:
> dbGet top.?
The ? will list all the things we can look at regarding "top", the top cell of our design.
> topCell: fPlan hInst insts name nets numBidirs numInputs numInsts numNets numPhysInsts numPhysNets numTerms objType pgTerms physInsts physNets props statusClockSynthesized statusGRouted statusIoPlaced statusPlaced statusPowerAnalyzed statusRCExtracted statusRouted statusScanOpted terms
What we want is insts, or all the instances in the design:
>inst: box cell instTerms isDontTouch isHaloBlock isJtagElem isPhysOnly isSpareGate name objType orient pStatus pgCellTerms pgTermNets pt
And finally, pStatus (placement status):
>fixed placed placed placed placed... (etc.)
So now that we have the attribute we want, let's change it! Suppose we want all the instances to be fixed and not just placed. Well, dbSet makes this very easy:
>dbSet top.insts.pStatus fixed
If you reissue the dbGet command, you'll see that all the instances are now fixed.
Here's a more realistic example. I had a design where I wanted to fix the placement of all of my adder cells. They were large cells, and allowing them to be moved around after their initial placement would cause them to be placed far away from their original location. So, first I had to grab pointers to all of the adder cells:
>dbGet -p2 top.insts.cell.name ADD*
The -p2 means to grab the database pointers of the instances gathered by this command, which means all instances whose master cell names start with ADD. (For some more explanation of how the -p function works with dbGet, see the post A dbGet Code Example).
Now that I have those pointers, I can examine the placement status of these instances:
>dbGet [dbGet -p2 top.insts.cell.name ADD*].pStatus
But what I really want to do is set the placement status to fixed, so the final line would look like this:
>dbSet [dbGet -p2 top.insts.cell.name ADD*].pStatus fixed
For a list of attributes that are editable with dbSet, you can check out Appendix B of the Encounter Text Command Reference. Scroll down the tables and look at the "Editable" column. Most of the editable attributes fall under the "inst" database object.
I hope this short introduction to dbSet has inspired you to check it out and use it in your scripts. Let me know in the comments how you're using dbSet. I'm always interested to see clever one-line dbGet/dbSet commands. In fact, I'm collecting them for a future post. (Don't worry, I'll give you credit!)