3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-20 21:03:40 +00:00

Improve igloo2 exmaple

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2019-03-05 17:27:58 -08:00
parent bfcd46dbd3
commit 24d1b92eda
4 changed files with 16 additions and 8 deletions

View file

@ -1,23 +1,23 @@
module example (
input clk,
input EN,
input SW1,
input SW2,
output LED1,
output LED2,
output LED3,
output LED4,
output LED5
output LED4
);
localparam BITS = 5;
localparam BITS = 4;
localparam LOG2DELAY = 22;
reg [BITS+LOG2DELAY-1:0] counter = 0;
reg [BITS-1:0] outcnt;
always @(posedge clk) begin
counter <= counter + EN;
counter <= counter + SW1 + SW2 + 1;
outcnt <= counter >> LOG2DELAY;
end
assign {LED1, LED2, LED3, LED4, LED5} = outcnt ^ (outcnt >> 1);
assign {LED1, LED2, LED3, LED4} = outcnt ^ (outcnt >> 1);
endmodule