YOSYS ?= yosys YOSYS_FLAGS = -setundef NEXTPNR ?= nextpnr-himbaechel NEXTPNR_FLAGS ?= --timing-allow-fail -r DEBUG = -v --debug DEBUG = .DEFAULT_GOAL := all .PHONY: all primer25k tangmega138k clean primer25k: \ in-out-primer25k.fs in-inv-out-primer25k.fs in-or-inv-out-primer25k.fs \ lut8-primer25k.fs big-shift-primer25k.fs alu-simple-primer25k.fs lutram-primer25k.fs \ blinky-osc-primer25k.fs pll7-primer25k.fs dcs-primer25k.fs \ bsram-DPB-primer25k.fs bsram-DPB16-primer25k.fs bsram-DPX9B-primer25k.fs bsram-DPX9B18-primer25k.fs \ bsram-pROM-primer25k.fs bsram-pROMX9-primer25k.fs bsram-SP-primer25k.fs bsram-SPX9-primer25k.fs \ bsram-SDPB-primer25k.fs bsram-SDPX9B-primer25k.fs bsram-SDPB32-primer25k.fs \ femto-riscv-15-primer25k.fs femto-riscv-16-primer25k.fs femto-riscv-18-primer25k.fs \ dsp-mult12x12-primer25k.fs dsp-multaddalu12x12-primer25k.fs dsp-multalu27x18-primer25k.fs \ dsp-mult27x36-primer25k.fs \ adc-temp-primer25k.fs adc-loc-left-primer25k.fs adc-glo-right-primer25k.fs attosoc-primer25k.fs \ oddr-tlvds-primer25k.fs oser4-primer25k.fs oser8-primer25k.fs oser10-primer25k.fs ovideo-primer25k.fs \ iddr-primer25k.fs iddrc-primer25k.fs ides4-primer25k.fs ivideo-primer25k.fs \ ides8-primer25k.fs ides10-primer25k.fs \ oser10-clkdiv-tlvds-primer25k.fs tangmega138k: \ big-shift-tangmega138k.fs attosoc-tangmega138k.fs uart-message-tangmega138k.fs tangconsole138k: \ uart-message-tangmega138k.fs tangconsole60k: \ in-out-tangconsole60k.fs in-inv-out-tangconsole60k.fs in-or-inv-out-tangconsole60k.fs all: primer25k tangmega138k tangconsole138k tangconsole60k clean: rm -f *.json *.fs *-unpacked.v # ============================================================ # TangPrimer25k %-primer25k.fs: %-primer25k.json gowin_pack --sspi_as_gpio --cpu_as_gpio -d GW5A-25A -o $@ $< %-primer25k.json: %-primer25k-synth.json primer25k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top top --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=primer25k.cst --vopt sspi_as_gpio big-shift-primer25k.json: big-shift-primer25k-synth.json big-shift-primer25k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top top --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=big-shift-primer25k.cst --vopt sspi_as_gpio alu-%-primer25k.json: alu-%-primer25k-synth.json alu-%-primer25k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top top --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=$(basename $@).cst --vopt sspi_as_gpio %-primer25k-synth.json: %.v $(YOSYS) -D INV_BTN=1 -D LEDS_NR=8 -D OSC_TYPE_OSCA -D CPU_FREQ=50 -D BAUD_RATE=115200 -p "read_verilog $^; synth_gowin -json $@ -family gw5a -nolutram ${YOSYS_FLAGS}" big-shift-primer25k-synth.json: big-shift.v $(YOSYS) -D INV_BTN=1 -D LEDS_NR=24 -D OSC_TYPE_OSCA -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" bsram-%-primer25k-synth.json: pll/GW5A-25A.vh io444.vh display-640x480.v %-image-rom.v %-video-ram.v %.v clock-PLLA.v $(YOSYS) -D INV_BTN=1 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" femto-%-primer25k-synth.json: femto-%.v $(YOSYS) -D INV_BTN=1 -D LEDS_NR=8 -D OSC_TYPE_OSCA -D CPU_FREQ=50 -D BAUD_RATE=115200 -p "read_verilog $^; synth_gowin -json $@ -nolutram -family gw5a ${YOSYS_FLAGS}" attosoc-primer25k.json: attosoc-primer25k-synth.json primer25k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top attosoc --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=primer25k.cst --vopt sspi_as_gpio attosoc-primer25k-synth.json: attosoc/attosoc.v attosoc/picorv32.v $(YOSYS) -D INV_BTN=1 -p "read_verilog $^; synth_gowin -json $@ -nolutram -strict-gw5a-dffs -family gw5a ${YOSYS_FLAGS}" # ============================================================ # TangMega138k %-tangmega138k.fs: %-tangmega138k.json gowin_pack --cpu_as_gpio -d GW5AST-138C -o $@ $< %-tangmega138k.json: %-tangmega138k-synth.json tangmega138k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --json $< --write $@ --device GW5AST-LV138PG484AC1/I0 --vopt cst=tangmega138k.cst big-shift-tangmega138k-synth.json: big-shift.v $(YOSYS) -D INV_BTN=0 -D LEDS_NR=16 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" attosoc-tangmega138k.json: attosoc-tangmega138k-synth.json tangmega138k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top attosoc --json $< --write $@ --device GW5AST-LV138PG484AC1/I0 --vopt cst=tangmega138k.cst attosoc-tangmega138k-synth.json: attosoc/attosoc.v attosoc/picorv32.v $(YOSYS) -D INV_BTN=0 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" uart-message-tangmega138k-synth.json: uart-message-tangconsole138k.v $(YOSYS) -D INV_BTN=0 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" # ============================================================ # TangConsole138k %-tangconsole138k.fs: %-tangconsole138k.json gowin_pack --cpu_as_gpio -d GW5AST-138C -o $@ $< %-tangconsole138k.json: %-tangconsole138k-synth.json tangconsole138k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --json $< --write $@ --device GW5AST-LV138PG484AC1/I0 --vopt cst=tangconsole138k.cst uart-message-tangconsole138k-synth.json: uart-message-tangconsole138k.v $(YOSYS) -D INV_BTN=0 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" # ============================================================ # TangConsole60k %-tangconsole60k.fs: %-tangconsole60k.json gowin_pack --cpu_as_gpio -d GW5AT-60B -o $@ $< %-tangconsole60k.json: %-tangconsole60k-synth.json tangconsole60k.cst $(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --json $< --write $@ --device GW5AT-LV60PG484AC1/I0 --vopt cst=tangconsole60k.cst %-tangconsole60k-synth.json: %.v $(YOSYS) -D INV_BTN=1 -D LEDS_NR=8 -D OSC_TYPE_OSCA -D CPU_FREQ=50 -D BAUD_RATE=115200 -p "read_verilog $^; synth_gowin -json $@ -family gw5a -nolutram ${YOSYS_FLAGS}"