Added iCEZUM example

This commit is contained in:
Clifford Wolf 2016-12-29 13:46:20 +01:00
parent 7d8337a138
commit 47d28bff12
4 changed files with 68 additions and 0 deletions

4
examples/icezum/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
example.bin
example.blif
example.asc
example.rpt

30
examples/icezum/Makefile Normal file
View File

@ -0,0 +1,30 @@
PROJ = example
PIN_DEF = icezum.pcf
DEVICE = hx1k
all: $(PROJ).rpt $(PROJ).bin
%.blif: %.v
yosys -p 'synth_ice40 -top top -blif $@' $<
%.asc: $(PIN_DEF) %.blif
arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^
%.bin: %.asc
icepack $< $@
%.rpt: %.asc
icetime -d $(DEVICE) -mtr $@ $<
prog: $(PROJ).bin
iceprog $<
sudo-prog: $(PROJ).bin
@echo 'Executing prog as root!!!'
sudo iceprog $<
clean:
rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin
.SECONDARY:
.PHONY: all prog clean

25
examples/icezum/example.v Normal file
View File

@ -0,0 +1,25 @@
module top (
input clk,
output LED0,
output LED1,
output LED2,
output LED3,
output LED4,
output LED5,
output LED6,
output LED7
);
localparam BITS = 3;
localparam LOG2DELAY = 20;
reg [BITS+LOG2DELAY-1:0] counter = 0;
reg [BITS-1:0] outcnt;
always@(posedge clk) begin
counter <= counter + 1;
outcnt <= counter >> LOG2DELAY;
end
assign {LED7, LED6, LED5, LED4, LED3, LED2, LED1, LED0} = 1 << outcnt;
endmodule

View File

@ -0,0 +1,9 @@
set_io LED0 95
set_io LED1 96
set_io LED2 97
set_io LED3 98
set_io LED4 99
set_io LED5 101
set_io LED6 102
set_io LED7 104
set_io clk 21