2021-03-16 17:52:18 -05:00
|
|
|
# Yosys synthesis script for ${TOP_MODULE}
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Parse input files
|
|
|
|
#########################
|
|
|
|
# Read verilog files
|
|
|
|
${READ_VERILOG_FILE}
|
|
|
|
# Read technology library
|
2021-03-16 20:51:48 -05:00
|
|
|
read_verilog -lib -specify ${YOSYS_CELL_SIM_VERILOG}
|
2021-03-16 17:52:18 -05:00
|
|
|
|
|
|
|
#########################
|
|
|
|
# Prepare for synthesis
|
|
|
|
#########################
|
|
|
|
# Identify top module from hierarchy
|
|
|
|
hierarchy -check -top ${TOP_MODULE}
|
|
|
|
# - Convert process blocks to AST
|
|
|
|
proc
|
|
|
|
# Flatten all the gates/primitives
|
|
|
|
flatten
|
|
|
|
# Identify tri-state buffers from 'z' signal in AST
|
|
|
|
# with follow-up optimizations to clean up AST
|
|
|
|
tribuf -logic
|
|
|
|
opt_expr
|
|
|
|
opt_clean
|
|
|
|
# demote inout ports to input or output port
|
|
|
|
# with follow-up optimizations to clean up AST
|
|
|
|
deminout
|
2021-10-30 16:36:43 -05:00
|
|
|
opt -nodffe -nosdff
|
2021-03-16 17:52:18 -05:00
|
|
|
|
2021-03-17 16:12:04 -05:00
|
|
|
opt_expr
|
|
|
|
opt_clean
|
|
|
|
check
|
2021-10-30 16:36:43 -05:00
|
|
|
opt -nodffe -nosdff
|
2021-03-17 16:12:04 -05:00
|
|
|
wreduce -keepdc
|
|
|
|
peepopt
|
|
|
|
pmuxtree
|
|
|
|
opt_clean
|
2021-04-27 22:44:27 -05:00
|
|
|
|
|
|
|
#########################
|
|
|
|
# Run coarse synthesis
|
|
|
|
#########################
|
2021-03-17 16:12:04 -05:00
|
|
|
# Extract arithmetic functions
|
|
|
|
alumacc
|
2021-04-27 22:44:27 -05:00
|
|
|
share
|
2021-10-30 16:36:43 -05:00
|
|
|
opt -nodffe -nosdff
|
2021-03-17 16:12:04 -05:00
|
|
|
fsm
|
2021-03-16 17:52:18 -05:00
|
|
|
# Run a quick follow-up optimization to sweep out unused nets/signals
|
2021-10-30 21:17:11 -05:00
|
|
|
# FIXME: In Yosys v0.10, when options '-nodffe' and '-nosdff' is on, some dual-port ram cannot be inferred correctly
|
2021-10-30 17:34:30 -05:00
|
|
|
opt -fast #-nodffe -nosdff
|
2021-03-16 17:52:18 -05:00
|
|
|
# Optimize any memory cells by merging share-able ports and collecting all the ports belonging to memorcy cells
|
|
|
|
memory -nomap
|
|
|
|
opt_clean
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Map logics to BRAMs
|
|
|
|
#########################
|
2021-03-16 20:51:48 -05:00
|
|
|
memory_bram -rules ${YOSYS_BRAM_MAP_RULES}
|
|
|
|
techmap -map ${YOSYS_BRAM_MAP_VERILOG}
|
2021-10-30 16:36:43 -05:00
|
|
|
opt -fast -mux_undef -undriven -fine -nodffe -nosdff
|
2021-03-16 17:52:18 -05:00
|
|
|
memory_map
|
2021-10-30 16:36:43 -05:00
|
|
|
opt -undriven -fine -nodffe -nosdff
|
2021-03-16 17:52:18 -05:00
|
|
|
|
|
|
|
#########################
|
|
|
|
# Map flip-flops
|
|
|
|
#########################
|
2021-10-30 16:36:43 -05:00
|
|
|
dfflegalize -cell $_DFF_P_ 0
|
2021-03-16 17:52:18 -05:00
|
|
|
techmap -map +/adff2dff.v
|
|
|
|
opt_expr -mux_undef
|
|
|
|
simplemap
|
|
|
|
opt_expr
|
|
|
|
opt_merge
|
2021-10-30 16:36:43 -05:00
|
|
|
opt_dff -nodffe -nosdff
|
2021-03-16 17:52:18 -05:00
|
|
|
opt_clean
|
2021-10-30 16:36:43 -05:00
|
|
|
opt -nodffe -nosdff
|
2021-03-16 17:52:18 -05:00
|
|
|
|
|
|
|
#########################
|
|
|
|
# Map LUTs
|
|
|
|
#########################
|
|
|
|
abc -lut ${LUT_SIZE}
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Check and show statisitics
|
|
|
|
#########################
|
|
|
|
hierarchy -check
|
|
|
|
stat
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Output netlists
|
|
|
|
#########################
|
|
|
|
opt_clean -purge
|
|
|
|
write_blif ${OUTPUT_BLIF}
|