128 lines
4.5 KiB
Tcl
128 lines
4.5 KiB
Tcl
# Deep write_liberty test exercising all LibertyWriter.cc paths.
|
|
source ../../test/helpers.tcl
|
|
|
|
############################################################
|
|
# Read multiple libraries for variety of cell types
|
|
############################################################
|
|
read_liberty ../../test/nangate45/Nangate45_typ.lib
|
|
|
|
############################################################
|
|
# Write liberty - exercises the full writer path
|
|
############################################################
|
|
set lib [lindex [get_libs NangateOpenCellLibrary] 0]
|
|
|
|
# First write
|
|
set outfile1 [make_result_file liberty_writer_rt1.lib]
|
|
sta::write_liberty $lib $outfile1
|
|
|
|
diff_files liberty_writer_rt1.libok $outfile1
|
|
|
|
############################################################
|
|
# Read Sky130 which has tristate, latch, and async cells
|
|
# These exercise more LibertyWriter timingTypeString paths
|
|
############################################################
|
|
read_liberty ../../test/sky130hd/sky130hd_tt.lib
|
|
|
|
set sky_lib [sta::find_liberty "sky130_fd_sc_hd__tt_025C_1v80"]
|
|
if {$sky_lib ne "NULL" && $sky_lib ne ""} {
|
|
set outfile3 [make_result_file liberty_writer_rt_sky.lib]
|
|
sta::write_liberty $sky_lib $outfile3
|
|
diff_files liberty_writer_rt_sky.libok $outfile3
|
|
}
|
|
|
|
|
|
############################################################
|
|
# Read IHP library (has different cell structures)
|
|
############################################################
|
|
read_liberty ../../test/ihp-sg13g2/sg13g2_stdcell_typ_1p20V_25C.lib
|
|
|
|
set ihp_lib [sta::find_liberty "sg13g2_stdcell_typ_1p20V_25C"]
|
|
if {$ihp_lib ne "NULL" && $ihp_lib ne ""} {
|
|
set outfile4 [make_result_file liberty_writer_rt_ihp.lib]
|
|
sta::write_liberty $ihp_lib $outfile4
|
|
}
|
|
|
|
############################################################
|
|
# Verify specific cell types are written correctly
|
|
############################################################
|
|
|
|
# Check cells that exercise various timing types in the writer
|
|
|
|
# Combinational cells
|
|
foreach cell_name {INV_X1 BUF_X1 NAND2_X1 NOR2_X1 AND2_X1 OR2_X1
|
|
XOR2_X1 XNOR2_X1 AOI21_X1 OAI21_X1 MUX2_X1
|
|
FA_X1 HA_X1} {
|
|
# Use lindex to handle potential duplicate libraries from re-read
|
|
set cell [lindex [get_lib_cell NangateOpenCellLibrary/$cell_name] 0]
|
|
if {$cell ne ""} {
|
|
set arc_sets [$cell timing_arc_sets]
|
|
puts "$cell_name: [llength $arc_sets] arc sets"
|
|
foreach arc_set $arc_sets {
|
|
set arcs [$arc_set timing_arcs]
|
|
foreach arc $arcs {
|
|
set from_edge [$arc from_edge_name]
|
|
set to_edge [$arc to_edge_name]
|
|
puts " $from_edge->$to_edge"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Sequential cells (rising_edge, setup_rising, hold_rising, etc.)
|
|
foreach cell_name {DFF_X1 DFF_X2 DFFR_X1 DFFS_X1 DFFRS_X1} {
|
|
set cell [get_lib_cell NangateOpenCellLibrary/$cell_name]
|
|
set arc_sets [$cell timing_arc_sets]
|
|
puts "$cell_name: [llength $arc_sets] arc sets"
|
|
}
|
|
|
|
# Tristate cells (three_state_enable, three_state_disable)
|
|
foreach cell_name {TINV_X1 TBUF_X1 TBUF_X2} {
|
|
set cell [get_lib_cell NangateOpenCellLibrary/$cell_name]
|
|
set arc_sets [$cell timing_arc_sets]
|
|
puts "$cell_name: [llength $arc_sets] arc sets"
|
|
foreach arc_set $arc_sets {
|
|
set role [$arc_set role]
|
|
puts " role=$role"
|
|
}
|
|
}
|
|
|
|
# Scan cells (exercises test_cell and scan paths)
|
|
foreach cell_name {SDFF_X1 SDFFR_X1 SDFFS_X1 SDFFRS_X1} {
|
|
set cell [get_lib_cell NangateOpenCellLibrary/$cell_name]
|
|
set arc_sets [$cell timing_arc_sets]
|
|
puts "$cell_name: [llength $arc_sets] arc sets"
|
|
}
|
|
|
|
# Clock gate cell (may have min_pulse_width arcs)
|
|
foreach cell_name {CLKGATETST_X1 CLKGATETST_X2 CLKGATETST_X4} {
|
|
set cell [get_lib_cell NangateOpenCellLibrary/$cell_name]
|
|
set arc_sets [$cell timing_arc_sets]
|
|
puts "$cell_name: [llength $arc_sets] arc sets"
|
|
foreach arc_set $arc_sets {
|
|
set role [$arc_set role]
|
|
puts " role=$role"
|
|
}
|
|
}
|
|
|
|
# Latch cells (latch_enable, latch_d_to_q)
|
|
foreach cell_name {TLAT_X1} {
|
|
set cell [get_lib_cell NangateOpenCellLibrary/$cell_name]
|
|
set arc_sets [$cell timing_arc_sets]
|
|
puts "$cell_name: [llength $arc_sets] arc sets"
|
|
foreach arc_set $arc_sets {
|
|
set role [$arc_set role]
|
|
puts " role=$role"
|
|
}
|
|
}
|
|
|
|
############################################################
|
|
# Read ASAP7 (has different table model sizes)
|
|
############################################################
|
|
read_liberty ../../test/asap7/asap7sc7p5t_SEQ_RVT_FF_nldm_220123.lib
|
|
|
|
set asap7_lib [sta::find_liberty "asap7sc7p5t_SEQ_RVT_FF_nldm_220123"]
|
|
if {$asap7_lib ne "NULL" && $asap7_lib ne ""} {
|
|
set outfile5 [make_result_file liberty_writer_rt_asap7.lib]
|
|
sta::write_liberty $asap7_lib $outfile5
|
|
}
|