J
Jonathan Bromley
Guest
hi folks,
as you know, I've been messing with Verilog for quite a
while now, but there's still some stuff I don't know,
so perhaps someone here can help.
I want to model an uncertain signal transition. My
source signal (let's say S) makes a clean transition
from 0 to 1, or the other way, at some time T. I
want an output (let's say Y) to follow this signal,
but with both a delay and an uncertainty - so it
should go to X at time T+Tmin, and then to 1 at
time T+Tmax. Rise and fall behaviour should be
symmetrical.
In VHDL I can trivially do this by using inertial
delay:
Y <= 'X' after Tmin, S after Tmax;
In Verilog I can get nearly there...
always @S begin
Y <= #Tmin 1'bx;
Y <= #Tmax S;
end
but that isn't quite right; suppose, for example,
that S goes from 0 to 1 at time T, and then goes
back to 0 again just before T+Tmax - I'll get Y
going to 1 at T+Tmax, and then back to X again...
it's wrong because Verilog <= delays are transport
rather than inertial.
I can think of various ways to do this, but all of
them cost a few lines of code. I strongly suspect
that there is some super-neat way to do it using
specify blocks or somesuch; can anyone save me a
lot of LRM-rummaging by telling me the trick?
thanks in advance
--
Jonathan Bromley
as you know, I've been messing with Verilog for quite a
while now, but there's still some stuff I don't know,
so perhaps someone here can help.
I want to model an uncertain signal transition. My
source signal (let's say S) makes a clean transition
from 0 to 1, or the other way, at some time T. I
want an output (let's say Y) to follow this signal,
but with both a delay and an uncertainty - so it
should go to X at time T+Tmin, and then to 1 at
time T+Tmax. Rise and fall behaviour should be
symmetrical.
In VHDL I can trivially do this by using inertial
delay:
Y <= 'X' after Tmin, S after Tmax;
In Verilog I can get nearly there...
always @S begin
Y <= #Tmin 1'bx;
Y <= #Tmax S;
end
but that isn't quite right; suppose, for example,
that S goes from 0 to 1 at time T, and then goes
back to 0 again just before T+Tmax - I'll get Y
going to 1 at T+Tmax, and then back to X again...
it's wrong because Verilog <= delays are transport
rather than inertial.
I can think of various ways to do this, but all of
them cost a few lines of code. I strongly suspect
that there is some super-neat way to do it using
specify blocks or somesuch; can anyone save me a
lot of LRM-rummaging by telling me the trick?
thanks in advance
--
Jonathan Bromley