Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
I want to count the number of pulses. The master clock is running at a fixed 25mhz frequency. The pulses are much slower in the order of khz and do not have even duty cycles. they could be as fast as a few mhz to slow as a few khz.
//you can search web to find "pulse synchronizer" logic
// Or I will come up one later.
psync_cell u_pc(.d(sclk), .clk(fclk), .rstn(rstn), .o(syn_sclk));
reg  counter;
always @(posedge fclk or negedge rstn)
if(!rstn) counter <= 0;
else if(syn_sclk) counter <= counter + 1;