Pulse Counter:
The Pulse Counter block, counts the number of non-zero inputs it receives. There is a start/stop pin to initiate and pause the count, and also a reset pin to set the count back to zero.
Any nonzero input on the pulse input pin, is considered a pulse and will be counted when the count is enabled.
Verilog Code for Pulse Counter:
module pulse_counter(reset,clk,inp,count);
output count;
reg [3:0]count;
input clk,reset,inp;
wire clk,reset;
initial count=4'b1;
always@(reset)
begin
if(reset==1)
begin
count<=0;
end
end
always@(posedge clk)
begin
count=count+1;
end
endmodule
0 Comments