Chargement…
Chargement…
The block starts a measurement on request, waits for a first rising edge, then counts system cycles until the next rising edge.
Behaviour
i_signal first passes through a two-flip-flop synchronizer and edge detector.i_start pulse is accepted while o_ready='1'.o_period_cycles contains the exact distance between the two synchronized edges.o_done pulses for one cycle with the result.g_max_period_cycles, the result saturates to that value and o_overflow pulses with o_done.The measured signal must remain low and high long enough to be observed by the system clock after synchronization. The circuit measures sampled edges, not a frequency beyond what the clock can observe.
Frequency can then be calculated with f_signal = f_clk / o_period_cycles. That division is outside this exercise.
| Item | Direction | Width | Description |
|---|---|---|---|
g_max_period_cycles | Generic | positive integer | Largest accepted period, default 100,000,000 |
i_clk | Input | 1 bit | System clock |
i_reset | Input | 1 bit | Active-high asynchronous reset |
i_start | Input | 1 bit | Starts a measurement while ready |
i_signal | Input | 1 bit | Asynchronous signal to measure |
o_ready | Output | 1 bit | A new measurement can start |
o_done | Output | 1 bit | Result valid for one cycle |
o_overflow | Output | 1 bit | Period exceeded the limit |
o_period_cycles | Output | 32 bits | Measured period in system cycles |