-
Notifications
You must be signed in to change notification settings - Fork 1
spec: REG(W) templates
#854
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2153986
spec/REG: introduce read&write shorthand for register accesses
erik-3milabs 042989a
spec/REGW: introduce write-only template
erik-3milabs 96acaca
spec/REG: update doc
erik-3milabs d771371
spec/REG: update description
erik-3milabs b28340d
spec/REG: revert using templates for MEMW_R
erik-3milabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #import "/book.typ": book-page | ||
| #import "/src.typ": load_config, load_chip | ||
| #import "/chip.typ": render_chip_variable_table, render_constraint_table, set_nr_interactions, | ||
|
|
||
| #let config = load_config() | ||
| #let reg_read = load_chip("src/reg_read.toml", config) | ||
| #let reg_write = load_chip("src/reg_write.toml", config) | ||
| #let read = raw(reg_read.name) | ||
| #let write = raw(reg_write.name) | ||
|
|
||
| #show: book-page("REG") | ||
|
|
||
| We provide the #read and #write templates. | ||
| These templates act as short hand notation for `MEMW` interactions pertaining to operations in the `register` domain ($= 1$, see @memory). | ||
|
|
||
| The necessity for two templates follows from the existence of two subtly different `MEMW` signatures (see @signatures): there is both a read-write and an write-only interaction. | ||
| Here, the former is wrapped by #read, while the #write template encapsulates the latter. | ||
|
|
||
| It is recommended to utilize these two templates in favor of direct `MEMW` interactions to specify register updates, as these | ||
| + take care of the crucial register-number to register-address conversion, and | ||
| + provide significantly more concise notation, | ||
| improving both readability and correctness of the specification. | ||
|
|
||
| = #read | ||
| The #read template encapsulates register read-write interactions. | ||
| Note: when `cond` is omitted, it defaults to 1. | ||
|
|
||
| == Variables | ||
| #set_nr_interactions(reg_read) | ||
| #render_chip_variable_table(reg_read, config) | ||
|
|
||
| == Constraints | ||
| #render_constraint_table(reg_read, config) | ||
|
|
||
| #pagebreak(weak: true) | ||
|
|
||
| = #write | ||
| The #write template encapsulates register write-only interactions. | ||
| Note: when `cond` is omitted, it defaults to 1. | ||
|
|
||
| == Variables | ||
| #set_nr_interactions(reg_write) | ||
| #render_chip_variable_table(reg_write, config) | ||
|
|
||
| == Constraints | ||
| #render_constraint_table(reg_write, config) |
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name = "REG" | ||
|
|
||
| [[variables.condition]] | ||
| name = "cond" | ||
| type = "BaseField" | ||
| desc = "the multiplicity with which to apply the interaction" | ||
|
|
||
| [[variables.input]] | ||
| name = "register" | ||
| type = "Byte" | ||
| desc = "the index of the register being addressed" | ||
|
|
||
| [[variables.input]] | ||
| name = "value" | ||
| type = "DWordWL" | ||
| desc = "the value being written to the register" | ||
|
|
||
| [[variables.input]] | ||
| name = "timestamp" | ||
| type = "Word" | ||
| desc = "the timestamp of the access" | ||
|
|
||
| [[variables.output]] | ||
| name = "old" | ||
| type = "DWordWL" | ||
| desc = "the value being read from the register" | ||
|
|
||
|
|
||
| [[constraint_groups]] | ||
| name = "all" | ||
|
|
||
| [[constraints.all]] | ||
| kind = "interaction" | ||
| tag = "MEMW" | ||
| input = [1, ["arr", ["*", 2, "register"], 0], ["arr", ["idx", "value", 0], ["idx", "value", 1], 0, 0, 0, 0, 0, 0], "timestamp", 1, 0, 0] | ||
| output = ["arr", ["idx", "old", 0], ["idx", "old", 1], 0, 0, 0, 0, 0, 0] | ||
| multiplicity = "cond" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name = "REGW" | ||
|
|
||
| [[variables.condition]] | ||
| name = "cond" | ||
| type = "BaseField" | ||
| desc = "the multiplicity with which to apply the interaction" | ||
|
|
||
| [[variables.input]] | ||
| name = "register" | ||
| type = "Byte" | ||
| desc = "the index of the register being addressed" | ||
|
|
||
| [[variables.input]] | ||
| name = "value" | ||
| type = "DWordWL" | ||
| desc = "the value being written to the register" | ||
|
|
||
| [[variables.input]] | ||
| name = "timestamp" | ||
| type = "Word" | ||
| desc = "the timestamp of the access" | ||
|
|
||
|
|
||
| [[constraint_groups]] | ||
| name = "all" | ||
|
|
||
| [[constraints.all]] | ||
| kind = "interaction" | ||
| tag = "MEMW" | ||
| input = [1, ["arr", ["*", 2, "register"], 0], ["arr", ["idx", "value", 0], ["idx", "value", 1], 0, 0, 0, 0, 0, 0], "timestamp", 1, 0, 0] | ||
| multiplicity = "cond" |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.