| 1 |
module top ( |
| 2 |
input clk, |
| 3 |
input key_i, |
| 4 |
input rst_i, |
| 5 |
output [`LEDS_NR-1:0] led |
| 6 |
); |
| 7 |
|
| 8 |
wire key = key_i ^ `INV_BTN; |
| 9 |
wire reset = rst_i ^ `INV_BTN; |
| 10 |
|
| 11 |
reg [25:0] ctr_q; |
| 12 |
wire [25:0] ctr_d; |
| 13 |
|
| 14 |
always @(posedge clk) begin |
| 15 |
if (reset) begin |
| 16 |
ctr_q <= ctr_d; |
| 17 |
end |
| 18 |
end |
| 19 |
|
| 20 |
reg [`LEDS_NR - 2:0] led_r; |
| 21 |
assign led = {ctr_q[25:25], led_r}; |
| 22 |
assign ctr_d = ctr_q + 1'b1; |
| 23 |
|
| 24 |
always @(posedge clk) begin |
| 25 |
if (!key) begin |
| 26 |
led_r <= ctr_q[25:25-(`LEDS_NR - 2)]; |
| 27 |
end |
| 28 |
end |
| 29 |
|
| 30 |
endmodule |