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

How do you install it in one line?

curl -fsSL https://nosey-dewdrop.github.io/dewfpga/install | bash

3 min 37 s to 4 min 17 s over three runs on the tested machine, plus about 4 minutes for the yosys-slang step added on 27 September (measured on its own: 70 s of clone, 2 min 53 s of compiling), 1.4 GB downloaded, about 0.3 GB kept on disk (237 MB measured on 7 October; the optional agent SDK adds 51 MB), about 1 GB while it builds, the installer asks for 2 GB free; on slow wifi it takes longer, and it prints progress the whole time. It never asks for a password. It puts the dewfpga command into ~/.dewfpga (its sha256 is compared with nosey-dewdrop.github.io/dewfpga/dewfpga.tgz.sha256, so a broken download stops here), links it into Homebrew's bin, installs Yosys, openFPGALoader, Icarus Verilog and the build tools of section 3.1 through Homebrew, and builds nextpnr-xilinx, prjxray and the yosys-slang plugin (section 3.6) into ~/fpga at the three commits in section 9. Nothing touches your system Python. The last lines it prints:

all good.

Total: 217 s. Log: /Users/you/fpga/install.log
Next:  dewfpga new blink && cd blink && dewfpga flash

To read the script before running it:

curl -fsSL https://nosey-dewdrop.github.io/dewfpga/install -o install.sh
code install.sh      # read it, then:
bash install.sh

Check that every piece is there:

dewfpga check
dewfpga check  (FPGA_HOME=/Users/you/fpga)
  ✓ yosys            /opt/homebrew/bin/yosys
  ✓ yosys-slang      /Users/you/fpga/yosys-slang/build/slang.so
  ✓ 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
  ✓ fasm2frames      /Users/you/fpga/prjxray/utils/fasm2frames.py
  ✓ chipdb           /Users/you/fpga/chipdb/xc7a35t.bin
  ✓ venv             /Users/you/fpga/venv/bin/python
  ✓ python pkgs      fasm prjxray pyyaml textx simplejson intervaltree
all good.

A red ✗ names the missing piece: run the curl line again (it is the same as dewfpga install), it skips what is done. dewfpga: command not found has two causes: the Homebrew "Next steps" lines from section 1 were not pasted (the installer says so, Homebrew is installed (...) but not on your PATH, and prints the line to paste), or the installer stopped before its last line; scroll up to the first ERROR: line and look it up on the errors page.

Now plug the Basys3 into the Mac with the USB cable (the PROG port, next to the power switch) and flip the power switch on. Make the example project and flash it:

dewfpga new blink    # prints: blink/ ready:  cd blink && dewfpga flash    (VS Code: ⌘⇧B)
cd blink
dewfpga sim          # simulation
dewfpga bit          # .sv -> .bit
dewfpga flash        # .bit -> the board; runs bit first when the .bit is missing or older than the .sv

What each one prints when it works. dewfpga sim:

VCD info: dumpfile blink.vcd opened for output.
PASS: 3 checks (see the waveform for the toggle)
blink_tb.sv:35: $finish called at 200000 (1ps)

dewfpga bit, three lines: the pin check, place and route, the bitstream. The full place-and-route log is in blink.log.

xdc ok: 33 ports, all mapped.
pnr ok: 73 LUT, 27 FF, 278.71 MHz (PASS at 100.00 MHz)   (full log: blink.log)
blink.bit  2.2 MB

dewfpga flash:

Jtag frequency : requested 6.00MHz    -> real 6.00MHz
Open file DONE
Parse file DONE
load program
Load SRAM: [==================================================] 100.00%

Done
Shift IR 35
ir: 1 isc_done 1 isc_ena 0 init 1 done 1

done 1 means the chip accepted the design. Flip switch 0 up (SW0, the rightmost of the 16 switches): LED 15 (LD15, leftmost) lights and LED 0 (LD0, rightmost, just above SW0) blinks once a second. The design lives in SRAM, so a power cycle clears it; flash again.

If it prints ERROR: board not found. Is the USB (PROG port) plugged in and the power switch ON? instead, the Mac does not see the board: power switch, PROG port, a charge-only cable, the adapter, or the JP2 jumper. The board not found page goes through them in order.

The rules dewfpga follows in a folder:

dewfpga install                     install the toolchain (safe to re-run)
dewfpga check                       is every piece in place
dewfpga sim|bit|flash|clean [top]   build a flat folder or a Vivado project
dewfpga tops                        list top candidates without writing files
dewfpga vscode [--remove]           set up or remove the editor integration
dewfpga new <dir>                   blink example with a VS Code task (Cmd Shift B = flash)
dewfpga uninstall                   remove what install built in ~/fpga, the CLI and its link;
                                    your files in ~/fpga and the brew packages stay
dewfpga --version

Continue with section 5.


previous: 1 What do you need before you start?
next: 3 How do you build the chain by hand?
This section in the whole guide
The commands this section names: dewfpga install · dewfpga check · dewfpga sim · dewfpga bit · dewfpga flash · dewfpga clean · dewfpga tops · dewfpga new · dewfpga uninstall · dewfpga vscode

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