2024-07-12 01:17:50 +02:00
|
|
|
# 573in1 - Copyright (C) 2022-2024 spicyjpeg
|
|
|
|
#
|
|
|
|
# 573in1 is free software: you can redistribute it and/or modify it under the
|
|
|
|
# terms of the GNU General Public License as published by the Free Software
|
|
|
|
# Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
# version.
|
|
|
|
#
|
|
|
|
# 573in1 is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along with
|
|
|
|
# 573in1. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
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
|
2024-08-20 00:44:39 +02:00
|
|
|
# devices).
|
2024-06-10 14:14:13 +02:00
|
|
|
|
|
|
|
## Input and preliminary optimization
|
|
|
|
|
2024-08-20 00:44:39 +02:00
|
|
|
read_verilog src/spartanxl/carry.v
|
|
|
|
read_verilog src/spartanxl/io.v
|
|
|
|
read_verilog src/spartanxl/logic.v
|
|
|
|
read_verilog src/spartanxl/memory.v
|
|
|
|
read_verilog src/main/alu.v
|
|
|
|
read_verilog src/main/dram.v
|
|
|
|
read_verilog src/main/main.v
|
|
|
|
read_verilog src/main/mp3.v
|
|
|
|
read_verilog src/main/util.v
|
2024-06-10 14:14:13 +02:00
|
|
|
hierarchy -check -top FPGA
|
|
|
|
|
|
|
|
proc
|
2024-08-20 00:44:39 +02:00
|
|
|
flatten -noscopeinfo
|
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-08-20 00:44:39 +02:00
|
|
|
|
|
|
|
memory_libmap -lib yosys/lutram.txt
|
|
|
|
opt -fast -full
|
2024-07-10 18:13:03 +02:00
|
|
|
memory_map
|
|
|
|
|
2024-08-20 00:44:39 +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-08-20 00:44:39 +02:00
|
|
|
abc -liberty yosys/logic.lib
|
2024-06-27 08:35:02 +02:00
|
|
|
|
2024-07-10 18:13:03 +02:00
|
|
|
#hilomap -hicell VCC P -locell GND G
|
2024-08-20 00:44:39 +02:00
|
|
|
#clkbufmap -buf BUFGLS O:I
|
|
|
|
iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O -toutpad _OBUFE E:I:O -tinoutpad _IOBUFE E:O:I:IO -ignore BUFGLS I -ignore IFDX D -ignore IFDXI D -ignore OFDX Q -ignore OFDXI Q -ignore OFDTX O -ignore OFDTXI O
|
2024-07-10 18:13:03 +02:00
|
|
|
|
2024-08-20 00:44:39 +02:00
|
|
|
techmap -map yosys/cellmap.v
|
2024-06-10 14:14:13 +02:00
|
|
|
clean
|
|
|
|
|
|
|
|
## Output
|
|
|
|
|
2024-08-20 00:44:39 +02:00
|
|
|
# HACK: Yosys complains or inserts extraneous cells if these attributes, which
|
|
|
|
# have already been processed, are not stripped out manually.
|
|
|
|
setattr -unset init
|
|
|
|
setattr -unset wand
|
|
|
|
setattr -unset wor
|
|
|
|
|
2024-07-10 18:13:03 +02:00
|
|
|
hierarchy -check
|
2024-06-10 14:14:13 +02:00
|
|
|
autoname
|
2024-08-20 00:44:39 +02:00
|
|
|
stat
|
2024-06-10 14:14:13 +02:00
|
|
|
check -noinit
|
|
|
|
blackbox =A:whitebox
|
|
|
|
|
2024-08-20 00:44:39 +02:00
|
|
|
write_verilog -norename build/synth.v
|
|
|
|
|
|
|
|
iopadmap -bits -inpad IPAD IPAD -outpad OPAD OPAD -inoutpad IOPAD IOPAD -ignore IPAD IPAD -ignore OPAD OPAD -ignore IOPAD IOPAD
|
|
|
|
write_edif -attrprop -top FPGA -pvector bra -lsbidx build/synth.edf
|