Skip to content

Instantly share code, notes, and snippets.

@nihirash
Created May 31, 2021 16:27
Show Gist options
  • Select an option

  • Save nihirash/fbd743e52a192268d2fdb1fc4b64e2c8 to your computer and use it in GitHub Desktop.

Select an option

Save nihirash/fbd743e52a192268d2fdb1fc4b64e2c8 to your computer and use it in GitHub Desktop.
Building ice40 projects :-)
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
SOURCES=$(call rwildcard,rtl,*.v)
RESULT=hardware
TOP=top
NEXTPNRPARAMS=--up5k --package sg48
PCF=top
all: $(RESULT).bin
$(RESULT).bin: $(RESULT).asc
icepack $(RESULT).asc $(RESULT).bin
$(RESULT).asc: $(RESULT).json
nextpnr-ice40 $(NEXTPNRPARAMS) --json $(RESULT).json --pcf $(PCF).pcf --asc $(RESULT).asc
$(RESULT).json: $(SOURCES) $(TOP).pcf vga.hex
yosys -p 'synth_ice40 -top $(TOP) -json $(RESULT).json' $(SOURCES)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment