2024-06-10 14:14:13 +02:00
|
|
|
# This script is roughly similar to the built-in synth_xilinx command, with the
|
|
|
|
# appropriate modifications made in order to output gate netlists rather than
|
2024-07-10 18:13:03 +02:00
|
|
|
# precompiled LUTs (which are not supported by the ISE mapper for Spartan-XL
|
|
|
|
# devices). Note that more advanced features such as fast carry or distributed
|
|
|
|
# LUT RAMs are not yet supported.
|
2024-06-10 14:14:13 +02:00
|
|
|
|
|
|
|
## Input and preliminary optimization
|
|
|
|
|
|
|
|
read_verilog src/main.v
|
2024-07-10 18:13:03 +02:00
|
|
|
read_verilog src/spartanxl/primitives.v
|
2024-06-10 14:14:13 +02:00
|
|
|
hierarchy -check -top FPGA
|
|
|
|
|
|
|
|
proc
|
2024-07-10 18:13:03 +02:00
|
|
|
flatten
|
2024-06-10 14:14:13 +02:00
|
|
|
tribuf -logic
|
|
|
|
deminout
|
|
|
|
opt_expr
|
|
|
|
opt_clean
|
|
|
|
check
|
|
|
|
opt -nodffe -nosdff
|
|
|
|
fsm
|
|
|
|
opt
|
|
|
|
wreduce
|
|
|
|
peepopt
|
|
|
|
opt_clean
|
|
|
|
|
|
|
|
## Conversion to gate-level representation
|
|
|
|
|
2024-07-10 18:13:03 +02:00
|
|
|
techmap -D LUT_WIDTH=4 -map +/cmp2lut.v -map +/cmp2lcu.v
|
2024-06-10 14:14:13 +02:00
|
|
|
alumacc
|
|
|
|
share
|
|
|
|
opt
|
|
|
|
memory -nomap
|
|
|
|
opt_clean
|
2024-07-10 18:13:03 +02:00
|
|
|
memory_map
|
2024-06-10 14:14:13 +02:00
|
|
|
opt -full
|
2024-07-10 18:13:03 +02:00
|
|
|
|
|
|
|
techmap -map +/techmap.v
|
2024-06-10 14:14:13 +02:00
|
|
|
opt -fast
|
|
|
|
clean
|
|
|
|
|
|
|
|
## FPGA-specific mapping
|
|
|
|
|
|
|
|
dfflegalize -cell $_DFFE_PP?P_ r -cell $_DLATCH_PP?_ r
|
|
|
|
opt_expr -mux_undef -noclkinv
|
2024-07-10 18:13:03 +02:00
|
|
|
abc -liberty src/spartanxl/primitives.lib
|
|
|
|
clean
|
2024-06-27 08:35:02 +02:00
|
|
|
|
2024-07-10 18:13:03 +02:00
|
|
|
#hilomap -hicell VCC P -locell GND G
|
2024-06-27 08:35:02 +02:00
|
|
|
iopadmap -bits -inpad IBUF O:I -ignore IPAD IPAD -ignore OPAD OPAD -ignore IOPAD IOPAD -ignore IFDX D -ignore IFDXI D -ignore BUFGLS I
|
2024-07-10 18:13:03 +02:00
|
|
|
iopadmap -bits -outpad OBUF I:O -toutpad OBUFE E:I:O -tinoutpad IOBUFE E:O:I:IO -ignore IPAD IPAD -ignore OPAD OPAD -ignore IOPAD IOPAD -ignore OFDX Q -ignore OFDXI Q -ignore OFDTX O -ignore OFDTXI O
|
|
|
|
clkbufmap -buf BUFGLS O:I
|
|
|
|
#extractinv -inv INV O:I
|
|
|
|
|
|
|
|
techmap -map src/spartanxl/map.v
|
2024-06-10 14:14:13 +02:00
|
|
|
clean
|
|
|
|
|
|
|
|
## Output
|
|
|
|
|
2024-07-10 18:13:03 +02:00
|
|
|
hierarchy -check
|
2024-06-10 14:14:13 +02:00
|
|
|
autoname
|
|
|
|
stat -tech xilinx
|
|
|
|
check -noinit
|
|
|
|
blackbox =A:whitebox
|
|
|
|
|
2024-07-10 18:13:03 +02:00
|
|
|
show -notitle -colors 1 -format dot -viewer none -prefix build/synth
|
2024-06-10 14:14:13 +02:00
|
|
|
write_verilog -noattr build/synth.v
|
|
|
|
write_edif -top FPGA -pvector bra -lsbidx build/synth.edf
|