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

Misleading error when trying to use self.comb when inheriting from Module #286

Closed
nmigen-issue-migration opened this issue Dec 26, 2019 · 0 comments
Milestone

Comments

@nmigen-issue-migration
Copy link

Issue by AsuMagic
Thursday Dec 26, 2019 at 18:04 GMT
Originally opened as m-labs/nmigen#286


Consider the following migen code:

class ORGate(Module):
	def __init__(self):
		self.a = Signal()
		self.b = Signal()
		self.x = Signal()

		self.comb += self.x.eq(self.a | self.b)

While this is not the valid way to implement this in nmigen, if you try to use this code as-is in nmigen, the error is misleading:

  File "/usr/lib/python3.8/site-packages/nmigen/hdl/dsl.py", line 75, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'; did you mean 'd.{}'?"
AttributeError: 'ORGate' object has no attribute 'comb'; did you mean 'd.comb'?

If my understanding is right, the direct alternative to the above code in nmigen is to inherit from Elaboratable and use the elaborate() mechanism.
In that case, the error check should hint at this accordingly, instead of incorrectly hinting to use d.comb.

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

No branches or pull requests

1 participant