-
Notifications
You must be signed in to change notification settings - Fork 71
Yosys ‐ synth_gowin
The synth_gowin
command in Yosys performs synthesis for Gowin FPGA devices. This command transforms RTL into a netlist that can be used with the subsequent tools in the open source Gowin toolchain.
yosys -p "read_verilog input.v; synth_gowin -json output.json"
-
-json <file>
- Generate JSON netlist compatible with nextpnr-himbaechel for the open source flow (recommended) -
-vout <file>
- Generate Verilog netlist output that can be imported into the proprietary Gowin IDE
-
-top <module>
- Specify the top-level module (default is 'top')
-
-retime
- Enable register retiming optimization using ABC with -dff -D 1 options -
-noflatten
- Preserve design hierarchy by disabling flattening -
-nowidelut
- Avoid using muxes to implement LUTs larger than LUT4s
-
-nobram
- Disable use of block RAM cells (forces use of distributed RAM) -
-nolutram
- Disable use of distributed RAM cells (forces use of block RAM) -
-no-rw-check
- Disables checking for read/write collisions in memory. Only use if you are certain your design handles memory access conflicts correctly, as this can lead to broken designs with undefined behavior.
-
-nodffe
- Avoid using flip-flops with clock enable -
-noalu
- Disable use of arithmetic logic units -
-noiopads
- Skip adding IO buffers to top-level ports -
-noabc9
- Disable the new ABC9 optimization flow
yosys -p "read_verilog design.v; synth_gowin -json design.json"
yosys -p "read_verilog mod1.v mod2.v mod3.v; synth_gowin -top my_top -json output.json"
yosys -p "read_verilog design.v; synth_gowin -retime -json design.json"
Gowin FPGAs support two types of memory implementation:
-
Block RAM (BRAM): Dedicated memory blocks built into the FPGA fabric
- Efficient for larger memories
- Limited resource, fixed locations
- Best for larger, synchronous memories
yosys -p "read_verilog design.v; synth_gowin -nolutram -json design.json"
-
Distributed RAM: Implemented using the FPGA's LUTs
- More flexible placement
- Uses general-purpose logic resources
- Better for small, fast memories
yosys -p "read_verilog design.v; synth_gowin -nobram -json design.json"
Choose the implementation based on your design's size, speed, and resource requirements.
The various -no* options can be used to disable advanced features when troubleshooting synthesis issues:
-
Timing Issues
- Try
-nodffe
to eliminate clock enable logic - Use
-noalu
to avoid complex arithmetic structures
- Try
-
Resource Usage Problems
- Use
-nobram
or-nolutram
to control RAM implementation - Try
-nowidelut
if experiencing LUT-related issues
- Use
-
Optimization Issues
- Try
-noabc9
to use simpler optimization algorithms
- Try
The synth_gowin
command generates a JSON netlist that serves as input for the next step in the toolchain.
For details on the subsequent steps:
- Place and Route: See nextpnr-himbaechel documentation
- Bitstream Generation: See gowin_pack documentation
- Always start with the basic options before adding optimizations
- Use
-retime
when timing is critical - Consider memory implementation carefully based on your design's needs
- When debugging, disable features one at a time using -no* options to isolate issues
- Keep top-level module names consistent across your project
- Verify synthesis results with the built-in
stat
command