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

Probable submodule name collision breaking modularity #331

Closed
galibert opened this issue Mar 5, 2020 · 2 comments
Closed

Probable submodule name collision breaking modularity #331

galibert opened this issue Mar 5, 2020 · 2 comments
Labels

Comments

@galibert
Copy link
Contributor

galibert commented Mar 5, 2020

I may have missed something, but...

Imagine you create a module of type M68000. It has a submodule of type BusAccess. To get a meaningful name in the rtlil and every tool that uses it, it is created in the recommended way in elaborate:

  • m.submodules.busaccess = busaccess = BusAccess()

Then the name "busaccess" is used, which is good. But it seems that module names must be unique in the whole system. So does that mean one couldn't have two instances of M68000 in the same system if we want significant names?

@whitequark
Copy link
Member

whitequark commented Mar 5, 2020

It doesn't need to be unique in the entire design; it only needs to be unique within a single parent module, so you'd use something like:

m.submodules.busaccess1 = busaccess1 = BusAccess()
m.submodules.busaccess2 = busaccess2 = BusAccess()

if you need two of them, rather than:

m.submodules.busaccess = busaccess1 = BusAccess()
m.submodules.busaccess = busaccess2 = BusAccess()

@galibert
Copy link
Contributor Author

galibert commented Mar 5, 2020

Ok, I can confirm nmigen automatically renames the colliding names (with a $number suffix) to avoid collisions, very nice.

@galibert galibert closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants