Zorro
|
Hi All,
I have a question and I hope somebody can give me a hint to solve the problem.
I need to generate a reset signal "b" if the period of input signal xcn is larger than tmax.
The signal xcn is actually electrical but using "Digital Sensitivity to Analog Events" the signal is discretized inside the model. This is done like this:
`timescale 1ns/1ps // `timescale (time unit)/(time precision) `define tick 1e9 // `define tick 1/(time unit) ... reg xcn_dig; ...
always @(above(V(xcn, vss)-thr_high)) begin xcn_dig = 1; end
always @(above(thr_low-V(xcn, vss))) begin xcn_dig = 0; end From now on the code continues working with the digital signal xcn_dig.
Below the code that I am trying to use for pulse width detection.
parameter real tmax = 210n;
always @(posedge xcn_dig) begin
b <= 1'b0; b <= #(tmax*`tick) 1'b1; end Scenario 1 Lets assume that xcn_dig has a period which is larger than tmax=210ns. In this case a reset signal must be generated. In this example the period of xcn_dig is 216.931ns, larger than tmax=210ns and therefore a reset pulse should be generated 210ns after the rising edge of xcn_dig. See picture 1. -> The code is working well to detect pulses that are bigger than tmax.
Scenario 2 Lets assume that xcn_dig has a period which is smaller than tmax=210ns. In this case the reset signal should remain low. In this example the period of xcn_dig is 171.414ns, smaller than tmax=210ns and therefore no reset pulse should be generated 210ns after the rising edge of xcn_dig. See picture 2. However, with this code, the reset pulse is being generated. -> The code is not working well to detect pulses that are smaller than tmax. Can somebody helpe me to improve this? I actually need that if the second positive edge of xcn_dig occurs in the expected time <tmax then the generation of the reset should be canceled.
Thank you very much! Zorro.
|