Verilog Code:
`timescale 1ns / 1ps
module blink (customClk, LED, statusPIN);
input customClk;
output statusPIN;
output LED;
reg [31:0] counter;
reg LED_status;
initial begin
counter <= 32'b0;
LED_status <= 1'b0;
end
always @ (posedge customClk)
begin
counter <= counter + 1'b1;
if (counter > 5000)
begin
LED_status <= !LED_status;
counter <= 32'b0;
end
end
assign LED = LED_status;
assign statusPIN = LED_status;
endmodule
UCF File:
NET "LED" LOC = F12;
NET "LED" IOSTANDARD = LVCMOS33;
NET "statusPIN" LOC = E8;
NET "statusPIN" IOSTANDARD = LVTTL;
Testbench code:
module main_tb;
// Inputs
reg customClk;
// Outputs
wire LED;
wire statusPIN;
// Instantiate the Unit Under Test (UUT)
blink uut (
.customClk(customClk),
.LED(LED),
.statusPIN(statusPIN)
);
initial begin
// Initialize Inputs
customClk = 0;
// Add stimulus here
end
always #10 customClk = ~customClk;
endmodule
LED is blinking too fast but when I read the status of the pin, it is still low. Where is the problem in code.
Thank you for your time.