This commit is contained in:
Imbus 2024-04-01 10:40:00 +02:00
commit bd5f6d6e2d
5 changed files with 55 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build

12
README.md Normal file
View file

@ -0,0 +1,12 @@
# Verilog
This is all work in progress.
[Post](https://mcmayer.net/first-steps-with-the-icestorm-toolchain/)
[Video Series](https://www.youtube.com/playlist?list=PLEBQazB0HUyT1WmMONxRZn9NmQ_9CIKhb)
## Dependencies
```bash
sudo dnf install yosys icestorm arachne-pnr
```

6
blinky.pcf Normal file
View file

@ -0,0 +1,6 @@
set_io clk_in 21
set_io led_green_out 95
set_io led_red[0] 96
set_io led_red[1] 97
set_io led_red[2] 98
set_io led_red[3] 99

16
blinky.v Normal file
View file

@ -0,0 +1,16 @@
// blinky.v
// Blink the green LED with frequency 12e6/2^24 = 0.7Hz approx.
module top (clk_in, led_green_out);
input clk_in;
output led_green_out;
reg [23:0] counter;
assign led_green_out = counter[23];
assign led_red[3:0] = 4'b0;
always @ (posedge clk_in) begin
counter <= counter + 1;
end
endmodule

20
makefile Normal file
View file

@ -0,0 +1,20 @@
all: build/blinky.bin
build/blinky.bin: build/blinky.asc
icepack $< $@
build/blinky.asc: blinky.pcf build/blinky.blif
arachne-pnr -d 1k -P tq144 -o $@ -p $^
build/blinky.blif: blinky.v
mkdir -p build
yosys -p "synth_ice40 -top top -blif $@" $^
prog: build/blinky.bin
iceprog build/blinky.bin
clean:
rm build/*
.PHONY: prog clean