On 5/7/2014 2:54 PM, Guy Eschemann wrote:
> Hello,
>
> I was wondering whether MyHDL has anything similar to VHDL's inertial or
> transport delay models. Not that I would need them, it's just out of
> curiosity.
>
> Thanks,
> Guy.
>
The /Signal/ has a delay argument:
Signal(val=None, delay=None)
A simple example:
def m_add(a, b, c):
@always_comb
def rtl():
c.next = a and b
return rtl
def test():
a = Signal(bool(0), delay=10)
b = Signal(bool(0), delay=1)
c = Signal(bool(0))
...
https://gist.github.com/cfelton/a0dbd2c12070a649bb56
http://www.edaplayground.com/x/3Gw
(waveform attached, signal order is funny though)
The delay is in simulation steps, if you want to relate sim
steps back to a physical meaning you have to manage it
yourself, e.g. we could arbitrarily say 1 sim step is 1ps
and a 1ns delay would be delay=1000 (make sure you set the
traceSignals and Cosimulation timescales if needed).
Regards,
Chris
|