-
Notifications
You must be signed in to change notification settings - Fork 1
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
csr: A proposal for DSL design #7
Open
ghost
wants to merge
33
commits into
m-labs:master
Choose a base branch
from
HarryMakes:csr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
…kArray, add wishbone from HeavyX
* Field is now a context manager: enums must be added using `with field` block, but can be read from outside using `field.Enums` * Bank & Register no longer needs `with <object> as <var>` block, only `with <object>` in order to build them with regs and fields
* Bank now only aligns register addresses without resizing the registers
* Register bits in locations that are not occupied by any Fields are now regular Signals, with no access restrictions (i.e. treated as don't care). * Any attempt to read or write these bits via a bus will return or change their values without any restrictions.
* Instead of storing a Signal in each Field, each Register now store a single Signal comprising of both Field bits and "don't care" bits * Each Field object no longer carries a value, but only the information needed to describe a Register (e.g. bit locations, access mode, enumerated values)
* Add an internal write strobe (`set_stb`/`set_enable`/`set_en`/`int_w_stb`) to Register and Field; asserted when the logic reassigns the values and overrides any writes from the bus. * Add an internal write data signal (`set_val`/`set_value`/`int_w_data`) to Register; contains the data that the logic uses to reassign the Register or Field values when `set_stb` is asserted. * Each Field now allows value assignments from the following sources: (The smaller the number, the higher the priority) (1) Bank reset strobe (`Bank.rst_stb`): when asserted, reset all its Registers in the Bank to their reset values at the next clock (2) Register reset strobe (`Register.rst_stb`): when asserted, reset all its Fields to their reset values and the remaining bits to 0 at the next clock (3) Register internal write strobe (`Register.set_stb`): when asserted, set all its Fields to their own current `Field.set_val` value at the next clock (4) Field internal write strobe (`Field.set_stb`): when asserted, set the Field to its own current `Field.set_val` value at the next clock (5) Register bus write strobe (`Register.w_stb`): when asserted, set all its Fields to the current `Element.w_data` value at the next clock * When either `Bank.rst_stb` or `Register.rst_stb` is asserted while `bus.rst_stb` is high, each Register now returns the reset value to `Element.r_data` for reading immediately
ghost
mentioned this pull request
May 10, 2020
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.
This pull request was based on the initial design (3195de9) here on M-Lab's repo, so its usage might be different from the more recent nmigen-soc branch on nMigen's repo and the syntax might be incompatible with that. The main focus of this PR is to introduce a domain-specific language (DSL) subset of nMigen just for implementing CSRs. Below shown is an example showing possible ways to declare a hierarchy of CSRs:
Its equivalent CSR design can be described with the following picture:
Another main change to the existing code in the master branch here is a fix on WishboneCSRBridge such that the Wishbone ACK can be asserted properly per read or write.
To-do / Possible improvement
@property
tags: Currently they are here to prevent users from editing the values after instantiating the CSR fields as their Signals are named the same way. Is this necessary?