back.pysim: Reuse clock simulation commands
This commit is contained in:
parent
bb1bbcc51a
commit
2398b7922e
|
@ -1021,11 +1021,14 @@ class Simulator:
|
||||||
# Behave correctly if the process is added after the clock signal is manipulated, or if
|
# Behave correctly if the process is added after the clock signal is manipulated, or if
|
||||||
# its reset state is high.
|
# its reset state is high.
|
||||||
initial = (yield domain.clk)
|
initial = (yield domain.clk)
|
||||||
|
steps = (
|
||||||
|
domain.clk.eq(~initial),
|
||||||
|
Delay(half_period),
|
||||||
|
domain.clk.eq(initial),
|
||||||
|
Delay(half_period),
|
||||||
|
)
|
||||||
while True:
|
while True:
|
||||||
yield domain.clk.eq(~initial)
|
yield from iter(steps)
|
||||||
yield Delay(half_period)
|
|
||||||
yield domain.clk.eq(initial)
|
|
||||||
yield Delay(half_period)
|
|
||||||
self._add_coroutine_process(clk_process, default_cmd=None)
|
self._add_coroutine_process(clk_process, default_cmd=None)
|
||||||
self._clocked.add(domain)
|
self._clocked.add(domain)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue