Add annotations for memory maps, wishbone and CSR primitives.#58
Open
megng1 wants to merge 1 commit intoamaranth-lang:mainfrom
Open
Add annotations for memory maps, wishbone and CSR primitives.#58megng1 wants to merge 1 commit intoamaranth-lang:mainfrom
megng1 wants to merge 1 commit intoamaranth-lang:mainfrom
Conversation
Member
Author
|
Updated, mainly to track changes in amaranth-lang/amaranth#978:
|
whitequark
reviewed
Jan 19, 2024
| """ | ||
| if not isinstance(element, Element): | ||
| raise TypeError(f"Element must be a csr.Element object, not {element!r}") | ||
| if element.signature != self: |
Member
There was a problem hiding this comment.
This check should probably be in Signature.annotations.
There was a problem hiding this comment.
I was a bit confused by this comment, as the check is in Element.Signature.annotations, do you mean there should be amaranth_soc.csr.bus.Signature that the signatures that need this check should inherit from?
| """ | ||
| if not isinstance(interface, Interface): | ||
| raise TypeError(f"Interface must be a csr.Interface object, not {interface!r}") | ||
| if interface.signature != self: |
| --------- | ||
| resource : object | ||
| Arbitrary object representing a resource. | ||
| Arbitrary object representing a resource. It must have a 'signature' attribute that is |
Member
There was a problem hiding this comment.
must be an interface object
?
| }, | ||
| "alignment": { | ||
| "type": "integer", | ||
| "minimum": 0, |
Member
There was a problem hiding this comment.
You should add a comment here explaining what the value means. (It is a power of 2, right? Where the alignment in words is 1 << alignment.)
| "type": "integer", | ||
| "minimum": 0, | ||
| }, | ||
| "ratio": { |
Member
There was a problem hiding this comment.
This would benefit from a comment as well.
| if not isinstance(interface, Interface): | ||
| raise TypeError(f"Interface must be a wishbone.Interface object, not {interface!r}") | ||
| if interface.signature != self: | ||
| raise ValueError(f"Interface signature is not equal to this signature") |
This was referenced Jul 30, 2025
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on PR amaranth-lang/amaranth#978.
MemoryMapresources (e.g.csr.Elements) are now assumed to have a.signatureproperty, which lets them hold annotations. I am not sure whether we should enforce this inMemoryMap.add_resource(), or introduce a base class instead.