release
This commit is contained in:
Executable
+262
@@ -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")
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
insert_clock_gating
|
||||
Executable
+30
@@ -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
|
||||
}
|
||||
}
|
||||
Executable
+104
@@ -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
@@ -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"
|
||||
Executable
+42
@@ -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}
|
||||
Executable
+15
@@ -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"
|
||||
Executable
+31
@@ -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
@@ -0,0 +1,3 @@
|
||||
# ===== SUPPRESS MESSAGES ===== #
|
||||
# Warnings
|
||||
suppress_message UID-401
|
||||
Executable
+38
@@ -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}
|
||||
Executable
+34
@@ -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
@@ -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"
|
||||
Executable
+74
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user