原创 Encounter_Command_script: tcl solutions

2009-7-27 11:21 4518 3 3 分类: 工程师职场
This solution is about extracting design information in Tcl variables or files, for
script-driven uses.

New users may come to First Encounter with deep experience in floorplanning tools, but
little experience in Tcl scripting. Tcl, or "Tool Command Language", is a fairly
simple scripting language that can be used to automate sequences of commands, test
conditions, and branch as required. This solution gives a number of sample Tcl code
snippets that can be used to do different kinds of useful things in the digital
implementation flow using First Encounter.

Encounter uses a standard TCL interpreter so you can utilize the standard TCL syntax which can
be found in books and online. If you are learning TCL, a good tutorial is at
:http://www.msen.com/~clif/TclTutor.html.
Solution:
1. How to store the value of TNS (total negative slack) in a tcl variable? TNS is
frequently used to determine what IPO operations at what effort level are
appropriate to perform. The calNegSlack command can anchor such a script:

___________________________________________________________
getReport calNegSlack > slack.rpt
set list [exec grep TNS -m 1 slack.rpt]
set TNS [lindex [split [lindex $list 2] =] 1]
puts "TNS is $TNS units and is stored in variable named TNS"
___________________________________________________________

The above script will store the TNS value into the variable named TNS and you can use
this value further in the script. Everytime you run this code, a fresh slack.rpt
will be created which will have TNS value for that stage.

2. Given a row name or row number from the DEF or the .fp file, how to report the
standard cells in that particular row? The below script is a good example. It uses
the so-called "DB Commands" which are described in the Encounter Database Access
Command Reference in the SOC documentation set.

--------------------------------------------------------------------
proc row_insts {row_name row_num} {

dbForEachFPlanDefRow [dbHeadFPlan] rowPtr {

if {[dbRowName $rowPtr] == $row_name || [dbRowId $rowPtr] == row_num} {
set box [dbStdRowBox $rowPtr]
set row_y_bot [lindex $box 1]
set row_y_top [lindex $box 3]
}
}

dbForEachCellInst [dbgTopCell] instPtr {
set inst_box [dbInstBox $instPtr]
set inst_y_bot [lindex $inst_box 1]
set inst_y_top [lindex $inst_box 3]

if {$inst_y_bot == $row_y_bot && $inst_y_top == $row_y_top} {
set inst_name [dbInstName $instPtr]
puts $inst_name
}
}
}
------------------------------------------------------
Ex : row_insts ROW_0 0
encounter 358> row_insts row 12
DTMF_INST/RESULTS_CONV_INST/i_9386
DTMF_INST/RESULTS_CONV_INST/i_9415
------------------------------------------------------
If nothing is returned, then the row is empty.

3. How to report the standard cells in the design which are FIXED? Some operations,
like clock tree synthesis, will fix instances. This is one way to find them:

-------------------------------------------------------------------------
dbForEachCellInst [dbgTopCell] instPtr {
set leafCell [dbInstName $instPtr]
if {[dbInstPlacementStatus $leafCell] == "dbcFixed"} {
set cellPtr [dbInstCell $leafCell]
if {[dbIsCellGate $cellPtr] == 1} {
puts $leafCell
}
}
}
-------------------------------------------------------------------------

The script can be modified as follows to include the FIXED hard macros as well :
-------------------------------------
dbForEachCellInst [dbgTopCell] instPtr {
set leafCell [dbInstName $instPtr]
if {[dbInstPlacementStatus $leafCell] == "dbcFixed"} {
puts $leafCell
}
}
-------------------------------------

4. How can I store the setup time of a flip flop into a variable for later use?

___________________________________
set dataPin <D pin of the required flop>
set setup [get_property [report_timing -to $dataPin -collection] setup]
___________________________________

For example:
-------------------------------
encounter 120> set dataPin DTMF_INST/SPI_INST/spi_sr_reg_6/D
DTMF_INST/SPI_INST/spi_sr_reg_6/D
encounter 122> set setup [get_property [report_timing -to $dataPin -collection] setup]
1.025
--------------------------------
Make sure the D pin is constrained and SDC has been loaded.

5. How to store the output of certain First Encounter commands that don't take an
output filename argument? The command 'getReport' or 'redirect' stores the output of
the commands for which you cannot specify a filename. For example,

getReport checkPlace > check.place

check.place will contain :
____________________________
Design has 1 cell with cell padding or block halo.
Begin checking placement ...
Region/Fence Violation: 1
Placement Blockage Violation: 35
*info: Placed = 5729
*info: Unplaced = 0
Placement Density:54.81%(131473/239857)
~
____________________________-

** getReport command can also be used to obtain the results of calNegSlack command in a file.

6. Still looking for something you don't see here? You can find useful scripts which
may be used as a starting pint for your own scripting in the SOC installation
directory, at <install_area>/share/fe/gift/scripts/tcl.
PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
3
关闭 站长推荐上一条 /3 下一条