From: whitequark Date: Fri, 14 Dec 2018 09:12:38 +0000 (+0000) Subject: back.pysim: undriven comb signals should return to reset value. X-Git-Tag: working~275 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b34c1a9ad083118e0bf646b5d99087a8537e3435;p=nmigen.git back.pysim: undriven comb signals should return to reset value. --- diff --git a/nmigen/back/pysim.py b/nmigen/back/pysim.py index 9716ff2..c228611 100644 --- a/nmigen/back/pysim.py +++ b/nmigen/back/pysim.py @@ -326,8 +326,13 @@ class Simulator: self._sync_signals.update(signals) self._domain_signals[domain].update(signals) + statements = [] + for signal in fragment.iter_comb(): + statements.append(signal.eq(signal.reset)) + statements += fragment.statements + compiler = _StatementCompiler() - funclet = compiler(fragment.statements) + funclet = compiler(statements) for signal in compiler.sensitivity: self._add_funclet(signal, funclet) for domain, cd in fragment.domains.items(): diff --git a/nmigen/fhdl/ir.py b/nmigen/fhdl/ir.py index 8c8b7a9..493aa2f 100644 --- a/nmigen/fhdl/ir.py +++ b/nmigen/fhdl/ir.py @@ -39,7 +39,8 @@ class Fragment: yield domain, signal def iter_comb(self): - yield from self.drivers[None] + if None in self.drivers: + yield from self.drivers[None] def iter_sync(self): for domain, signals in self.drivers.items():