2020-04-20 11:02:06 -04:00
|
|
|
module top (
|
2021-05-13 14:05:33 -04:00
|
|
|
input clk,
|
2020-06-10 04:03:21 -04:00
|
|
|
output [3:0] led
|
2020-04-20 11:02:06 -04:00
|
|
|
);
|
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
localparam BITS = 4;
|
|
|
|
localparam LOG2DELAY = 22;
|
2020-04-20 11:02:06 -04:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
wire bufg;
|
|
|
|
BUFG bufgctrl (
|
|
|
|
.I(clk),
|
|
|
|
.O(bufg)
|
|
|
|
);
|
2020-04-20 11:02:06 -04:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
reg [BITS+LOG2DELAY-1:0] counter = 0;
|
2020-04-20 11:02:06 -04:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
always @(posedge bufg) begin
|
|
|
|
counter <= counter + 1;
|
|
|
|
end
|
2020-04-20 11:02:06 -04:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
assign led[3:0] = counter >> LOG2DELAY;
|
2020-04-20 11:02:06 -04:00
|
|
|
endmodule
|