| 1 |
YOSYS ?= yosys |
| 2 |
YOSYS_FLAGS = -setundef |
| 3 |
NEXTPNR ?= nextpnr-himbaechel |
| 4 |
NEXTPNR_FLAGS ?= --timing-allow-fail -r |
| 5 |
DEBUG = -v --debug |
| 6 |
DEBUG = |
| 7 |
|
| 8 |
.DEFAULT_GOAL := all |
| 9 |
|
| 10 |
.PHONY: all primer25k tangmega138k clean |
| 11 |
|
| 12 |
primer25k: \ |
| 13 |
in-out-primer25k.fs in-inv-out-primer25k.fs in-or-inv-out-primer25k.fs \ |
| 14 |
lut8-primer25k.fs big-shift-primer25k.fs alu-simple-primer25k.fs lutram-primer25k.fs \ |
| 15 |
blinky-osc-primer25k.fs pll7-primer25k.fs dcs-primer25k.fs \ |
| 16 |
bsram-DPB-primer25k.fs bsram-DPB16-primer25k.fs bsram-DPX9B-primer25k.fs bsram-DPX9B18-primer25k.fs \ |
| 17 |
bsram-pROM-primer25k.fs bsram-pROMX9-primer25k.fs bsram-SP-primer25k.fs bsram-SPX9-primer25k.fs \ |
| 18 |
bsram-SDPB-primer25k.fs bsram-SDPX9B-primer25k.fs bsram-SDPB32-primer25k.fs \ |
| 19 |
femto-riscv-15-primer25k.fs femto-riscv-16-primer25k.fs femto-riscv-18-primer25k.fs \ |
| 20 |
dsp-mult12x12-primer25k.fs dsp-multaddalu12x12-primer25k.fs dsp-multalu27x18-primer25k.fs \ |
| 21 |
dsp-mult27x36-primer25k.fs \ |
| 22 |
adc-temp-primer25k.fs adc-loc-left-primer25k.fs adc-glo-right-primer25k.fs attosoc-primer25k.fs \ |
| 23 |
oddr-tlvds-primer25k.fs oser4-primer25k.fs oser8-primer25k.fs oser10-primer25k.fs ovideo-primer25k.fs \ |
| 24 |
iddr-primer25k.fs iddrc-primer25k.fs ides4-primer25k.fs ivideo-primer25k.fs \ |
| 25 |
ides8-primer25k.fs ides10-primer25k.fs \ |
| 26 |
oser10-clkdiv-tlvds-primer25k.fs |
| 27 |
|
| 28 |
tangmega138k: \ |
| 29 |
big-shift-tangmega138k.fs attosoc-tangmega138k.fs uart-message-tangmega138k.fs |
| 30 |
|
| 31 |
tangconsole138k: \ |
| 32 |
uart-message-tangmega138k.fs |
| 33 |
|
| 34 |
tangconsole60k: \ |
| 35 |
in-out-tangconsole60k.fs in-inv-out-tangconsole60k.fs in-or-inv-out-tangconsole60k.fs |
| 36 |
|
| 37 |
all: primer25k tangmega138k tangconsole138k tangconsole60k |
| 38 |
|
| 39 |
clean: |
| 40 |
rm -f *.json *.fs *-unpacked.v |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
%-primer25k.fs: %-primer25k.json |
| 45 |
gowin_pack --sspi_as_gpio --cpu_as_gpio -d GW5A-25A -o $@ $< |
| 46 |
|
| 47 |
%-primer25k.json: %-primer25k-synth.json primer25k.cst |
| 48 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top top --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=primer25k.cst --vopt sspi_as_gpio |
| 49 |
|
| 50 |
big-shift-primer25k.json: big-shift-primer25k-synth.json big-shift-primer25k.cst |
| 51 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top top --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=big-shift-primer25k.cst --vopt sspi_as_gpio |
| 52 |
|
| 53 |
alu-%-primer25k.json: alu-%-primer25k-synth.json alu-%-primer25k.cst |
| 54 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top top --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=$(basename $@).cst --vopt sspi_as_gpio |
| 55 |
|
| 56 |
%-primer25k-synth.json: %.v |
| 57 |
$(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}" |
| 58 |
|
| 59 |
big-shift-primer25k-synth.json: big-shift.v |
| 60 |
$(YOSYS) -D INV_BTN=1 -D LEDS_NR=24 -D OSC_TYPE_OSCA -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" |
| 61 |
|
| 62 |
bsram-%-primer25k-synth.json: pll/GW5A-25A.vh io444.vh display-640x480.v %-image-rom.v %-video-ram.v %.v clock-PLLA.v |
| 63 |
$(YOSYS) -D INV_BTN=1 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" |
| 64 |
|
| 65 |
femto-%-primer25k-synth.json: femto-%.v |
| 66 |
$(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}" |
| 67 |
|
| 68 |
attosoc-primer25k.json: attosoc-primer25k-synth.json primer25k.cst |
| 69 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top attosoc --json $< --write $@ --device GW5A-LV25MG121NES --vopt cst=primer25k.cst --vopt sspi_as_gpio |
| 70 |
|
| 71 |
attosoc-primer25k-synth.json: attosoc/attosoc.v attosoc/picorv32.v |
| 72 |
$(YOSYS) -D INV_BTN=1 -p "read_verilog $^; synth_gowin -json $@ -nolutram -strict-gw5a-dffs -family gw5a ${YOSYS_FLAGS}" |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
%-tangmega138k.fs: %-tangmega138k.json |
| 77 |
gowin_pack --cpu_as_gpio -d GW5AST-138C -o $@ $< |
| 78 |
|
| 79 |
%-tangmega138k.json: %-tangmega138k-synth.json tangmega138k.cst |
| 80 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --json $< --write $@ --device GW5AST-LV138PG484AC1/I0 --vopt cst=tangmega138k.cst |
| 81 |
|
| 82 |
big-shift-tangmega138k-synth.json: big-shift.v |
| 83 |
$(YOSYS) -D INV_BTN=0 -D LEDS_NR=16 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" |
| 84 |
|
| 85 |
attosoc-tangmega138k.json: attosoc-tangmega138k-synth.json tangmega138k.cst |
| 86 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --top attosoc --json $< --write $@ --device GW5AST-LV138PG484AC1/I0 --vopt cst=tangmega138k.cst |
| 87 |
|
| 88 |
attosoc-tangmega138k-synth.json: attosoc/attosoc.v attosoc/picorv32.v |
| 89 |
$(YOSYS) -D INV_BTN=0 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" |
| 90 |
|
| 91 |
uart-message-tangmega138k-synth.json: uart-message-tangconsole138k.v |
| 92 |
$(YOSYS) -D INV_BTN=0 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
%-tangconsole138k.fs: %-tangconsole138k.json |
| 97 |
gowin_pack --cpu_as_gpio -d GW5AST-138C -o $@ $< |
| 98 |
|
| 99 |
%-tangconsole138k.json: %-tangconsole138k-synth.json tangconsole138k.cst |
| 100 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --json $< --write $@ --device GW5AST-LV138PG484AC1/I0 --vopt cst=tangconsole138k.cst |
| 101 |
|
| 102 |
uart-message-tangconsole138k-synth.json: uart-message-tangconsole138k.v |
| 103 |
$(YOSYS) -D INV_BTN=0 -p "read_verilog $^; synth_gowin -json $@ -family gw5a ${YOSYS_FLAGS}" |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
%-tangconsole60k.fs: %-tangconsole60k.json |
| 108 |
gowin_pack --cpu_as_gpio -d GW5AT-60B -o $@ $< |
| 109 |
|
| 110 |
%-tangconsole60k.json: %-tangconsole60k-synth.json tangconsole60k.cst |
| 111 |
$(NEXTPNR) ${NEXTPNR_FLAGS} ${DEBUG} --json $< --write $@ --device GW5AT-LV60PG484AC1/I0 --vopt cst=tangconsole60k.cst |
| 112 |
|
| 113 |
%-tangconsole60k-synth.json: %.v |
| 114 |
$(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}" |