|
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| README.md | ||
| blinky.v | ||
| blinky_tb.v | ||
| demo.sh | ||
| mitertest.sh | ||
| simple.sh | ||
| simtest.sh | ||
| tinyfpga.v | ||
README.md
MachXO2 Architecture Example
This contains a simple example of running nextpnr-machxo2:
-
simple.shgenerates JSON output ({pack,place,pnr}blinky.json) of a classic blinky example fromblinky.v. -
simtest.shwill useyosysto generate a Verilog file from{pack,place,pnr}blinky.json, called{pack,place,pnr}blinky.v. It will then and compare{pack,place,pnr}blinky.v's simulation behavior to the original verilog file (blinky.v) using theiverilogcompiler andvvpruntime. This is known as post-place-and-route simulation. -
mitertest.shis similar tosimtest.sh, but more comprehensive. This script creates a miter circuit to compare the output port values of{pack,place,pnr}blinky.vagainst the originalblinky.vwhen both modules are fed the same values on their input ports.All possible inputs and resulting outputs can be tested in reasonable time by using
yosys' built-in SAT solver orz3, an external SMT solver. -
demo.shcreates a blinky bitstream for TinyFPGA Ax and writes the resulting bitstream to MachXO2's internal flash usingtinyproga.
As nextpnr-machxo2 is developed the contents simple.sh, simtest.sh, and
mitertest.sh are subject to change.
How To Run
The following applies to all sh scripts except demo.sh, which requires no
arguments.
Each sh script runs yosys and nextpnr to validate a blinky design in various
ways. The mode argument to each script- pack, place, or pnr- stop
nextpnr-machxo2 after the specified phase and writes out a JSON file of the
results in {pack,place,pnr}blinky.json; pnr runs all of the Pack, Place,
and Route phases.
mitertest.sh requires an additional option- sat or smt- to choose between
verifying the miter with either yosys' built-in SAT solver, or an external
SMT solver.
To keep file count lower, all yosys scripts are written inline inside the
sh scripts using the -p option.
Clean
To clean output files from all scripts, run: rm -rf *.dot *.json *.png *.vcd *.smt2 *.log tinyfpga.txt tinyfpga.bit {pack,place,pnr}*.v blinky_simtest*
Environment Variables For Scripts
YOSYS- Set to the location of theyosysbinary to test. Defaults to theyosyson the path. You may want to set this to ayosysbinary in your source tree if doing development.NEXTPNR- Set to the location of thenextpnr-machxo2binary to test. Defaults to thenextpnr-machxo2binary at the root of thenextpnrsource tree. This should be set, for instance, if doing an out-of-tree build ofnextpnr-machxo2.CELLS_SIM- Set to the location ofmachxo2/cells_sim.vsimulation models. Defaults to whateveryosys-configassociated with the aboveYOSYSbinary returns. You may want to set this to/path/to/yosys/src/share/machxo2/cells_sim.vif doing development;yosys-configcannot find these "before-installation" simulation models.TRELLIS_DB- Set to the location of the Project Trellis database to use. Defaults to nothing, which meansecppackwill use whatever database is on its path.