commit bd5f6d6e2d2355b656318e28ac4ece78077a517d Author: Imbus <> Date: Mon Apr 1 10:40:00 2024 +0200 Initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/README.md b/README.md new file mode 100644 index 0000000..2076804 --- /dev/null +++ b/README.md @@ -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 +``` diff --git a/blinky.pcf b/blinky.pcf new file mode 100644 index 0000000..674a1eb --- /dev/null +++ b/blinky.pcf @@ -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 diff --git a/blinky.v b/blinky.v new file mode 100644 index 0000000..4c9dbf7 --- /dev/null +++ b/blinky.v @@ -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 diff --git a/makefile b/makefile new file mode 100644 index 0000000..e6390c9 --- /dev/null +++ b/makefile @@ -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 +