the guide · 4How do you run CS223 labs on a Mac without Vivado?

What is in the project folder?

A project is one folder. Download the files, do not type them:

mkdir -p ~/cs223/blink && cd ~/cs223/blink
curl -L -o blink.zip https://nosey-dewdrop.github.io/dewfpga/blink.zip && unzip -q blink.zip && rm blink.zip && ls -A
# .vscode  Makefile  blink.sv  blink.xdc  blink_tb.sv  check_xdc.py
file what it is
blink.sv the design: LED 0 blinks once a second while switch 0 is on, LED 15 follows switch 0
blink_tb.sv the testbench: three checks, prints PASS or FAIL
blink.xdc Digilent's Basys3 master XDC with the 33 pin lines for clk, sw and led uncommented. Vivado reads the same file
check_xdc.py compares the design's ports with the XDC before place and route, because nextpnr's own error names the wrong port
Makefile runs the six tools in order. --seed 1 makes every build byte-identical
.vscode/tasks.json Cmd Shift B in VS Code runs make flash

dewfpga new blink gives the same blink.sv, blink_tb.sv and blink.xdc without the Makefile, and its tasks.json says dewfpga flash instead.

If you copied the Makefile from somewhere else and make says missing separator, the tabs became spaces: missing-separator.

Plug the board in over USB, switch it on, then from inside the folder:

make check
yosys            /opt/homebrew/bin/yosys
iverilog         /opt/homebrew/bin/iverilog
openFPGALoader   /opt/homebrew/bin/openFPGALoader
nextpnr-xilinx   /Users/you/fpga/nextpnr-xilinx/build/nextpnr-xilinx
xc7frames2bit    /Users/you/fpga/prjxray/build/tools/xc7frames2bit
chipdb           /Users/you/fpga/chipdb/xc7a35t.bin
fasm2frames      /Users/you/fpga/prjxray/utils/fasm2frames.py
venv             /Users/you/fpga/venv/bin/python

Eight lines, each ending in a path, and no -MISSING- anywhere: done. A line such as chipdb -MISSING- names the step of section 3 to redo (3.4 here). Then:

make sim       # PASS: 3 checks
make bit       # xdc ok / pnr ok / blink.bit, under five seconds
make flash     # Load SRAM ... done 1

The outputs are the same three blocks shown in section 2. make sim also writes blink.vcd. No waveform viewer is installed by this guide; to look at the waveform, open the browser testbench and paste the same blink.sv and blink_tb.sv there, and it draws it.


previous: 3.6 yosys-slang
next: 5 How do you use it for your own lab?
This section in the whole guide
The commands this section names: dewfpga flash · dewfpga new

Stuck on an error? Every error from this setup, filed under the exact line it printed.