verilog code for 16 bit counter

Status
Not open for further replies.

amarj

Newbie level 4
Joined
Apr 27, 2011
Messages
5
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,312
i need verilog code for 16 bit synchronous counter with synchronous hold..pls help me out..
 

is it with synchronous reset?
 

is it with synchronous reset?
ya...with synchronous reset and synchronous hold..

---------- Post added at 09:13 ---------- Previous post was at 08:48 ----------

module(clk,hold,reset,q);
input clk,hold,reset;
output [15:0]q;
reg [15:0]q;
initial q=15'b0000000000000000;
always @(posedge clk)
begin
if (reset)
q=15'b0000000000000000;
else if (hold)
q=q;
else
q=q+1;
end
endmodule

im getting the simulation correct but i need get output on fpga . Every time i apply a monopulse count its jumping from 0 to 129.. wats the prob???
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…