diff options
-rw-r--r-- | blinky/Makefile | 23 | ||||
-rw-r--r-- | blinky/blinky.v | 50 | ||||
-rw-r--r-- | blinky/iceFUN.pcf | 15 | ||||
-rw-r--r-- | blinky/readMe | 8 |
4 files changed, 96 insertions, 0 deletions
diff --git a/blinky/Makefile b/blinky/Makefile new file mode 100644 index 0000000..c254fc0 --- /dev/null +++ b/blinky/Makefile @@ -0,0 +1,23 @@ +# Project setup +PROJ = blinky +DEVICE = 8k + +# Files +FILES = blinky.v + +.PHONY: blinky clean burn + +blinky: + # synthesize using Yosys + yosys -p "synth_ice40 -top top -json $(PROJ).json" $(FILES) + # Place and route using nextpnr + nextpnr-ice40 -r --hx8k --json $(PROJ).json --package cb132 --asc $(PROJ).asc --opt-timing --pcf iceFUN.pcf + + # Convert to bitstream using IcePack + icepack $(PROJ).asc $(PROJ).bin + +burn: + iceFUNprog $(PROJ).bin + +clean: + rm *.asc *.bin *blif diff --git a/blinky/blinky.v b/blinky/blinky.v new file mode 100644 index 0000000..8447683 --- /dev/null +++ b/blinky/blinky.v @@ -0,0 +1,50 @@ +/* + * + * Copyright(C) 2018 Gerald Coe, Devantech Ltd <gerry@devantech.co.uk> + * + * Permission to use, copy, modify, and/or distribute this software for any purpose with or + * without fee is hereby granted, provided that the above copyright notice and + * this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + +// Blink an LED provided an input clock +/* module */ +module top (clk, led1, led2, led3, led4, led5, led6, led7, led8, lcol1, lcol2, lcol3, lcol4 ); + /* I/O */ + input clk; + output led1; + output led2; + output led3; + output led4; + output led5; + output led6; + output led7; + output led8; + output lcol1; + output lcol2; + output lcol3; + output lcol4; + + /* Counter register */ + reg [31:0] counter = 32'b0; + + /* LED drivers - counter is inverted for display because leds are active low */ + assign {led8, led7, led6, led5, led4, led3, led2, led1} = counter[26:19] ^ 8'hff; + assign {lcol4, lcol3, lcol2, lcol1} = 4'b1110; + + + /* Count up on every edge of the incoming 12MHz clk */ + always @ (posedge clk) begin + counter <= counter + 1; + end + +endmodule diff --git a/blinky/iceFUN.pcf b/blinky/iceFUN.pcf new file mode 100644 index 0000000..cc011c4 --- /dev/null +++ b/blinky/iceFUN.pcf @@ -0,0 +1,15 @@ +# For iceFUN board + +set_io --warn-no-port led1 C10 +set_io --warn-no-port led2 A10 +set_io --warn-no-port led3 D7 +set_io --warn-no-port led4 D6 +set_io --warn-no-port led5 A7 +set_io --warn-no-port led6 C7 +set_io --warn-no-port led7 A4 +set_io --warn-no-port led8 C4 +set_io --warn-no-port lcol1 A12 +set_io --warn-no-port lcol2 D10 +set_io --warn-no-port lcol3 A6 +set_io --warn-no-port lcol4 C5 +set_io --warn-no-port clk P7 diff --git a/blinky/readMe b/blinky/readMe new file mode 100644 index 0000000..42659af --- /dev/null +++ b/blinky/readMe @@ -0,0 +1,8 @@ +To build the blinky project, install the icestorm toolchain from http://www.clifford.at/icestorm/ +and the iceFUN programmer from https://github.com/devantech/iceFUNprog + +Open a terminal in the blinky folder and enter: +make blinky +make burn + + |