OpenSTA/sdc/test/sdc_exception_thru_complex.tcl

161 lines
5.6 KiB
Tcl

# Test complex exception thru matching with nets, instances, pins
# and the ExceptionThru state machine for multi-through points.
# Targets:
# ExceptionPath.cc: ExceptionThru::matches with nets/instances/pins,
# ExceptionThru::intersectsPts with mixed object types,
# ExceptionThru::equal, ExceptionThru::compare,
# ExceptionThru::findHash with all object types,
# ExceptionThru::allPins (net expansion to pins),
# ExceptionTo::matches (with pin/clk/inst matching branches),
# ExceptionTo::matchesFilter (report filter path),
# ExceptionFrom::intersectsPts (pin/clk/inst branches),
# ExceptionPath::intersectsPts,
# ExceptionPath::mergeable (complex merge decisions),
# fromThruToPriority calculation for various combos,
# ExceptionPathLess comparison for sorting
# Sdc.cc: makeExceptionThru with nets/instances/pins,
# addException (merge logic), resetPath,
# makeExceptionFrom with mixed pins/clocks/instances,
# makeExceptionTo with mixed pins/clocks/instances
# WriteSdc.cc: writeExceptionThru with nets/instances/pins,
# writeExceptionFromTo with multi-object lists
source ../../test/helpers.tcl
read_liberty ../../test/nangate45/Nangate45_typ.lib
read_verilog sdc_test2.v
link_design sdc_test2
create_clock -name clk1 -period 10 [get_ports clk1]
create_clock -name clk2 -period 20 [get_ports clk2]
set_input_delay -clock clk1 2.0 [get_ports in1]
set_input_delay -clock clk1 2.0 [get_ports in2]
set_input_delay -clock clk2 2.0 [get_ports in3]
set_output_delay -clock clk1 3.0 [get_ports out1]
set_output_delay -clock clk2 3.0 [get_ports out2]
# Test 1: Through nets (exercises ExceptionThru with nets)
set_false_path -through [get_nets n1] -to [get_ports out1]
set_false_path -through [get_nets n2] -to [get_ports out2]
set_false_path -from [get_ports in1] -through [get_nets n3] -to [get_ports out1]
# Through net with rise_through
set_false_path -rise_through [get_nets n4] -to [get_ports out2]
# Through net with fall_through
set_false_path -fall_through [get_nets n5] -to [get_ports out1]
# Test 2: Through instances (exercises ExceptionThru with instances)
set_false_path -through [get_cells buf1] -to [get_ports out2]
set_false_path -from [get_ports in2] -through [get_cells and1] -to [get_ports out1]
# Rise through instance
set_false_path -from [get_ports in3] -rise_through [get_cells or1] -to [get_ports out2]
# Test 3: Multiple through points with mixed types
# (net then pin, instance then pin, pin then net)
# Net then pin
set_false_path -from [get_ports in1] \
-through [get_nets n1] \
-through [get_pins and1/ZN] \
-to [get_ports out1]
# Instance then pin
set_false_path -from [get_ports in2] \
-through [get_cells inv1] \
-through [get_pins nand1/ZN] \
-to [get_ports out1]
# Pin then net
set_false_path -from [get_ports in1] \
-through [get_pins buf1/Z] \
-through [get_nets n3] \
-to [get_ports out1]
# Three through points: pin, net, instance
set_false_path -from [get_ports in2] \
-through [get_pins inv1/ZN] \
-through [get_nets n3] \
-through [get_cells nand1] \
-to [get_ports out1]
# Test 4: From with mixed objects (pins + clocks)
set_false_path -from [list [get_ports in1] [get_ports in2]] \
-to [list [get_ports out1] [get_ports out2]]
set_false_path -from [list [get_clocks clk1] [get_ports in3]] \
-to [get_ports out1]
# From with instances
set_false_path -from [get_cells reg1] -to [get_ports out2]
# To with instances
set_false_path -from [get_ports in1] -to [get_cells reg2]
# Test 5: Max/min delay with through
set_max_delay -from [get_ports in1] -through [get_nets n1] -to [get_ports out1] 7.0
set_max_delay -from [get_ports in2] -through [get_cells and1] -to [get_ports out1] 6.5
set_max_delay -from [get_ports in3] \
-through [get_pins or1/ZN] \
-to [get_ports out2] 8.0
set_min_delay -from [get_ports in1] -through [get_nets n1] -to [get_ports out1] 0.5
# Max delay with -ignore_clock_latency
set_max_delay -from [get_ports in3] -to [get_ports out2] -ignore_clock_latency 9.0
# Test 6: Multicycle with through
set_multicycle_path -setup 2 -from [get_ports in1] \
-through [get_pins buf1/Z] \
-to [get_ports out1]
set_multicycle_path -hold 1 -from [get_ports in1] \
-through [get_pins buf1/Z] \
-to [get_ports out1]
# Test 7: Group path with through nets/instances
group_path -name gp_net -from [get_ports in1] \
-through [get_nets n1] \
-to [get_ports out1]
group_path -name gp_inst -from [get_ports in2] \
-through [get_cells and1] \
-to [get_ports out1]
group_path -name gp_pin -from [get_ports in3] \
-through [get_pins or1/ZN] \
-to [get_ports out2]
group_path -default -from [get_ports in1] -to [get_ports out2]
# Write SDC
set sdc1 [make_result_file sdc_exc_thru_complex1.sdc]
write_sdc -no_timestamp $sdc1
diff_files sdc_exc_thru_complex1.sdcok $sdc1
set sdc2 [make_result_file sdc_exc_thru_complex2.sdc]
write_sdc -no_timestamp -compatible $sdc2
diff_files sdc_exc_thru_complex2.sdcok $sdc2
set sdc3 [make_result_file sdc_exc_thru_complex3.sdc]
write_sdc -no_timestamp -digits 6 $sdc3
diff_files sdc_exc_thru_complex3.sdcok $sdc3
# Unset and verify
unset_path_exceptions -through [get_nets n1] -to [get_ports out1]
unset_path_exceptions -through [get_nets n2] -to [get_ports out2]
unset_path_exceptions -from [get_ports in1] -through [get_nets n3] -to [get_ports out1]
unset_path_exceptions -through [get_cells buf1] -to [get_ports out2]
unset_path_exceptions -from [get_ports in2] -through [get_cells and1] -to [get_ports out1]
# Write after unset to verify reduced constraints
set sdc_unset [make_result_file sdc_exc_thru_complex_unset.sdc]
write_sdc -no_timestamp $sdc_unset
diff_files sdc_exc_thru_complex_unset.sdcok $sdc_unset