Timing T CL Scripting Commands
Timing T CL Scripting Commands
Problem
This article explains the basics of using the Advanced Timing Tcl Scripting Commands. These commands can be used in combination with each other to report and query database
objects based on specified criteria.
Solution
This article describes the Advanced Timing Tcl Scripting Commands. What these commands are used for is explained with simple examples, for each category of similar commands. For
specifics on syntax, refer to the Advanced Timing Tcl Scripting Commands chapter in the Encounter/Innovus/Tempus Text Command Reference.
This article focuses on the usage of the following command types under this category:
all_* commands
get_* commands
Property commands
Collection commands
all_* commands
The all_* commands return a collection of all the items of a specific type. Several of the commands (marked with a (f)) provide options to filter the collection based on certain
properties:
Report the worst timing path that begins at a register and ends at an output port
report_timing -from [all_registers] -to [all_outputs]
get_* commands
The get_* commands return a collection of items filtered by name pattern or object type. Additionally, you can use the -filter option for most of the get_* commands to filter the
collection by property value. For more information, see the description of the get_property command in the EDI System Text Command Reference.
The filter_expression for the -filter option can be created by combining several object properties using the following relational and logical
operators: >, <, ==, !=, <=, >=, &&, ||, =~, !~, AND and OR. You also can use parentheses to create expressions.
Property commands
The list_property command lists the properties for the different object types. When the list_property command is run without arguments, it lists all the properties for all object
types.
Use the -type option to list properties for a specific object type. Legal option types
are: cell, clock, design, lib, lib_cell, lib_pin, lib_timing_arc, net, path_group, pin, port, timing_arc, timing_path and timing_point. Here is an example:
from_lib_pin | collection
mode | string
object_type | string
sdf_cond | string
timing_type | string
to_lib_pin | collection
when | string
The get_property command returns the value of the specified property. For a list of all the properties, see the description of the get_property command in the EDI System Text
Command Reference.
Usage:
Another example: User can obtain clock net name using get_property command.
In this command clk01 is the sdc clock defined in timing constraint file. User can find the corresponding clock net.
Note: The report_property command returns the properties and their values for a specified object.
For timing-related properties such as properties for timing arcs, paths and points, run report_timing -collection. This returns the results in a collection of timing paths.
Example:
Report the timing and store the top 10 paths as a collection in the variable $paths
set paths [report_timing -collection -max_paths 10]
Filter $paths to include only those paths with slack between -0.806ns and 0ns
set newPaths [filter_collection $paths {(slack > -0.806 && slack < 0.0)}]
Collection commands
Lastly, once you have the collection defined, you can manipulate, filter, cycle through and query it using the collection-related commands:
Examples:
By default, Advanced Timing Tcl commands like get_cells that display the collection objects, list only the first 100 objects in a collection. This default behavior cab be changed by using
the timing_collection_result_display_limit global. When set to an integer value, all the commands such as, get_cells, add_to_collection, query_objects, and so
on, which display the collection objects in the output report will be impacted. (Default value is 100).
To display all the elements in the collection, set this global to "-1".
set_global timing_collection_result_display_limit -1
Output:
Endpoint: tdigit[7] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_7/CK Slack: -0.727
Endpoint: tdigit_flag Startpoint: DTMF_INST/DIGIT_REG_INST/flag_out_reg/CK Slack: -0.495
Endpoint: tdigit[6] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_6/CK Slack: -0.488
Endpoint: tdigit[5] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_5/CK Slack: -0.409
Endpoint: tdigit[4] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_4/CK Slack: -0.353
Endpoint: tdigit[0] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_0/CK Slack: -0.266
Endpoint: tdigit[3] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_3/CK Slack: -0.218
Endpoint: tdigit[1] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_1/CK Slack: -0.189
Endpoint: tdigit[2] Startpoint: DTMF_INST/DIGIT_REG_INST/digit_out_reg_2/CK Slack: -0.184
redirect clock_sink.rpt {
foreach_in_collection ck [all_clocks] {
puts "Clock_Name No_of_register_sinks Sink_list"
puts "#####################################"
puts "[get_object_name $ck] [sizeof_collection [all_registers -clock $ck]] [get_object_name [all_registers -clock $ck]]\n"
}
}
Output:
Clock_Name No_of_register_sinks Sink_list
#####################################
m_spi_clk 23 SPI_INST/spare_200 SPI_INST/spare_201 SPI_INST/spare_202 SPI_INST/spare_203 SPI_INST/spare_204 SPI_INST/spare_205 SPI_
Example #3: To return all the instance pins that are used in the path
Output:
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/Q
TDSP_CORE_INST/EXECUTE_INST/FE_PSC541_sel_op_a_2_/A
TDSP_CORE_INST/EXECUTE_INST/FE_PSC541_sel_op_a_2_/Z
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/Fn0090D/A
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/Fn0090D/ZN
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/FE_RC_1304_0/A3
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/FE_RC_1304_0/ZN
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/FE_OCPC334_n_2/A
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/FE_OCPC334_n_2/Z
TDSP_CORE_INST/EXECUTE_INST/FE_PSC520_n_650/A
TDSP_CORE_INST/EXECUTE_INST/FE_PSC520_n_650/Z
TDSP_CORE_INST/EXECUTE_INST/n0439D/A
TDSP_CORE_INST/EXECUTE_INST/n0439D/ZN
TDSP_CORE_INST/EXECUTE_INST/p_reg[27]/D
Example #4: Script to report slack and difference between clock arrival time at launch and capture clocks
foreach_in_collection i $a {
set StartPoint [get_object_name [get_property $i launching_point]]
set EndPoint [get_object_name [get_property $i capturing_point]]
set l1 [get_property $i launching_clock_latency]
set l2 [get_property $i launching_clock_open_edge_time]
set launchClockTime [expr $l1 + $l2]
set c1 [get_property $i capturing_clock_latency]
set c2 [get_property $i capturing_clock_close_edge_time]
set captureClockTime [expr $c1 + $c2]
set Slack [get_property $i slack]
set Skew [expr $captureClockTime - $launchClockTime]
puts "$StartPoint \t $EndPoint \t $Slack \t $Skew"
}
Output:
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[27]/D -843.802 -0.015
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[30]/D -762.004 -0.015
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[24]/D -684.326 -0.015
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[26]/D -680.548 -0.015
Example #5: Script to report logics between reg-to-reg. This script can be modified for different path groups:
Output:
Timing points between TDSP_CORE_INST/EXECUTE_INST/arp_reg/CP and
RAM_256x16_TEST_INST/RAM_256x16_INST/A[6]TDSP_CORE_INST/EXECUTE_INST/arp_reg/CP
TDSP_CORE_INST/EXECUTE_INST/arp_reg/Q
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/p1929A/S
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/p1929A/Z
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/p1927A/A1
TDSP_CORE_INST/TDSP_CORE_GLUE_INST/p1927A/ZN
DATA_SAMPLE_MUX_INST/p1989A/I1
DATA_SAMPLE_MUX_INST/p1989A/Z
RAM_256x16_TEST_INST/RAM_256x16_INST/A[6]
Example #6: Script to get the intermediate logic between fanout cone of one instance to fanin cone of another instance :
proc intersect_fanin_fanout {x y} {
if {[get_ports -quiet $x] != ""} {
set X [all_fanout -from [get_ports $x]]
} else {
set X [all_fanout -from [get_pins $x]]
}
if {[get_ports -quiet $y] != ""} {
set Y [all_fanin -to [get_ports $y]]
} else {
set Y [all_fanin -to [get_pins $y]]
}
set result [remove_from_collection -intersect $X $Y]
return $result
}
Output:
> intersect_fanin_fanout a1/A b3/Y
a1/A a1/Y a3/A a3/Y b1/B b1/Y b3/A b3/Y
0x2b1
Example #7: Script to find the number of logic levels (combinational) in a timing path or group of timing paths
Output:
> num_of_logicLevel 3
Start Point End Point Instance Count
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[27]/D 58
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[30]/D 58
TDSP_CORE_INST/EXECUTE_INST/sel_op_a_reg[2]/CK TDSP_CORE_INST/EXECUTE_INST/p_reg[24]/D 54
Example #8: Script to report worst slack for all clock group
Output:
Clock group: ck View: dtmf_view_setup WNS: 4.182
Clock group: gclk View: dtmf_view_setup WNS: 4.746
Clock group: ck View: dtmf_view_hold WNS: 4.588
Clock group: gclk View: dtmf_view_hold WNS: 4.885
Example #9: Script to get the specified pin from all the nets directly connected to an instance
This gets all the nets connected a specified instance, and subsequently filter out if the specified pin is connected to any of these nets.
For example: If you set instName as "Inst1" and pinName as "SI", then this returns following.
inst1/SI inst2/SI
This suggests that from all the nets connected with "Inst1", there are 2 pins as "SI" pin.
Use below script to get cell delays above 0.1 value. You can change the value based on your requirement. You can replace ">" with "<" if you need to report cell delay below a
specific value.
Output:
FF2/Q 1.958
FF1/Q 2.019
Refer to the Usage of collections in Innovus & Tempus, version 15.1 and above RAK to understand the collection usage in Tempus and Innovus.