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

Closed
jeanthom opened this issue Jul 1, 2020 · 2 comments
Closed

Can't emulate fully combinatorial design #417

jeanthom opened this issue Jul 1, 2020 · 2 comments
Labels

Comments

@jeanthom
Copy link

@jeanthom 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 test.py simulate -c 10
Traceback (most recent call last):
  File "test.py", line 20, in <module>
    main(top, ports=[top.a, top.b])
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/cli.py", line 78, in main
    main_runner(parser, parser.parse_args(), *args, **kwargs)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/cli.py", line 71, in main_runner
    sim.add_clock(args.sync_period)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/back/pysim.py", 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.

@whitequark
Copy link
Member

@whitequark whitequark commented Jul 1, 2020

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...

@whitequark
Copy link
Member

@whitequark whitequark commented Jul 1, 2020

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.

@whitequark whitequark closed this Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants