gemass
Newbie level 3
Hi,
I'm new to verilog-A and I use the following code to detect the first falling edge of my input signal (Vin) and generate a pulse of 0V for 10ns at my output signal (Vout) as soon as the falling edge of Vin is detected, throught the @cross function, and also at time 0 with @initial_step(it creates a reset pulse):
The problem is that, for a certain reason, a pulse of 20 ns is generated even thougth I specify a value of 10 ns (td=10 ns) and only the second falling edge of my input signal is detected (at 75.21 ns)while I want the one at 65.24ns to be detected. How can I change my code in order to detect the first falling edge of my input signal Vin ?
Thanks for your help !
I'm new to verilog-A and I use the following code to detect the first falling edge of my input signal (Vin) and generate a pulse of 0V for 10ns at my output signal (Vout) as soon as the falling edge of Vin is detected, throught the @cross function, and also at time 0 with @initial_step(it creates a reset pulse):
Code:
module allo(in,out);
parameter real td = 10n; // width of pulse
parameter real tt = 0n; // output transition time (s)
parameter real t1 = 0n;
output out;
input in;
voltage in, out;
real Vout, tend,rst;
analog begin
@ (initial_step or cross(V(in)-1, -1)) begin
Vout = 0;
tend = $abstime + td;//return simulation time + td
end
@(timer(tend))
Vout = 1.8;
V(out) <+ transition(Vout, td, tt);
end
endmodule
The problem is that, for a certain reason, a pulse of 20 ns is generated even thougth I specify a value of 10 ns (td=10 ns) and only the second falling edge of my input signal is detected (at 75.21 ns)while I want the one at 65.24ns to be detected. How can I change my code in order to detect the first falling edge of my input signal Vin ?
Thanks for your help !