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

Provide a naming mechanism for memory map resources and windows #27

Merged
merged 3 commits into from Oct 29, 2021

Conversation

jfng
Copy link
Member

@jfng jfng commented Sep 1, 2020

Each memory map now has a namespace for its resources and windows. Names are mandatory for resources, but optional for windows.

The full name of a resource is a concatenation of its own name and the name of each named window behind which it is located.
For example, if a resource named "rx_stb" is located behind an anonymous window, itself located behind a window named "serial", then its name would be ("serial", "rx_stb") from the top-level point of view, but only ("rx_stb",) from the point of view of the anonymous window.

Fixes #20.

Jean-François Nguyen added 3 commits August 26, 2020 21:20
Resource objects are no longer required to implement __hash__.
Each memory map now has a namespace for its resources and windows.
Names are mandatory for resources, but optional for windows. The full
name of a resource is a concatenation of its own name and the name of
each named window behind which it is located.

Breaking changes:
* MemoryMap.add_resource() now takes a mandatory ``name`` parameter.
* MemoryMap.resources() now returns a ``resource, name, (start, end)``
  tuple.
* Freezing a memory map now prevents the further addition of *any*
  resource or window, instead of only the ones that require an extension
  of the memory map address bits. Allowing these could prevent us from
  detecting name conflicts in some cases.

Other changes:
* The MemoryMap constructor now takes an optional ``name`` parameter,
  which is then visible as a property.
* The constructors of csr.Multiplexer, csr.Decoder, WishboneCSRBridge
  and wishbone.Decoder now take an optional ``name`` parameter, which is
  passed to their underlying memory map.
Breaking changes:
* MemoryMap.all_resources() and MemoryMap.find_resource() return an
  instance of ResourceInfo describing the resource and its assigned name
  and address range, instead of a tuple.

Fixes amaranth-lang#20.
@jfng jfng merged commit ec7d19e into amaranth-lang:master Oct 29, 2021
jfng added a commit to jfng/amaranth-soc that referenced this pull request Feb 9, 2024
github-merge-queue bot pushed a commit that referenced this pull request Feb 9, 2024
jfng added a commit to jfng/amaranth-soc that referenced this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Handling resource name collisions inside a MemoryMap
2 participants