Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions blinky/Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Project setup
PROJ = blinky
BUILD = ./build
DEVICE = 8k
DEVICE = 1k
#DEVICE = 8k
ifeq (8k,$(DEVICE))
FOOTPRINT = ct256
else
FOOTPRINT = tq144
endif


# Files
FILES = top.v
FILES = top_$(DEVICE).v

.PHONY: all clean burn

all:
all: iceprog $(BUILD)/$(PROJ)_$(DEVICE).bin

iceprog $(BUILD)/$(PROJ)_$(DEVICE).bin: $(FILES)
# if build folder doesn't exist, create it
mkdir -p $(BUILD)
# synthesize using Yosys
yosys -p "synth_ice40 -top top -blif $(BUILD)/$(PROJ).blif" $(FILES)
yosys -p "synth_ice40 -top top -blif $(BUILD)/$(PROJ)_$(DEVICE).blif" $(FILES)
# Place and route using arachne
arachne-pnr -d $(DEVICE) -P $(FOOTPRINT) -o $(BUILD)/$(PROJ).asc -p pinmap.pcf $(BUILD)/$(PROJ).blif
arachne-pnr -d $(DEVICE) -P $(FOOTPRINT) -o $(BUILD)/$(PROJ)_$(DEVICE).asc -p pinmap_$(FOOTPRINT).pcf $(BUILD)/$(PROJ)_$(DEVICE).blif
# Convert to bitstream using IcePack
icepack $(BUILD)/$(PROJ).asc $(BUILD)/$(PROJ).bin
icepack $(BUILD)/$(PROJ)_$(DEVICE).asc $(BUILD)/$(PROJ)_$(DEVICE).bin

burn:
iceprog $(BUILD)/$(PROJ).bin
burn: $(BUILD)/$(PROJ)_$(DEVICE).bin
iceprog $<

clean:
rm build/*
rm -f build/*
File renamed without changes.
7 changes: 7 additions & 0 deletions blinky/pinmap_tq144.pcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# example.pcf
set_io --warn-no-port led1 99
set_io --warn-no-port led2 98
set_io --warn-no-port led3 97
set_io --warn-no-port led4 96
set_io --warn-no-port led5 95
set_io --warn-no-port hwclk 21
27 changes: 27 additions & 0 deletions blinky/top_1k.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Blink an LED provided an input clock
/* module */
module top (hwclk, led1, led2, led3, led4, led5 );
/* I/O */
input hwclk;
output led1;
output led2;
output led3;
output led4;
output led5;

/* Counter register */
reg [31:0] counter = 32'b0;

/* LED drivers */
assign led1 = counter[18];
assign led2 = counter[19];
assign led3 = counter[20];
assign led4 = counter[21];
assign led5 = counter[22];

/* always */
always @ (posedge hwclk) begin
counter <= counter + 1;
end

endmodule
File renamed without changes.