| 1 |
/* Pressing the button stops the blinking because no clock source will be selected */ |
| 2 |
module top ( |
| 3 |
input clk, |
| 4 |
input key_i, |
| 5 |
input rst_i, |
| 6 |
output [`LEDS_NR-1:0] led |
| 7 |
); |
| 8 |
|
| 9 |
reg [31:0] counter; |
| 10 |
reg [31:0] counter2; |
| 11 |
wire clk1, clk2; |
| 12 |
|
| 13 |
wire key = key_i ^ `INV_BTN; |
| 14 |
|
| 15 |
DCS dcs( |
| 16 |
.CLK0(1'b1), |
| 17 |
.CLK1(clk), |
| 18 |
.CLK2(1'b1), |
| 19 |
.CLK3(1'b1), |
| 20 |
.CLKSEL({1'b0, 1'b0, key, 1'b0}), |
| 21 |
.SELFORCE(1'b1), |
| 22 |
.CLKOUT(clk1) |
| 23 |
); |
| 24 |
defparam dcs.DCS_MODE="CLK1_GND"; |
| 25 |
|
| 26 |
always @(posedge clk1) begin |
| 27 |
if (counter < 31'd1350_0000) |
| 28 |
counter <= counter + 1; |
| 29 |
else begin |
| 30 |
counter <= 31'd0; |
| 31 |
led[1:0] <= {~led[0],led[1]}; |
| 32 |
end |
| 33 |
end |
| 34 |
|
| 35 |
endmodule |