diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/hx8kboard/Makefile | 28 | ||||
-rw-r--r-- | examples/hx8kboard/example.v | 2 | ||||
-rw-r--r-- | examples/icestick/Makefile | 28 | ||||
-rw-r--r-- | examples/icestick/example.v | 2 |
4 files changed, 38 insertions, 22 deletions
diff --git a/examples/hx8kboard/Makefile b/examples/hx8kboard/Makefile index 551de32..e9fd789 100644 --- a/examples/hx8kboard/Makefile +++ b/examples/hx8kboard/Makefile @@ -1,18 +1,26 @@ -all: example.bin +PROJ = example +PIN_DEF = hx8kboard.pcf +DEVICE = 8k -example.blif: example.v - yosys -p 'synth_ice40 -top top -blif example.blif' example.v +all: $(PROJ).bin -example.txt: example.blif hx8kboard.pcf - arachne-pnr -d 8k -o example.txt -p hx8kboard.pcf example.blif +%.blif: %.v + yosys -p 'synth_ice40 -top top -blif $@' $< -example.bin: example.txt - icepack example.txt example.bin +%.txt: $(PIN_DEF) %.blif + arachne-pnr -d $(DEVICE) -o $@ -p $^ -prog: - iceprog example.bin +%.bin: %.txt + icepack $< $@ + +prog: $(PROJ).bin + iceprog $< + +sudo-prog: $(PROJ).bin + @echo 'Executing prog as root!!!' + sudo iceprog $< clean: - rm -f example.blif example.txt example.bin + rm -f $(PROJ).blif $(PROJ).txt $(PROJ).bin .PHONY: all prog clean diff --git a/examples/hx8kboard/example.v b/examples/hx8kboard/example.v index 9fc5a11..accbc2e 100644 --- a/examples/hx8kboard/example.v +++ b/examples/hx8kboard/example.v @@ -20,6 +20,6 @@ module top ( counter <= counter + 1; outcnt <= counter >> LOG2DELAY; end - + assign {LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7} = outcnt ^ (outcnt >> 1); endmodule diff --git a/examples/icestick/Makefile b/examples/icestick/Makefile index 295642a..eaed6f7 100644 --- a/examples/icestick/Makefile +++ b/examples/icestick/Makefile @@ -1,18 +1,26 @@ -all: example.bin +PROJ = example +PIN_DEF = icestick.pcf +DEVICE = 1k -example.blif: example.v - yosys -p 'synth_ice40 -top top -blif example.blif' example.v +all: $(PROJ).bin -example.txt: example.blif icestick.pcf - arachne-pnr -d 1k -o example.txt -p icestick.pcf example.blif +%.blif: %.v + yosys -p 'synth_ice40 -top top -blif $@' $< -example.bin: example.txt - icepack example.txt example.bin +%.txt: $(PIN_DEF) %.blif + arachne-pnr -d $(DEVICE) -o $@ -p $^ -prog: - iceprog example.bin +%.bin: %.txt + icepack $< $@ + +prog: $(PROJ).bin + iceprog $< + +sudo-prog: $(PROJ).bin + @echo 'Executing prog as root!!!' + iceprog $< clean: - rm -f example.blif example.txt example.bin + rm -f $(PROJ).blif $(PROJ).txt $(PROJ).bin .PHONY: all prog clean diff --git a/examples/icestick/example.v b/examples/icestick/example.v index cb7cfcd..a934400 100644 --- a/examples/icestick/example.v +++ b/examples/icestick/example.v @@ -17,6 +17,6 @@ module top ( counter <= counter + 1; outcnt <= counter >> LOG2DELAY; end - + assign {LED1, LED2, LED3, LED4, LED5} = outcnt ^ (outcnt >> 1); endmodule |