diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-07-18 13:10:40 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-07-18 13:10:40 +0200 |
commit | 48154cb6f452d3bdb4da36cc267b4b6c45588dc9 (patch) | |
tree | 3ec3be9ef7e8db1fb7c764ed8202e0215a8eb7c7 /icefuzz/tests/example_icestick.v | |
parent | 13e63e6b65e044e348356731b55610d02cb308b9 (diff) | |
download | icestorm-48154cb6f452d3bdb4da36cc267b4b6c45588dc9.tar.gz icestorm-48154cb6f452d3bdb4da36cc267b4b6c45588dc9.tar.bz2 icestorm-48154cb6f452d3bdb4da36cc267b4b6c45588dc9.zip |
Imported full dev sources
Diffstat (limited to 'icefuzz/tests/example_icestick.v')
-rw-r--r-- | icefuzz/tests/example_icestick.v | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/icefuzz/tests/example_icestick.v b/icefuzz/tests/example_icestick.v new file mode 100644 index 0000000..4635550 --- /dev/null +++ b/icefuzz/tests/example_icestick.v @@ -0,0 +1,29 @@ +module top ( + input clk, + output LED1, + output LED2, + output LED3, + output LED4, + output LED5 +); + + localparam BITS = 5; + localparam LOG2DELAY = 22; + + function [BITS-1:0] bin2gray(input [BITS-1:0] in); + integer i; + reg [BITS:0] temp; + begin + temp = in; + for (i=0; i<BITS; i=i+1) + bin2gray[i] = ^temp[i +: 2]; + end + endfunction + + reg [BITS+LOG2DELAY-1:0] counter = 0; + + always@(posedge clk) + counter <= counter + 1; + + assign {LED1, LED2, LED3, LED4, LED5} = bin2gray(counter >> LOG2DELAY); +endmodule |