This commit is contained in:
Cooper Shaw
2026-10-06 19:42:55 -04:00
commit 5d743146e3
10703 changed files with 3804768 additions and 0 deletions
Executable
+83
View File
@@ -0,0 +1,83 @@
#!/usr/bin/env tcsh
set _sjapr_dir = `dirname $0`
setenv SCRIPTS `realpath $_sjapr_dir`
setenv ROOT `realpath $SCRIPTS/..`
setenv PREVDIR `pwd`
setenv CDS_LIC_FILE [email protected]
# Batch by default, even if the calling shell has this set
unsetenv SJ_INTERACTIVE
set syn_command = "dc_shell-t -f ${SCRIPTS}/synthesis/synthesis.tcl -output_log_file synthesis.log"
set apr_command = "innovus -log apr.log -init ${SCRIPTS}/apr/apr.tcl -legacy_ui -nowin"
set syn_rundir = ${ROOT}/outputs/synthesis
set apr_rundir = ${ROOT}/outputs/apr
if ($#argv == 0) then
echo "Usage: SJapr <command> [flags]"
echo "Commands: syn[thesis], apr, flow"
echo "Flags: -i | --interactive queue steps and run them one at a time with sj_next_step"
exit 1
endif
set cmd = "$1"
# Shift removes the first argument, so $1 becomes the next one (flags)
shift
foreach flag ($argv)
switch ($flag)
case "-i":
case "--interactive":
# config.tcl picks this up as $::config::INTERACTIVE; the tools
# then stay at their prompt with the step queue loaded
setenv SJ_INTERACTIVE 1
set apr_command = "innovus -log apr.log -init ${SCRIPTS}/apr/apr.tcl -legacy_ui"
breaksw
default:
echo "Error: Unknown flag '$flag'"
echo "Valid flags: -i | --interactive"
exit 1
endsw
end
switch ($cmd)
case "syn":
case "synth":
case "synthesis":
cat ${SCRIPTS}/helpers/LOGO.txt
${SCRIPTS}/helpers/rename_rundir.tcsh ${syn_rundir} synthesis.log
mkdir -p ${syn_rundir}/DBS ${syn_rundir}/RPT ${syn_rundir}/LOG
cd ${syn_rundir}
eval "$syn_command"
cd ${PREVDIR}
breaksw
case "apr":
cat ${SCRIPTS}/helpers/LOGO.txt
${SCRIPTS}/helpers/rename_rundir.tcsh ${apr_rundir} apr.log
mkdir -p ${apr_rundir}/DBS ${apr_rundir}/RPT ${apr_rundir}/LOG
cd ${apr_rundir}
eval "$apr_command"
cd ${PREVDIR}
breaksw
case "flow":
cat ${SCRIPTS}/helpers/LOGO.txt
${SCRIPTS}/helpers/rename_rundir.tcsh ${syn_rundir} synthesis.log
mkdir -p ${syn_rundir}/DBS ${syn_rundir}/RPT ${syn_rundir}/LOG
cd ${syn_rundir}
eval "$syn_command"
${SCRIPTS}/helpers/rename_rundir.tcsh ${apr_rundir} apr.log
mkdir -p ${apr_rundir}/DBS ${apr_rundir}/RPT ${apr_rundir}/LOG
cd ${apr_rundir}
puts "=============================="
puts "SJAPR INFO: BEGINNING APR FLOW"
puts "=============================="
eval "$apr_command"
cd ${PREVDIR}
breaksw
default:
echo "Error: Unknown command '$cmd'"
echo "Valid commands: syn[thesis], apr, flow"
exit 1
endsw
+58
View File
@@ -0,0 +1,58 @@
#=============================================================================#
# Load Flow Config #
#=============================================================================#
source "$::env(SCRIPTS)/config.tcl"
#=============================================================================#
# Innovus Initialization #
#=============================================================================#
if {$::config::INIT} {
sj_run_step step_init_apr
}
#=============================================================================#
# Floorplan #
#=============================================================================#
if {$::config::FLOORPLAN} {
sj_run_step step_floorplan
}
#=============================================================================#
# Placement #
#=============================================================================#
if {$::config::PLACE} {
sj_run_step step_place_std_cells
sj_run_step step_place_ties
}
#=============================================================================#
# Clock Tree Synthesis #
#=============================================================================#
if {$::config::CTS} {
sj_run_step step_pre_cts_opt
sj_run_step step_cts
sj_run_step step_post_cts_opt
}
#=============================================================================#
# Routing #
#=============================================================================#
if {$::config::ROUTE} {
sj_run_step step_route
sj_run_step step_fill
}
#=============================================================================#
# Signoff #
#=============================================================================#
if {$::config::SIGNOFF} {
sj_run_step step_physical_verify
sj_run_step step_extract
}
# This just tells interactive mode that we've pushed all steps onto the stack
if {$::config::INTERACTIVE} {
sj_end_collection
} else {
exit
}
+62
View File
@@ -0,0 +1,62 @@
# Version:1.0 MMMC View Definition File
# Do Not Remove Above Line
# need to manually specify name because Cadence overrides it into a temp file
# ===== Create Library Set ===== #
create_library_set \
-name typical_libs \
-timing [ list \
"$::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T/lib/sky130_tt_1.8_25_nldm.lib" \
"$::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T_tech/lib/sky130_scl_9T_phyCells.lib" \
"$::config::INPUTS/CF_SRAM_1024x32/lib/CF_SRAM_1024x32_tt_180V_100C.lib" \
]
# ===== Create RC Corner ===== #
create_rc_corner \
-name typical_rc \
-T {25} \
-qx_tech_file "$::config::RESOURCES/cadence_sky130/sky130_release_0.1.0/quantus/extraction/typical/qrcTechFile" \
-preRoute_res {1} \
-preRoute_cap {1} \
-postRoute_res {1} \
-postRoute_cap {1} \
-postRoute_xcap {1} \
-preRoute_clkres {0} \
-preRoute_clkcap {0} \
-postRoute_clkres {0} \
-postRoute_clkcap {0}
# ===== Create Operation Condition ===== #
create_op_cond \
-name sky130_typical_op \
-library_file "$::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T/lib/sky130_tt_1.8_25_nldm.lib" \
-P {1} \
-V {1.8} \
-T {25}
# ===== Create Delay Corner ===== #
create_delay_corner \
-name typical_delay_corner \
-library_set {typical_libs} \
-opcond sky130_typical_op \
-rc_corner {typical_rc}
# ===== Create Constraint Mode ===== #
create_constraint_mode \
-name default \
-sdc_files [ list \
"$::config::DESIGN_ROOT/outputs/synthesis/$::config::DESIGN.sdc" \
]
# ===== Create Analysis View ===== #
create_analysis_view \
-name typical_analysis_view \
-constraint_mode {default} \
-delay_corner {typical_delay_corner}
# ===== Set Analysis View ===== #
set_analysis_view \
-setup {typical_analysis_view} \
-hold {typical_analysis_view}
+56
View File
@@ -0,0 +1,56 @@
# Clock
#clockDesign \
# -specFile Clock.ctstch \
# -outDir $::config::RPT_DIR/clock_report \
# -fixedInstBeforeCTS
set_analysis_view -setup {typical_analysis_view} -hold {typical_analysis_view}
set clockBuffers [list \
CLKBUFX2 \
CLKBUFX4 \
CLKBUFX8 \
];
set clockInverters [list \
CLKINVX1 \
CLKINVX2 \
CLKINVX4 \
CLKINVX8 \
];
set clockGatingCells [list \
ICGX1 \
];
set clockLogicCells [list \
CLKAND2X2 \
];
set_ccopt_property target_max_trans 150ps
set_ccopt_property target_skew 150ps
set_ccopt_property buffer_cells $clockBuffers
set_ccopt_property inverter_cells $clockInverters
# Check the delay cell parts using doc (DEL)
#set_ccopt_property delay_cells $clockDelayCells
set_ccopt_property clock_gating_cells $clockGatingCells
# ===== Check Design ===== #
check_design \
-type timing \
-out_file ${::config::RPT_DIR}/CTS/${::config::DESIGN}.check_design.timing
check_design \
-type cts \
-out_file ${::config::RPT_DIR}/CTS/${::config::DESIGN}.check_design.cts
check_design \
-type opt \
-out_file ${::config::RPT_DIR}/CTS/${::config::DESIGN}.check_design.opt
create_ccopt_clock_tree_spec
clock_opt_design -cts \
-outDir $::config::RPT_DIR/CTS/
+47
View File
@@ -0,0 +1,47 @@
# ===== Extract Timing ===== #
extractRC
#rcOut \
# -setload $::config::DBS_DIR/$::config::DESIGN.setload \
# -rc_corner typical_rc
#rcOut \
# -setres $::config::DBS_DIR/$::config::DESIGN.setres \
# -rc_corner typical_rc
#rcOut \
# -spf $::config::DBS_DIR/$::config::DESIGN.spf \
# -rc_corner typical_rc
rcOut \
-spef $::config::DBS_DIR/$::config::DESIGN.spef \
-rc_corner {typical_rc}
global dbgLefDefOutVersion
# ===== Extract SDF ===== #
write_sdf \
-recompute_delay_calc \
-precision 4 \
$::config::DBS_DIR/$::config::DESIGN.sdf
# ===== Save LEF ===== #
write_lef_abstract $::config::DBS_DIR/$::config::DESIGN.lef -specifyTopLayer 5 -stripePin -extractBlockPGPinLayers 5
# ===== Save DEF ===== #
set dbgLefDefOutVersion 5.7
defOut \
-floorplan -netlist \
-routing $::config::DBS_DIR/$::config::DESIGN.def
# ===== Save .lib ===== #
do_extract_model $::config::DBS_DIR/${::config::DESIGN}.lib -view typical_analysis_view
# ===== Save GDS ===== #
streamOut $::config::DBS_DIR/${::config::DESIGN}.gds -mapFile $::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T/gds/sky130_stream.mapFile -libName $::config::DESIGN -units 1000 -mode ALL
# ===== Save Netlist ===== #
saveNetlist $::config::DBS_DIR/${::config::DESIGN}_pnr.v -excludeLeafCell
saveNetlist $::config::DBS_DIR/${::config::DESIGN}.phy.v \
-phys \
-includepowerground \
-excludeLeafCell \
-excludeCellInst {FILL1 FILL2 FILL4 FILL8 FILL16 FILL32 FILL64 FILL_DECAP8 FILL_DECAP16}
# ===== Save the current design ===== #
saveDesign $::config::DBS_DIR/${::config::DESIGN}.enc
+11
View File
@@ -0,0 +1,11 @@
# ===== Add Filler Cells ===== #
setFillerMode -reset
setFillerMode \
-core { FILL1 FILL2 FILL4 FILL8 \
FILL_DECAP8 } \
-createRows true \
-doDRC true \
-ecoMode false
# ===== Add Filler Cells ===== #
addFiller -prefix FILL
+238
View File
@@ -0,0 +1,238 @@
# ===== Floorplan ===== #
## Chip Dimension
### TODO adjust to more appropriate values
### heads up: these variables aren't magic!
### make sure you pass them to the appropriate command.
set x_dim 10000
set y_dim 10000
## Core Offsets
### Sets an offset on where standard cells can be placed.
### This prevents the tools from placing cells under
### the design's power rings on the edges of the floorplan
set left_offset 9.6
set right_offset 9.6
set top_offset 9.6
set bottom_offset 9.6
# FloorPlan Cmd.
#floorPlan -site CoreSite \
# -s $x_dim $y_dim \
# $left_offset $right_offset $bottom_offset $top_offset
## TODO is this using the right variables?
floorPlan -site CoreSite -adjustToSite \
-s 10000 10000 \
$left_offset $bottom_offset $right_offset $top_offset
# Set Design Mode
setDesignMode -process 130 -topRoutingLayer 5
### ===== Place Blocks ===== #
# Edit halo around every block
## TODO are the values for these macro names right?
## reference chip_top.sv
set macro_name_1 data_sram
set macro_name_2 memory_sram
## TODO place blocks in an appropriate location (not 0,0!)
placeInstance $macro_name_1 0 0 -fixed
placeInstance $macro_name_2 0 0 -fixed
# add block halos
addHaloToBlock {21 21 21 21} macro_name_1
addHaloToBlock {21 21 21 21} macro_name_2
# ===== Power Plan ===== #
# ===== Define Global Nets ===== #
globalNetConnect VDD \
-type pgpin \
-pin VDD \
-inst *
globalNetConnect VSS \
-type pgpin \
-pin VSS \
-inst *
globalNetConnect VDD \
-type tiehi \
-all \
-override \
-verbose
globalNetConnect VSS \
-type tielo \
-all \
-override \
-verbose
# SRAM GNC Rules
globalNetConnect VSS \
-type pgpin \
-pin vgnd \
-inst *
globalNetConnect VSS \
-type pgpin \
-pin vnb \
-inst *
globalNetConnect VDD \
-type pgpin \
-pin vpwrm \
-inst *
globalNetConnect VDD \
-type pgpin \
-pin vpwrp \
-inst *
globalNetConnect VDD \
-type pgpin \
-pin vpwra \
-inst *
globalNetConnect VDD \
-type pgpin \
-pin vpb \
-inst *
# ===== Pre Process ===== #
set sprCreateIeRingNets {}
set sprCreateIeRingLayers {}
set sprCreateIeRingWidth 1.0
set sprCreateIeRingSpacing 1.0
set sprCreateIeRingOffset 1.0
set sprCreateIeRingThreshold 1.0
set sprCreateIeRingJogDistance 1.0
# ===== Core Power Ring===== #
setAddRingMode -stacked_via_top_layer met5
setAddRingMode -stacked_via_bottom_layer met1
#copy example. vssd1 on outside, vccd1 on inside
addRing \
-center 1 \
-type core_rings -follow io \
-jog_distance 0.4 \
-threshold 0.4 \
-nets {VSS VDD} \
-layer {bottom met5 top met5 right met4 left met4} \
-width 6.4 \
-spacing 3.2 \
-offset 0
# ===== Block Power Ring===== #
## TODO refer to part 2.3b
## TODO part 2.3c
addRing \
-around cluster \
## ^^ more flags here
## deselect macro groups
deselectAll
# ===== Route Power Wires ===== #
sroute \
-connect { floatingStripe padPin padRing corePin } \
-layerChangeRange { met1 met5 } \
-padPinPortConnect { allPort oneGeom } \
-stripeSCpinTarget { stripe blockring padring ring ringpin blockpin } \
-blockPin useLef \
-allowJogging 1 \
-crossoverViaLayerRange { met1 met5 } \
-allowLayerChange 1 \
-targetViaLayerRange { met1 met5 } \
-nets { VDD VSS }
sroute -connect { blockPin } \
-layerChangeRange { met3 met5 } \
-nets { VDD VSS } \
-blockPinTarget { nearestRingStripe nearestTarget } \
-allowLayerChange 1 \
-blockPinLayer { met3 }
# ===== Power Grid ===== #
setAddStripeMode \
-stacked_via_top_layer met5 \
-stacked_via_bottom_layer met1 \
-allow_jog {padcore_ring block_ring}
#-break_at {block_ring}
set minDis 16
set M2_Width 2
set M2_Offset [expr {$M2_Width/-2}]
set M2_Dis [expr {4*$minDis}]
set M2_Spacing [expr {$M2_Dis/2-$M2_Width}]
set M3_Width 2
set M3_Offset [expr {$M3_Width/-2}]
set M3_Dis [expr {4*$minDis}]
set M3_Spacing [expr {$M3_Dis/2-$M3_Width}]
#
### Many of these numbers are pulled directly
### From the openframe example project
set M4_Width 6.4
set M4_Offset [expr {$M4_Width/-2}]
set M4_Dis 40
set M4_Spacing 3.2
set M5_Width 6.4
set M5_Offset [expr {$M5_Width/-2}]
set M5_Dis 40
set M5_Spacing 3.2
addStripe \
-nets {VDD VSS} \
-layer met4 \
-direction vertical \
-width 6.4 \
-spacing 3.2 \
-set_to_set_distance 40 \
-xleft_offset $M4_Offset \
-switch_layer_over_obs false \
-max_same_layer_jog_length 2 \
-padcore_ring_top_layer_limit met5 \
-padcore_ring_bottom_layer_limit met1 \
-block_ring_top_layer_limit met5 \
-block_ring_bottom_layer_limit met1 \
-use_wire_group 0 \
-snap_wire_center_to_grid None
# Layer M5
setAddStripeMode \
-stacked_via_top_layer met5 \
-stacked_via_bottom_layer met1 \
-allow_jog none
#-break_at {block_ring}
addStripe \
-nets {VDD VSS} \
-layer met5 \
-direction horizontal \
-width 6.4 \
-spacing 3.2 \
-set_to_set_distance 40 \
-ybottom_offset $M5_Offset \
-merge_stripes_value $M5_Width \
-max_same_layer_jog_length 6 \
-padcore_ring_top_layer_limit met5 \
-padcore_ring_bottom_layer_limit met4 \
-block_ring_top_layer_limit met5 \
-block_ring_bottom_layer_limit met4
#-extend_to design_boundary \
# Remove routing blockage
##deleteRouteBlk -all
# ===== Spread Pins ===== #
# moved to the end of the file to avoid conflicting with power stripes
set pins_to_spread_in [dbget [dbget top.terms.isOutput 0 -p].name]
set pins_to_spread_out [dbget [dbget top.terms.isOutput 1 -p].name]
#input pins
editPin -spreadType SIDE -side RIGHT \
-layerH met4 -layerV met3 \
-pin $pins_to_spread_out -fixOverlap 1
editPin -spreadType SIDE -side LEFT \
-layerH met4 -layerV met3 \
-pin $pins_to_spread_in -fixOverlap 1
+20
View File
@@ -0,0 +1,20 @@
# Initializes Flow Settings
foreach dir [list $::config::DBS_DIR $::config::RPT_DIR $::config::LOG_DIR $::config::RPT_DIR/CTS] {
if {![file exists $dir]} {
file mkdir $dir
}
}
setDistributeHost -local
setMultiCpuUsage -localCpu 8 -verbose
set_global _enable_mmmc_by_default_flow $CTE::mmmc_default
sj_run_step step_init_design
#setDesignMode -process 130 -topRoutingLayer 5
# sources the MMMC view file (step_corners.tcl) registered via init_mmmc_file
init_design
setAnalysisMode -analysisType onChipVariation
+27
View File
@@ -0,0 +1,27 @@
# Sets up Flow Files
set ::conf_qxconf_file {NULL}
set ::conf_qxlib_file {NULL}
set ::init_qx_layermap_file "$::config::RESOURCES/cadence_sky130/sky130_release_0.1.0/libs/sky130_fd_pr_main/sky130_fd_pr_main.layermap"
set ::defHierChar {/}
set ::init_gnd_net {VSS}
set ::init_pwr_net {VDD}
set ::init_lef_file [list \
"$::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T_tech/lef/sky130_scl_9T.tlef" \
"$::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T/lef/sky130_scl_9T.lef" \
"$::config::RESOURCES/cadence_sky130/sky130_scl_9T_0.1.2/sky130_scl_9T_tech/lef/sky130_scl_9T_phyCells.lef" \
"$::config::INPUTS/CF_SRAM_1024x32/lef/CF_SRAM_1024x32.lef" \
]
# MMMC view definition -- must be registered before init_design or Innovus
# comes up physical-only and locks out all timing commands (TCLCMD-1239)
set ::init_mmmc_file "$::config::APR_SCRIPTS/steps/step_corners.tcl"
set ::init_top_cell chip_top
set ::init_verilog [list $::config::SYN_OUTPUT/$::config::DESIGN.gate.v]
set ::lsgOCPGainMult 1.000000
+42
View File
@@ -0,0 +1,42 @@
# ===== Verify the Geometry ===== #
setVerifyGeometryMode \
-area { 0 0 0 0 } \
-minWidth true \
-minSpacing true \
-minArea true \
-sameNet true \
-short true \
-overlap true \
-offRGrid false \
-offMGrid true \
-mergedMGridCheck true \
-minHole true \
-implantCheck true \
-minimumCut true \
-minStep true \
-viaEnclosure true \
-antenna false \
-insuffMetalOverlap true \
-pinInBlkg false \
-diffCellViol true \
-sameCellViol false \
-padFillerCellsOverlap true \
-routingBlkgPinOverlap true \
-routingCellBlkgOverlap true \
-regRoutingOnly false \
-stackedViasOnRegNet false \
-wireExt true \
-useNonDefaultSpacing false \
-maxWidth true \
-maxNonPrefLength -1 \
-error 10000 \
-warning 500
verifyGeometry \
-report $::config::RPT_DIR/$::config::DESIGN.geom.rpt
# ===== Verify Connectivity ===== #
verifyConnectivity \
-type all \
-error 10000 \
-warning 500 \
-report $::config::RPT_DIR/$::config::DESIGN.conn.rpt
+27
View File
@@ -0,0 +1,27 @@
## Place Standard Cell
setPlaceMode -reset
setPlaceMode \
-place_global_cong_effort auto \
-place_global_timing_effort high \
-place_global_clock_gate_aware true \
-place_global_clock_power_driven false \
-place_global_clock_power_driven_effort low \
-place_global_ignore_scan true \
-place_global_ignore_spare true \
-place_global_place_io_pins false \
-place_global_reorder_scan false \
-place_global_module_aware_spare false \
-place_detail_preserve_routing false \
-place_detail_remove_affected_routing false \
-place_detail_check_route false \
-place_detail_swap_eeq_cells false
place_design -noPrePlaceOpt
congRepair
# Check Placements
checkPlace $::config::RPT_DIR/$::config::DESIGN.checkPlace
# TODO 2.3b
# report utilization
+12
View File
@@ -0,0 +1,12 @@
# Set Tie High & Low
setTieHiLoMode -reset
setTieHiLoMode \
-cell { TIEHI TIELO } \
-honorDontTouch false \
-createHierPort false \
-prefix TIEHILO_ \
-maxDistance 2000
# Add Tie Cells
addTieHiLo -cell "TIEHI TIELO"
+10
View File
@@ -0,0 +1,10 @@
setOptMode \
-fixCap true \
-fixTran true \
-fixFanoutLoad false
optDesign -postCTS -hold -outDir $::config::RPT_DIR/timingReports
timeDesign -postCTS
timeDesign -postCTS -hold
saveDesign $::config::DESIGN.postCts.dat
+28
View File
@@ -0,0 +1,28 @@
# Set Optimization
setOptMode \
-effort high \
-leakagePowerEffort none \
-dynamicPowerEffort none \
-reclaimArea true \
-simplifyNetlist false \
-allEndPoints false \
-setupTargetSlack 0 \
-holdTargetSlack 0 \
-maxDensity 0.95 \
-drcMargin 0 \
-usefulSkew false \
-addPortAsNeeded false
# Timing Analysis Options
# #--- Note: (IMPOPT-6080) AAE-SI Optimization can only be turned on when the timing analysis mode is set to OCV.
#setDelayCalMode -engine aae -SIAware true -reportOutBound true
#setAnalysisMode -analysisType onChipVariation -cppr both
#setExtractRCMode -engine preRoute
#extractRC
# Optimize
setOptMode \
-fixCap true \
-fixTran true \
-fixFanoutLoad false
optDesign -preCTS -outDir $::config::RPT_DIR/timingReports
+41
View File
@@ -0,0 +1,41 @@
# ===== Detail Route ===== #
# Set NanoRoute
setNanoRouteMode -timingEngine {}
setNanoRouteMode -routeWithTimingDriven true
setNanoRouteMode -routeWithSiDriven false
#setNanoRouteMode -routeWithSiPostRouteFix false
#setNanoRouteMode -routeTopRoutingLayer 6
#setNanoRouteMode -routeBottomRoutingLayer default
#setNanoRouteMode -drouteEndIteration 5
# To remove most of the Short Edge Violations, Please use the following switch to keep all vias within the pin geometries:
setNanoRouteMode -routeWithViaInPin true
# Addition
#setNanoRouteMode -drouteAutoStop false
#setNanoRouteMode -drouteUseMultiCutViaEffort high
setNanoRouteMode -drouteFixAntenna true
#setNanoRouteMode -drouteSearchAndRepair true
#setNanoRouteMode -drouteStartIteration default
#setNanoRouteMode -drouteEndIteration 20
#setNanoRouteMode -hfrouteSearchRepair true
# For avoiding DRC error
#setNanoRouteMode -droutePostRouteSwapVia singleCut
# Route wires
routeDesign
routeDesign -wireOpt
setOptMode \
-fixFanoutLoad true
#optDesign -postRoute -hold
# DRC fix
#ecoRoute -fix_drc
# ===== Optimize ===== #
setOptMode \
-fixCap true \
-fixTran true \
-fixFanoutLoad false
optDesign -postRoute -hold
timeDesign -postRoute -hold
+79
View File
@@ -0,0 +1,79 @@
namespace eval ::config {
#=============================================================================#
# Design Configuration #
#=============================================================================#
variable DESIGN TODO
variable CLOCK_PERIOD 5.0 ;# ns
# relative to sjapr root
variable RTL_SEARCH_SUBDIRS [ list "inputs/src/verilog" ]
#=============================================================================#
# Environment Configuration #
#=============================================================================#
if {![info exists ::env(SCRIPTS)]} {
error "SCRIPTS is not set in the environment -- launch the flow with the SJapr wrapper."
}
# Set by the SJapr wrapper's -i flag: queue steps for sj_next_step
# instead of running the whole stage (see helpers/procs.tcl)
variable INTERACTIVE [expr {[info exists ::env(SJ_INTERACTIVE)] && $::env(SJ_INTERACTIVE)}]
# Script Locations
variable SCRIPTS [file normalize $::env(SCRIPTS)]
variable APR_SCRIPTS ${::config::SCRIPTS}/apr
variable SYNTH_SCRIPTS ${::config::SCRIPTS}/synthesis
variable HOOKS ${::config::SCRIPTS}/hooks
# Input Locations
variable DESIGN_ROOT [file normalize ${::config::SCRIPTS}/..]
variable RESOURCES ${::config::DESIGN_ROOT}/resources
variable INPUTS ${::config::DESIGN_ROOT}/inputs
variable RTL_SEARCH_PATHS [ lmap d ${::config::RTL_SEARCH_SUBDIRS} { file join ${::config::DESIGN_ROOT} $d } ]
# Output Locations
variable RUNDIR [file normalize [pwd]]
variable DBS_DIR $RUNDIR/DBS
variable RPT_DIR $RUNDIR/RPT
variable LOG_DIR $RUNDIR/LOG
## the following are used for grabbing relative outputs between flows;
## in general use the above
variable OUTPUT_ROOT ${::config::DESIGN_ROOT}/outputs
variable SYN_OUTPUT ${::config::OUTPUT_ROOT}/synthesis
variable APR_OUTPUT ${::config::OUTPUT_ROOT}/apr
#=============================================================================#
# Synthesis Configuration #
#=============================================================================#
# Specify enabled stages
variable LIBRARY 1
variable READ 1
variable ENVIRONMENT 1
variable CONSTRAINTS 1
variable COMPILE 1
variable DFT 0
variable REPORT 1
variable DUMP 1
# Compile: Enable/Disable DC_ULTRA option
variable WITH_DC_ULTRA 1
#=============================================================================#
# APR Configuration #
#=============================================================================#
variable FLOW mmmc
# Specify enabled stages
variable INIT 1
variable FLOORPLAN 1
variable PLACE 1
variable CTS 1
variable ROUTE 1
variable SIGNOFF 1
}
source ${::config::SCRIPTS}/helpers/procs.tcl
+11
View File
@@ -0,0 +1,11 @@
_____/\\\\\\\\\\\________/\\\\\\\\\\\____________________________________________
___/\\\/////////\\\_____\/////\\\///_____________________________________________
__\//\\\______\///__________\/\\\______________________/\\\\\\\\\________________
___\////\\\_________________\/\\\______/\\\\\\\\\_____/\\\/////\\\__/\\/\\\\\\\__
______\////\\\______________\/\\\_____\////////\\\___\/\\\\\\\\\\__\/\\\/////\\\_
_________\////\\\___________\/\\\_______/\\\\\\\\\\__\/\\\//////___\/\\\___\///__
__/\\\______\//\\\___/\\\___\/\\\______/\\\/////\\\__\/\\\_________\/\\\_________
_\///\\\\\\\\\\\/___\//\\\\\\\\\______\//\\\\\\\\/\\_\/\\\_________\/\\\_________
___\///////////______\/////////________\////////\//__\///__________\///__________
+185
View File
@@ -0,0 +1,185 @@
####################################################
# Helper procs for running the flow #
# Cooper Shaw, 7/24/26 #
####################################################
# Interactive-mode state: while a driver is sourced with
# $::config::INTERACTIVE set, sj_run_step collects step names here
# instead of executing them (see sj_next_step and friends below)
namespace eval ::sj {
variable step_queue {}
variable collecting $::config::INTERACTIVE
}
# Source a path, forwarding output to logfile
proc sj_source_logged {script_path logfile} {
set cmd [list source $script_path]
uplevel 1 [list redirect -tee $logfile $cmd]
}
# Log per-step status and duration
proc sj_log_summary {step_name status seconds} {
set fh [open $::config::LOG_DIR/flow_summary.log a]
puts $fh [format "%-28s %-6s %5ds" $step_name $status $seconds]
close $fh
}
# Check for a hook file and run it if found
# A design-specific hook (<step_name>.<DESIGN>.<type>.tcl) takes precedence
# over the general one (<step_name>.<type>.tcl)
proc sj_run_hook {step_name type} {
set hookfile ""
foreach candidate [list $step_name.$::config::DESIGN.$type.tcl $step_name.$type.tcl] {
if {[file exists $::config::HOOKS/$candidate]} {
set hookfile $candidate
break
}
}
if {$hookfile eq ""} {
return
}
set hookpath $::config::HOOKS/$hookfile
set hookname [file rootname $hookfile]
set logfile $::config::LOG_DIR/$hookname.log
puts "HOOK_LOCATED: $hookfile"
set start [clock seconds]
puts "SCRIPT_START [clock format $start -format %H:%M:%S]: $hookpath"
puts " log -> $logfile"
set rc [catch {sj_source_logged $hookpath $logfile} err]
set elapsed [expr {[clock seconds] - $start}]
set stamp [clock format [clock seconds] -format %H:%M:%S]
if {$rc} {
puts "SCRIPT_FAIL $stamp (${elapsed}s): $hookfile"
puts " -> see $logfile"
puts " -> $err"
sj_log_summary $hookname FAIL $elapsed
return -code error -errorinfo $::errorInfo $err
}
puts "SCRIPT_END $stamp (${elapsed}s): $hookpath"
sj_log_summary $hookname OK $elapsed
}
# Run a step, teeing log and checking for hooks
proc sj_exec_step {step_name} {
set matches [split [string trim [exec find $::config::SCRIPTS -name $step_name.tcl]] \n]
if {[llength $matches] == 0 || [lindex $matches 0] eq ""} {
puts "ERROR: No file matching $step_name.tcl was found in the scripts directory."
return
}
if {[llength $matches] > 1} {
puts "ERROR: $step_name.tcl is ambiguous -- step file basenames must be unique:"
foreach m $matches { puts " $m" }
return -code error "ambiguous step name: $step_name"
}
set script_path [lindex $matches 0]
set logfile $::config::LOG_DIR/$step_name.log
sj_run_hook $step_name pre
set start [clock seconds]
puts "SCRIPT_START [clock format $start -format %H:%M:%S]: $script_path"
puts " log -> $logfile"
set rc [catch {sj_source_logged $script_path $logfile} err]
set elapsed [expr {[clock seconds] - $start}]
set stamp [clock format [clock seconds] -format %H:%M:%S]
if {$rc} {
puts "SCRIPT_FAIL $stamp (${elapsed}s): $step_name"
puts " -> see $logfile"
puts " -> $err"
sj_log_summary $step_name FAIL $elapsed
return -code error -errorinfo $::errorInfo $err
}
puts "SCRIPT_END $stamp (${elapsed}s): $script_path"
sj_log_summary $step_name OK $elapsed
sj_run_hook $step_name post
}
# Run a step -- or, while an interactive driver is collecting its step
# list, queue it for sj_next_step instead
proc sj_run_step {step_name} {
if {$::sj::collecting} {
lappend ::sj::step_queue $step_name
puts "QUEUED: $step_name"
return
}
sj_exec_step $step_name
}
# End interactive step collection: called by the drivers once all steps
# are queued, so later sj_run_step calls execute immediately again
proc sj_end_collection {} {
set ::sj::collecting 0
puts ""
puts "Interactive mode: [llength $::sj::step_queue] steps queued."
sj_list_steps
puts "Commands: sj_next_step | sj_run_remaining | sj_skip_step | sj_list_steps"
}
# Show the remaining step queue, next step first
proc sj_list_steps {} {
if {[llength $::sj::step_queue] == 0} {
puts "No steps remaining."
return
}
set first 1
foreach step $::sj::step_queue {
if {$first} {
puts " -> $step"
set first 0
} else {
puts " $step"
}
}
}
# Run the next queued step; on failure it stays at the head of the
# queue so it can be retried (or dropped with sj_skip_step)
proc sj_next_step {} {
if {[llength $::sj::step_queue] == 0} {
puts "No steps remaining."
return 0
}
set step_name [lindex $::sj::step_queue 0]
if {[catch {sj_exec_step $step_name} err]} {
puts "sj_next_step: $step_name failed and remains next in the queue."
return 0
}
set ::sj::step_queue [lrange $::sj::step_queue 1 end]
if {[llength $::sj::step_queue]} {
puts "NEXT STEP: [lindex $::sj::step_queue 0]"
} else {
puts "All steps complete."
}
return 1
}
# Drop the next queued step without running it
proc sj_skip_step {} {
if {[llength $::sj::step_queue] == 0} {
puts "No steps remaining."
return
}
set step_name [lindex $::sj::step_queue 0]
set ::sj::step_queue [lrange $::sj::step_queue 1 end]
puts "SKIPPED: $step_name"
sj_list_steps
}
# Run all remaining queued steps, stopping at the first failure
proc sj_run_remaining {} {
while {[llength $::sj::step_queue]} {
if {![sj_next_step]} {
return
}
}
}
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env tcsh
# archive_rundir <rundir> <log_basename>
#
# If <rundir> exists, rename it to "<rundir>_<MMDD>_<HHMM>" so a fresh run can
# start from an empty directory without discarding the previous run's
# outputs. The timestamp comes from the creation time of <rundir>/<log_basename>
# (the stage's toplevel dc_shell-t/innovus log); if that file is missing, or
# the filesystem doesn't track creation time (stat reports 0), its
# modification time is used instead.
# this exists to prevent code duplication in the SJapr script; it has
# to be its own file because tcsh doesnt have functions (boooo!!!)
if ($#argv != 2) then
echo "Usage: archive_rundir <rundir> <log_basename>"
exit 1
endif
set rundir = "$1"
set logname = "$2"
if (! -d "$rundir") then
exit 0
endif
set logfile = "${rundir}/${logname}"
if (-e "$logfile") then
set src = "$logfile"
else
set src = "$rundir"
endif
set epoch = `stat -c '%W' "$src"`
if ("$epoch" == "0") then
set epoch = `stat -c '%Y' "$src"`
endif
set stamp = `date -d "@${epoch}" +%m%d_%H%M`
mv "$rundir" "${rundir}_${stamp}"
+262
View File
@@ -0,0 +1,262 @@
import re
import os
import sys
# The generated .f lists live next to this script, not under the caller's cwd --
# the flow runs the tools from outputs/<stage>/, so relative paths would escape.
LISTS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lists')
synopsys = True
# global variables
search_dirs = []
file_path_list = {}
modules = {}
module_names = []
# if you're reading this code stop before its too late
# it will ruin you like it ruined me . .. .
define_module_regex = re.compile(r'^(?<!end)module ([^\s(#]+)( |\(|$|\#)', re.MULTILINE)
define_interface_regex = re.compile(r'^(?<!end)interface (\S+).*;', re.MULTILINE)
define_package_regex = re.compile(r'^(?<!end)package (\S+).*;', re.MULTILINE)
def parse_file_for_defines(filepath):
with open(filepath, 'r') as file:
file_contents = file.read();
modules = {}
found = False
for match in define_module_regex.finditer(file_contents):
module_name = match.group(1)
modules[module_name] = filepath
found = True
for match in define_interface_regex.finditer(file_contents):
module_name = match.group(1)
modules[module_name] = filepath
found = True
for match in define_package_regex.finditer(file_contents):
module_name = match.group(1)
modules[module_name] = filepath
found = True
filename_regex = re.compile(r'([^/\\]+?)\.([^.\\/]+)$')
for match in filename_regex.finditer(filepath):
module_name = match.group(1)
modules[module_name] = filepath
return modules
def has_defines(filepath):
with open(filepath, 'r') as file:
file_contents = file.read();
modules = {}
found = False
for match in define_module_regex.finditer(file_contents):
module_name = match.group(1)
modules[module_name] = filepath
found = True
for match in define_interface_regex.finditer(file_contents):
module_name = match.group(1)
modules[module_name] = filepath
found = True
for match in define_package_regex.finditer(file_contents):
module_name = match.group(1)
modules[module_name] = filepath
found = True
return found
def find_modules():
modules_found = {}
for topdir in search_dirs:
for dirpath, dirnames, filenames in os.walk(topdir):
for filename in filenames:
file_path_list[filename] = (os.path.join(dirpath, filename))
if filename.endswith(('.sv', '.v', '.svh')):
modules_found.update(parse_file_for_defines(os.path.join(dirpath, filename)))
return modules_found
import_regex = re.compile(r'^import (\S+)::.*', re.MULTILINE)
include_regex = re.compile(r'^`include "(\S+)\.(\S+)"', re.MULTILINE)
def parse_file_for_dependences(filepath):
with open(filepath, 'r') as f:
file_contents = f.read()
import_dependencies = []
include_dependencies = []
# add imported modules to dependencies
for match in import_regex.finditer(file_contents):
matchname = match.group(1)
if matchname in modules:
import_dependencies.append(modules[matchname])
else:
print(f"ERROR: dependency {matchname} does not exist in search directories")
sys.exit(1)
# add included modules to dependecies if they're not already in there from imports
for match in include_regex.finditer(file_contents):
matchname = match.group(1)
matches = []
if '.' in matchname:
matchname = matchname.split('.')[0]
for module in parse_file_for_defines(modules[matchname]):
matches.append(modules[matchname])
else:
matches.append(matchname)
for matchname in matches:
if matchname in module_names:
include_dependencies.append(modules[matchname])
else:
print(f"ERROR: dependency {matchname} does not exist in search directories")
sys.exit(1)
# order doesn't matter
dependencies = import_dependencies + include_dependencies
for module in module_names:
# An instantiation's type name is the first token on its line. Anchoring
# on that is what keeps prose ("// top wall"), commented-out instances,
# and instance names that collide with a filename out of the list -- and
# it excludes the definition line, whose first token is the keyword.
instantiation_regex = re.compile(
rf"^[ \t]*({re.escape(module)})(?=[\s#(.])", re.MULTILINE
)
for match in instantiation_regex.finditer(file_contents):
matchname = match.group(1)
if matchname in modules.keys() and modules[matchname] not in dependencies:
dependencies.append(modules[matchname])
return dependencies
# engineer writes slowest function ever, asked to leave club
def collect_hierarchy(module_path, seen=None):
if seen is None:
seen = set()
if module_path in seen:
return []
seen.add(module_path)
module_dependency_filepaths = parse_file_for_dependences(module_path)
hierarchy = []
for dep_path in module_dependency_filepaths:
# Recurse first to find the deepest dependencies
child_deps = collect_hierarchy(dep_path, seen)
for child in child_deps:
if child not in hierarchy:
hierarchy.append(child)
# Then add the dependency itself (it's now "ready" because its children are added)
if dep_path not in hierarchy:
hierarchy.append(dep_path)
return hierarchy
if __name__ == "__main__":
# check that arguments were provided
if len(sys.argv) < 3:
print("Usage: get_rtl.py <top_module> <codebase_paths>", file=sys.stderr)
print("Example: python3.12 get_rtl.py execute_stage /path/to/SJapr/tapeouts/to2/src /path/to/SJapr/tapeouts/to2/packages")
sys.exit(1)
# ingest toplevel module name and codebase path
toplevel_module_name = sys.argv[1]
del sys.argv[0]
del sys.argv[0]
search_dirs = sys.argv
# modules is a dict with <modulename>: <filepath>
modules = find_modules()
module_names = list(modules.keys())
print(modules)
try:
toplevel_module_path = modules[toplevel_module_name]
except:
print(f"ERROR: RTL module {toplevel_module_name} not found in RTL search paths.")
sys.exit(1)
hierarchy = collect_hierarchy(toplevel_module_path)
if modules[toplevel_module_name] not in hierarchy:
hierarchy.append(modules[toplevel_module_name])
assumed_headers = []
for filepath in hierarchy:
if not has_defines(filepath):
assumed_headers.append(filepath)
hierarchy.remove(filepath)
headers = []
for path in hierarchy:
if ".svh" in path:
headers.append(path)
hierarchy.remove(path)
assumed_headers.extend(hierarchy)
headers.extend(assumed_headers)
hierarchy = headers
os.makedirs(LISTS_DIR, exist_ok=True)
# synopsys finds headers itself for some reason
if (synopsys):
try:
with open(os.path.join(LISTS_DIR, 'header_directory_list.f'), 'w') as header_directory_list:
with open(os.path.join(LISTS_DIR, 'header_list.f'), 'w') as header_list:
headers = []
for filepath in hierarchy[:]:
if filepath.endswith('.svh'):
piece_list = filepath.split('/')
path = filepath.replace(piece_list[len(piece_list)-1], '', 1)
header_list.write(f"{filepath}\n")
if path not in headers:
headers.append(path)
header_directory_list.write(f"{path}\n")
hierarchy.remove(filepath)
except Exception:
pass
with open(os.path.join(LISTS_DIR, 'file_list.f'), 'w') as file_list:
for filepath in hierarchy:
file_list.write(f"{filepath}\n")
+1
View File
@@ -0,0 +1 @@
insert_clock_gating
+30
View File
@@ -0,0 +1,30 @@
# buffer feedthrus and tieoffs so they exist in the netlist
set_fix_multiple_port_nets -all -buffer_constants
# "multiple port" here means both ends of a net are ports rather than cells
current_design $::config::DESIGN
set_max_area 0.0 ;# dc will optimize area a whole bunch
# some compilation settings that dont apple with DC_ULTRA enabled
set_flatten false
set_structure true -timing true -boolean false
# ## CHIP TOP
# set_ungroup [get_designs pipeline_top*] true
# Compile
if {$::config::WITH_DC_ULTRA} {
if {$::config::DFT} {
compile_ultra -scan -no_autoungroup -no_boundary_optimization
} else {
compile_ultra -no_autoungroup -no_boundary_optimization
}
optimize_netlist -area
} else {
if {$::config::DFT} {
compile -scan -map_effort high -area_effort high
} else {
compile -map_effort high -area_effort high
}
}
+104
View File
@@ -0,0 +1,104 @@
# TODO define a lot of the options in this file
## probably doesnt matter _that_ much, but could
## affect the number of optimization cycles
## during sythesis
#set_max_transition
#set_max_fanout
#set_max_capacitance
# pull clock period in from config file
set CLOCK_PERIOD $::config::CLOCK_PERIOD
### Create real clock if clock port is found
##if {[sizeof_collection $::input_clocks] > 0} {
## foreach_in_collection clk $::input_clocks {
## set clk_name [get_attribute $clk name]
## create_clock -name "$clk_name" \
## -period "$CLOCK_PERIOD" \
## -waveform "[expr $CLOCK_PERIOD/2] $CLOCK_PERIOD" \
## $clk_name
## # prevent buffering; step_environment.tcl also sets infinite drive on the clock ports
## set_dont_touch_network $clk
## set_fix_hold $clk
##
## # input delay
## set_input_delay -min 0.05 [all_inputs] -clock $clk_name
## set_input_delay -max 0.3 [all_inputs] -clock $clk_name
##
## # output delay
## set_output_delay 0.3 [all_outputs] -clock $clk_name
## }
##}
# ================= #
# CHIP TOP CLOCKING #
# ================= #
if {[sizeof_collection [get_ports clk_i]] > 0} {
#set clk_name phi
create_clock -name "coreClk" \
-period "$CLOCK_PERIOD" \
-waveform "[expr $CLOCK_PERIOD/2] $CLOCK_PERIOD" \
[get_ports clk_i]
#set_dont_touch_network find(clock, "phi")
set_fix_hold coreClk
}
# ================= #
# ================= #
# ================= #
# Create virtual clock if clock port is not found
# (this probably wont happen)
##if {[sizeof_collection $::input_clocks] == 0} {
## set clk_name vclk
## create_clock -name "vclk" \
## -period "$CLOCK_PERIOD" \
## -waveform "[expr $CLOCK_PERIOD/2] $CLOCK_PERIOD"
## #set_dont_touch_network find(clock, "vclk")
## set_fix_hold vclk
##}
# TODO
#set_clock_latency
#set_propagated_clock
#set_clock_uncertainty -setup 0.45 $clk_name
#set_clock_transition
# TODO not sure how delay works when we are
# generating the clock signal on chip (with RO)
# COOPER: moved into for loop
### input delay
##set_input_delay -min 0.05 [all_inputs] -clock $clk_name
##set_input_delay -max 0.3 [all_inputs] -clock $clk_name
##
### output delay
##set_output_delay 0.3 [all_outputs] -clock $clk_name
# max delay
#set_max_delay [expr 0.3*$CLOCK_PERIOD]
# min delay
#set_min_delay [expr 0.1*$CLOCK_PERIOD]
# we could optimize for area, but our utilzation is low.
# so we dont!
# (dont ask me why this is in step_constraints)
#compile -area_effort high -auto_ungroup area
# feedthrough exceptions
# we generally synthesize at the toplevel, so dont do this
#set_max_delay [expr 2.0 + $DMEM_DOUT_DLY + $DMEM_ADDR_DLY] \
# -from [get_ports dmem_dout] \
# -to [get_ports dmem_addr] \
# -group_path FEEDTHROUGH
# TODO FALSE PATHS (could be implemented as hooks?)
# The following signals are internaly synchronized to
# the clk domain and can be set as false path.
#set_false_path -from dbg_uart_rxd
#set_false_path -to dbg_uart_txd
# TODO dont touch (hooks?)
# TODO dont use (hooks?)
+98
View File
@@ -0,0 +1,98 @@
# Initialize PDK locations
set ::PDK_PATH "$::config::RESOURCES/cadence_sky130"
set ::LIB_PATH "$::PDK_PATH/sky130_scl_9T_0.1.2/sky130_scl_9T/lib"
set ::LIB_DBS_PATH "$::config::RESOURCES/synopsys_libs"
# point synopsys to our pre-compiled timing libraries
set ::alib_library_analysis_path $::LIB_DBS_PATH
# best case library
set ::LIB_FF_NAME "sky130_ff_1.98_0"
set ::LIB_FF_DB "$::LIB_DBS_PATH/$::LIB_FF_NAME.db"
# typical case library
set ::LIB_TT_NAME "sky130_tt_1.8_25";
set ::LIB_TT_DB "$::LIB_DBS_PATH/$::LIB_TT_NAME.db"
# worst case library
set ::LIB_SS_NAME "sky130_ss_1.62_125"
set ::LIB_SS_DB "$::LIB_DBS_PATH/$::LIB_SS_NAME.db"
# Operating Conditions (used in step_environment.tcl)
set ::LIB_FF_OPCON "ff_1.98_0"
set ::LIB_TT_OPCON "tt_1.8_25";
set ::LIB_SS_OPCON "ss_1.62_125"
set ::LIB_WIRE_LOAD "ZeroWireload"
set ::NAND2_NAME "NAND2X1"
#=======#
# MACRO #
#=======#
#==============#
# LIBRARY PATH #
#==============#
# set MACRO_LIB_PATH "$::config::RESOURCES/memory"
#================#
# TIMING LIBRARY #
#================#
# 1024w, 140b
# set sram_1024w_140b_NAME "sram_1024w_140b"
# set sram_1024w_140b_LIB_BC_DB "${MACRO_LIB_PATH}/${sram_1024w_140b_NAME}/${sram_1024w_140b_NAME}_nldm_ff_1p10v_1p10v_0c_syn.db"
# set sram_1024w_140b_LIB_BC_NAME "${MACRO_LIB_PATH}/${sram_1024w_140b_NAME}/${sram_1024w_140b_NAME}_nldm_ff_1p10v_1p10v_0c_syn"
# set sram_1024w_140b_LIB_WC_DB "${MACRO_LIB_PATH}/${sram_1024w_140b_NAME}/${sram_1024w_140b_NAME}_nldm_ss_0p90v_0p90v_125c_syn.db"
# set sram_1024w_140b_LIB_WC_NAME "${MACRO_LIB_PATH}/${sram_1024w_140b_NAME}/${sram_1024w_140b_NAME}_nldm_ss_0p90v_0p90v_125c_syn"
# set sram_1024w_140b_LIB_NC_DB "${MACRO_LIB_PATH}/${sram_1024w_140b_NAME}/${sram_1024w_140b_NAME}_nldm_tt_1p00v_1p00v_25c_syn.db" # set sram_1024w_140b_LIB_NC_NAME "${MACRO_LIB_PATH}/${sram_1024w_140b_NAME}/${sram_1024w_140b_NAME}_nldm_tt_1p00v_1p00v_25c_syn"
# ============ #
# OUR STUFF :) #
# ============ #
#set CF_SRAM_1024x32_tt_180V_25C_NAME "CF_SRAM"
set CF_SRAM_1024x32_tt_180V_25C_DB "${::config::DESIGN_ROOT}/inputs/CF_SRAM_1024x32/db/CF_SRAM_1024x32_tt_180V_25C.db"
set CF_SRAM_8192x32__min_tt_025C_1v80_DB "${::config::DESIGN_ROOT}/inputs/CF_SRAM_8192x32/CF_SRAM_8192x32__min_tt_025C_1v80.db"
# TODO ^^^^^ COPY IF USING NEW MACROS
#======================#
# OPERATING CONDITIONS #
#======================#
#===========#
# WIRE LOAD #
#===========#
#================#
# SYMBOL LIBRARY #
#================#
# Search Path
set search_path ""
set search_path "${::LIB_PATH}/symbols/synopsys $search_path" ; ## mysterious and confusing
set search_path "${::LIB_PATH}/synopsys $search_path" ; ## as above
set ::target_library $::LIB_TT_DB
set ::link_library "$::LIB_TT_DB $::LIB_SS_DB $::LIB_FF_DB"
# silence clock gating warnings by avoiding these cells
# TODO: revist if DFT is enabled
set_dont_use [get_lib_cells */SDFF*]
# confusing syntax.
# here, this
# is the lib | for max delay (setup timing)
# and | this
# is the lib | for min delay |
# v (hold timing) v
set_min_library $::LIB_SS_DB -min_version $::LIB_FF_DB
## left as example
#=======#
# MACRO #
#=======#
# 1024w, 140b
# set ::link_library "$link_library $sram_1024w_140b_LIB_NC_DB"
set ::link_library "$::link_library $CF_SRAM_1024x32_tt_180V_25C_DB"
set ::link_library "$::link_library $CF_SRAM_8192x32__min_tt_025C_1v80_DB"
+42
View File
@@ -0,0 +1,42 @@
# TODO im ignoring this file for now
# DFT Signal Type Definitions
set_dft_signal -view spec -type ScanEnable -port scan_enable -active_state 1
set_dft_signal -view existing_dft -type ScanEnable -port scan_enable -active_state 1
set_dft_signal -view spec -type Constant -port scan_mode -active_state 1
set_dft_signal -view existing_dft -type Constant -port scan_mode -active_state 1
set_dft_signal -view existing_dft -type ScanClock -port dco_clk -timing [list 45 55]
set_dft_signal -view existing_dft -type ScanClock -port lfxt_clk -timing [list 45 55]
set_dft_signal -view existing_dft -type Reset -port reset_n -active 0
# DFT Configuration
set_dft_insertion_configuration -preserve_design_name true
set_scan_configuration -style multiplexed_flip_flop
set_scan_configuration -clock_mixing mix_clocks
set_scan_configuration -chain_count 3
# DFT Test Protocol Creation
create_test_protocol
# DFT Design Rule Check
redirect -tee -file $::config::RUNDIR/report.dft_drc {dft_drc}
redirect -file $::config::RUNDIR/report.dft_drc_verbose {dft_drc -verbose}
redirect -file $::config::RUNDIR/report.dft_drc_coverage {dft_drc -coverage_estimate}
redirect -file $::config::RUNDIR/report.dft_scan_config {report_scan_configuration}
redirect -file $::config::RUNDIR/report.dft_insert_config {report_dft_insertion_configuration}
# Preview DFT insertion
redirect -tee -file $::config::RUNDIR/report.dft_preview {preview_dft}
redirect -file $::config::RUNDIR/report.dft_preview_all {preview_dft -show all -test_points all}
# DFT insertion
insert_dft
# DFT Incremental Compile
if {$::config::WITH_DC_ULTRA} {
compile_ultra -scan -incremental
} else {
compile -scan -incremental
}
# DFT Coverage estimate
redirect -file $::config::RUNDIR/report.dft_drc_coverage_post_insert {dft_drc -coverage_estimate}
+15
View File
@@ -0,0 +1,15 @@
current_design $::config::DESIGN
define_name_rules verilog -allowed "a-z0-9_" -type net
change_name -rules verilog -hierarchy
write -hierarchy -format verilog -output "$::config::RUNDIR/$::config::DESIGN.gate.v"
write -hierarchy -format ddc -output "$::config::RUNDIR/$::config::DESIGN.ddc"
if {$::config::DFT} {
write_test_protocol -output "$::config::RUNDIR/$::config::DESIGN.spf"
}
write_sdc "$::config::RUNDIR/$::config::DESIGN.sdc"
write_sdf "$::config::RUNDIR/$::config::DESIGN.sdf"
write_parasitics -output "$::config::RUNDIR/$::config::DESIGN.spef"
+31
View File
@@ -0,0 +1,31 @@
set_operating_conditions -analysis_type on_chip_variation \
-max $::LIB_SS_OPCON -max_library $::LIB_SS_NAME \
-min $::LIB_FF_OPCON -min_library $::LIB_FF_NAME
# default value. calculates all blocks with the top-level WLM
# this only matters for synthesis timing analysis
set_wire_load_mode top
# 'top' treats all nets as though they cross the entire hierarchy.
# this results in pessimistic analysis
# print inputs and outputs for logging/debug
puts "Design contains the following inputs:"
report_collection [all_inputs]
puts "Design contains the following outputs:"
report_collection [all_outputs]
set ::input_clocks [remove_from_collection [get_ports -nocase *clk*] [all_outputs]]
report_collection $::input_clocks
# set infinite drive strength on clock signals to prevent
# DC from inserting buffers on the clock tree.
# step_constraints.tcl sets dont_touch on the clock network for the same reason
if {[sizeof_collection $::input_clocks] > 0} {
set_drive 0 $::input_clocks
}
set_driving_cell -lib_cell BUFX2 [remove_from_collection [all_inputs] $::input_clocks]
#set_load 0.5 [all_outputs] ; ## magic number (highly pessimistic?)
set_load 0.033442 [all_outputs] ;# 33.442 fF from sdc. might be wrong.
+3
View File
@@ -0,0 +1,3 @@
# ===== SUPPRESS MESSAGES ===== #
# Warnings
suppress_message UID-401
+38
View File
@@ -0,0 +1,38 @@
# Synopsys Verification Format (SVF) file. Logs RTL optimizations
set_svf $::config::RUNDIR/$::config::DESIGN.svf
# set working directory. used to store intermediate (GTECH)
# representations of the RTL during elaboration
define_design_lib WORK -path $::config::RUNDIR/WORK
# dynamically generate RTL dependencies, then ingest outputs
try {
set result [exec python3.12 $::config::SYNTH_SCRIPTS/get_rtl.py $::config::DESIGN {*}$::config::RTL_SEARCH_PATHS]
} on error {} {
set result [exec python3 $::config::SYNTH_SCRIPTS/get_rtl.py $::config::DESIGN {*}$::config::RTL_SEARCH_PATHS]
}
set RTL_SOURCE_FILES [split [string trim [read [open $::config::SYNTH_SCRIPTS/lists/file_list.f r]]] "\n"]
set RTL_SOURCE_FILES [lsearch -all -inline -not -glob $RTL_SOURCE_FILES "*CF_SRAM*"]
set RTL_SOURCE_FILES [lsearch -all -inline -not -glob $RTL_SOURCE_FILES "*clockComplex*"]
## CHIP TOP
set_app_var search_path [concat [get_app_var search_path] \
search_path [split [string trim [read [open $::config::SYNTH_SCRIPTS/lists/header_directory_list.f r]]] "\n"]]
set HEADER_SOURCE_FILES [split [string trim [read [open $::config::SYNTH_SCRIPTS/lists/header_list.f r]]] "\n"]
if { $HEADER_SOURCE_FILES ne "" } {
analyze -format sverilog $HEADER_SOURCE_FILES ;# can result in double ingestion. (due to search_path) fix later
}
# pre-compilation linting
analyze -format sverilog $RTL_SOURCE_FILES
# elaborate converts netlist to GTECH primitives
# not "compilation" yet because it still uses
# GTECH cells, not our PDK's cells
elaborate $::config::DESIGN
# check design structure after reading verilog
current_design $::config::DESIGN ;# just prints design name
# run check_design to catch bad RTL and tee it to a logfile
redirect $::config::RUNDIR/report.check {check_design}
+34
View File
@@ -0,0 +1,34 @@
redirect -file $::config::RPT_DIR/report.timing {check_timing}
redirect -file $::config::RPT_DIR/report.constraints {report_constraints -all_violators -verbose}
redirect -file $::config::RPT_DIR/report.paths.max {report_timing -path end -delay max -max_paths 200 -nworst 2}
redirect -file $::config::RPT_DIR/report.full_paths.max {report_timing -path full -delay max -max_paths 5 -nworst 2}
redirect -file $::config::RPT_DIR/report.paths.min {report_timing -path end -delay min -max_paths 200 -nworst 2}
redirect -file $::config::RPT_DIR/report.full_paths.min {report_timing -path full -delay min -max_paths 5 -nworst 2}
redirect -file $::config::RPT_DIR/report.refs {report_reference}
redirect -file $::config::RPT_DIR/report.area {report_area}
redirect -file $::config::RPT_DIR/report.power {report_power}
# add NAND2 size equivalent report to the area report file
# i dont honestly know why this is here
if {[info exists NAND2_NAME]} {
set nand2_area [get_attribute [get_lib_cell $LIB_TT_NAME/$NAND2_NAME] area]
redirect -variable area {report_area}
regexp {Total cell area:\s+([^\n]+)\n} $area whole_match area
set nand2_eq [expr $area/$nand2_area]
set fp [open "$::config::RPT_DIR/report.area" a]
puts $fp ""
puts $fp "NAND2 equivalent cell area: $nand2_eq"
close $fp
puts ""
puts " ======================================================== "
puts " | AREA SUMMARY |"
puts " |--------------------------------------------------------|"
puts " | |"
puts " | $NAND2_NAME cell gate area: [format {%10.4f} $nand2_area] |"
puts " | |"
puts " | Total Area : [format {%10.4f} $area ] |"
puts " | NAND2 equivalent cell area: [format {%10.4f} $nand2_eq ] |"
puts " | |"
puts " ======================================================== "
puts ""
}
+16
View File
@@ -0,0 +1,16 @@
# i dont know why we keep spamming this
current_design $::config::DESIGN
define_name_rules verilog -allowed "a-z0-9_" -type net
change_name -rules verilog -hierarchy
write -hierarchy -format verilog -output "$::config::RUNDIR/$::config::DESIGN.gate.v"
write -hierarchy -format ddc -output "$::config::RUNDIR/$::config::DESIGN.ddc"
if {$::config::DFT} {
write_test_protocol -output "$::config::RUNDIR/$::config::DESIGN.spf"
}
write_sdc "$::config::RUNDIR/$::config::DESIGN.sdc"
write_sdf "$::config::RUNDIR/$::config::DESIGN.sdf"
write_parasitics -output "$::config::RUNDIR/$::config::DESIGN.spef"
+74
View File
@@ -0,0 +1,74 @@
#=============================================================================#
# Load Flow Config #
#=============================================================================#
source "$::env(SCRIPTS)/config.tcl"
#=============================================================================#
# Initialization #
#=============================================================================#
sj_run_step step_init_synthesis
#=============================================================================#
# Read technology library #
#=============================================================================#
if {$::config::LIBRARY} {
sj_run_step step_define_library
}
#=============================================================================#
# Read design RTL #
#=============================================================================#
if {$::config::READ} {
sj_run_step step_read_rtl
}
#=============================================================================#
# Set design environment #
#=============================================================================#
if {$::config::ENVIRONMENT} {
sj_run_step step_environment
}
#=============================================================================#
# Set design constraints #
#=============================================================================#
if {$::config::CONSTRAINTS} {
sj_run_step step_constraints
}
#=============================================================================#
# Compile #
#=============================================================================#
if {$::config::COMPILE} {
sj_run_step step_compile
}
#=============================================================================#
# DFT Insertion #
#=============================================================================#
if {$::config::DFT} {
sj_run_step step_dft
}
#=============================================================================#
# Analyze and resolve design problems #
#=============================================================================#
if {$::config::REPORT} {
sj_run_step step_report
}
#=============================================================================#
# Dump gate level netlist, final DDC file and Test protocol #
#=============================================================================#
if {$::config::DUMP} {
sj_run_step step_write_outputs
}
#=============================================================================#
# Exit #
#=============================================================================#
if {$::config::INTERACTIVE} {
sj_end_collection
} else {
exit
}