aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-12-08 12:54:20 +0100
committerClifford Wolf <clifford@clifford.at>2015-12-08 12:54:20 +0100
commitf7cb6e8e07c9b314e5052c4b0416db422dbdeb7b (patch)
tree28a2a4f556f0b319285c0532c0a084ae5c16b47f /examples
parent2696346d6cbde636c24e853c18272d40b38285bf (diff)
downloadicestorm-f7cb6e8e07c9b314e5052c4b0416db422dbdeb7b.tar.gz
icestorm-f7cb6e8e07c9b314e5052c4b0416db422dbdeb7b.tar.bz2
icestorm-f7cb6e8e07c9b314e5052c4b0416db422dbdeb7b.zip
Added icestick and hx8kboard examples
Diffstat (limited to 'examples')
-rw-r--r--examples/hx8kboard/.gitignore3
-rw-r--r--examples/hx8kboard/Makefile18
-rw-r--r--examples/hx8kboard/example.v25
-rw-r--r--examples/hx8kboard/hx8kboard.pcf9
-rw-r--r--examples/icestick/.gitignore3
-rw-r--r--examples/icestick/Makefile18
-rw-r--r--examples/icestick/example.v22
-rw-r--r--examples/icestick/icestick.pcf6
8 files changed, 104 insertions, 0 deletions
diff --git a/examples/hx8kboard/.gitignore b/examples/hx8kboard/.gitignore
new file mode 100644
index 0000000..4b77d1b
--- /dev/null
+++ b/examples/hx8kboard/.gitignore
@@ -0,0 +1,3 @@
+example.bin
+example.blif
+example.txt
diff --git a/examples/hx8kboard/Makefile b/examples/hx8kboard/Makefile
new file mode 100644
index 0000000..551de32
--- /dev/null
+++ b/examples/hx8kboard/Makefile
@@ -0,0 +1,18 @@
+all: example.bin
+
+example.blif: example.v
+ yosys -p 'synth_ice40 -top top -blif example.blif' example.v
+
+example.txt: example.blif hx8kboard.pcf
+ arachne-pnr -d 8k -o example.txt -p hx8kboard.pcf example.blif
+
+example.bin: example.txt
+ icepack example.txt example.bin
+
+prog:
+ iceprog example.bin
+
+clean:
+ rm -f example.blif example.txt example.bin
+
+.PHONY: all prog clean
diff --git a/examples/hx8kboard/example.v b/examples/hx8kboard/example.v
new file mode 100644
index 0000000..9fc5a11
--- /dev/null
+++ b/examples/hx8kboard/example.v
@@ -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 = 8;
+ localparam LOG2DELAY = 22;
+
+ reg [BITS+LOG2DELAY-1:0] counter = 0;
+ reg [BITS-1:0] outcnt;
+
+ always@(posedge clk) begin
+ counter <= counter + 1;
+ outcnt <= counter >> LOG2DELAY;
+ end
+
+ assign {LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7} = outcnt ^ (outcnt >> 1);
+endmodule
diff --git a/examples/hx8kboard/hx8kboard.pcf b/examples/hx8kboard/hx8kboard.pcf
new file mode 100644
index 0000000..417ca01
--- /dev/null
+++ b/examples/hx8kboard/hx8kboard.pcf
@@ -0,0 +1,9 @@
+set_io LED0 B5
+set_io LED1 B4
+set_io LED2 A2
+set_io LED3 A1
+set_io LED4 C5
+set_io LED5 C4
+set_io LED6 B3
+set_io LED7 C3
+set_io clk J3
diff --git a/examples/icestick/.gitignore b/examples/icestick/.gitignore
new file mode 100644
index 0000000..4b77d1b
--- /dev/null
+++ b/examples/icestick/.gitignore
@@ -0,0 +1,3 @@
+example.bin
+example.blif
+example.txt
diff --git a/examples/icestick/Makefile b/examples/icestick/Makefile
new file mode 100644
index 0000000..295642a
--- /dev/null
+++ b/examples/icestick/Makefile
@@ -0,0 +1,18 @@
+all: example.bin
+
+example.blif: example.v
+ yosys -p 'synth_ice40 -top top -blif example.blif' example.v
+
+example.txt: example.blif icestick.pcf
+ arachne-pnr -d 1k -o example.txt -p icestick.pcf example.blif
+
+example.bin: example.txt
+ icepack example.txt example.bin
+
+prog:
+ iceprog example.bin
+
+clean:
+ rm -f example.blif example.txt example.bin
+
+.PHONY: all prog clean
diff --git a/examples/icestick/example.v b/examples/icestick/example.v
new file mode 100644
index 0000000..cb7cfcd
--- /dev/null
+++ b/examples/icestick/example.v
@@ -0,0 +1,22 @@
+module top (
+ input clk,
+ output LED1,
+ output LED2,
+ output LED3,
+ output LED4,
+ output LED5
+);
+
+ localparam BITS = 5;
+ localparam LOG2DELAY = 22;
+
+ reg [BITS+LOG2DELAY-1:0] counter = 0;
+ reg [BITS-1:0] outcnt;
+
+ always@(posedge clk) begin
+ counter <= counter + 1;
+ outcnt <= counter >> LOG2DELAY;
+ end
+
+ assign {LED1, LED2, LED3, LED4, LED5} = outcnt ^ (outcnt >> 1);
+endmodule
diff --git a/examples/icestick/icestick.pcf b/examples/icestick/icestick.pcf
new file mode 100644
index 0000000..a1693eb
--- /dev/null
+++ b/examples/icestick/icestick.pcf
@@ -0,0 +1,6 @@
+set_io LED1 99
+set_io LED2 98
+set_io LED3 97
+set_io LED4 96
+set_io LED5 95
+set_io clk 21