Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't emulate fully combinatorial design #417

jeanthom opened this issue Jul 1, 2020 · 2 comments

Can't emulate fully combinatorial design #417

jeanthom opened this issue Jul 1, 2020 · 2 comments


Copy link

jeanthom commented Jul 1, 2020

Hi! I noticed that the following code can't be simulated with pysim:

from nmigen import *
from nmigen.cli import main

class Top(Elaboratable):
	def __init__(self):
		self.a = Signal()

	def elaborate(self, platform):
		m = Module()

		with m.FSM():
			with m.State("aaaaaaaa"):
				m.d.comb += self.a.eq(1)

		return m

if __name__ == "__main__":
	top = Top()
	main(top, ports=[top.a])

I get the following error message:

[jeanthomas@computer test]$ python simulate -c 10
Traceback (most recent call last):
  File "", line 20, in <module>
    main(top, ports=[top.a, top.b])
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/", line 78, in main
    main_runner(parser, parser.parse_args(), *args, **kwargs)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/", line 71, in main_runner
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/back/", line 1005, in add_clock
    raise ValueError("Domain {!r} is not present in simulation"
ValueError: Domain 'sync' is not present in simulation

As I workaround I added a sync statement to the design and it worked.

Copy link

Well, what's the point of having a clock in a fully combinatorial design? This is one of the reasons why the CLI simulate command was a terrible idea that I regret...

Copy link

I'm closing this with the understanding that the current "toplevel" (nmigen.cli) is very primitive and is not suitable for all but the simplest, most ordinary tasks. We'll improve it, but not right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

No branches or pull requests

2 participants