Assuming that I'm thinking of the same circuit as FvM. I've used toggle synchronizers to do this, with the restriction that the pulses need to be at least far enough apart to resynchronize to the detecting clock domain.
The idea is to use a toggle flop, followed by edge detection in the detecting clock domain (both edges using XOR). Due to the synchronizer and the edge detect you'll need at least 3 detecting clocks of separation between pulses.
You also don't need to use a global buffer to clock the FF just add constraints to keep the FF near the I/O where the pulse input is located.
Something like this is what I've used in the past and perhaps is what FvM is suggesting.
Code Verilog - [expand] |
1
2
3
4
5
6
7
8
9
10
| reg toggle = 0;
always @ (posedge pulse_pin) begin
toggle <= ~toggle;
end
reg [2:0] t_dly;
reg pulse_clk;
always @ (posedge clk) begin
t_dly <= {t_dly[1:0], toggle};
pulse_clk <= (t_dly[2:1] == 2'b01) ? 1'b1 : 1'b0;
end |
- - - Updated - - -
Oh, yeah if you can't afford to miss pulses that may be way less than the 3 detecting clock cycles apart...
Use a 1-bit async FIFO with the write enable and data input set high and the pulse connected to the clock input.
On the read side as long as the empty flag is low you have a detected pulse in the FIFO. Of course now you have to use a clock buffer to distribute the pulse, but now you have the luxury of dealing with the pulses at the aggregate rate instead of a possible burst rate exceeding the toggle synchronizer's ability to detect.