nextpnr/xc7/blinky.v

32 lines
605 B
Coq
Raw Normal View History

2018-08-12 05:35:49 +08:00
module blinky (
input clki,
output led0,
2018-08-12 05:35:49 +08:00
output led1,
output led2,
output led3
2018-08-12 05:35:49 +08:00
);
BUFGCTRL clk_gb (
2018-08-12 12:13:49 +08:00
.I0(clki),
.CE0(1'b1),
.CE1(1'b0),
.S0(1'b1),
.S1(1'b0),
.IGNORE0(1'b0),
.IGNORE1(1'b0),
2018-08-12 07:01:15 +08:00
.O(clk)
2018-08-12 05:35:49 +08:00
);
2018-11-04 04:27:39 +08:00
localparam BITS = 4;
2018-12-28 15:02:33 +08:00
parameter LOG2DELAY = 23;
2018-08-12 05:35:49 +08:00
reg [BITS+LOG2DELAY-1:0] counter = 0;
reg [BITS-1:0] outcnt;
always @(posedge clk) begin
counter <= counter + 1;
outcnt <= counter >> LOG2DELAY;
end
2018-12-28 15:02:33 +08:00
assign {led0, led1, led2, led3} = outcnt ^ (outcnt >> 1);
2018-08-12 05:35:49 +08:00
endmodule