Altera_Forum
Honored Contributor
8 years agoVerilog coding help
Hi
I have a ep4ce6 fpga board and I am trying to make a counter that counts up to 2_999_999_999.I don't know why it's not working. Here is the code: (I am trying to make a 1 sec timer) What am I doing wrong. I am selecting a verilog file in the Quartus Application. The code compiles but led does not light up every second. module mycounter ( input clk, //50MHz onboard clock PIN 23 input reset, output led ); reg [25:0] counter; //26 bit - count up to 50_000_000 to generate 1 sec reg tmp; //COUNT always @(posedge clk) if(~reset) counter <=0; else counter <= counter + 1; //COUNT Comparator always @(*) tmp = (counter == 26'd49_999_999);// assign led = tmp;//I want the led to light up every second - IT DOESN'T ??? endmodule Thanks Saleem