spec: REG(W) templates#854
Conversation
Kimi Code ReviewAutomated review by Kimi (Moonshot AI) |
Codex Code ReviewNo issues found in the PR diff. The new register templates preserve the replaced |
Kimi Code ReviewAutomated review by Kimi (Moonshot AI) |
Codex Code ReviewNo issues found in the PR changes. The specification structure/type validator passes successfully. |
| Interactions on this domain can denote more concisely since | ||
| + the register address can be represented using a one-column `Byte` rather than a two-column `DWordWL`, and | ||
| + registers accesses (almost) always have a width of 2. | ||
| Moreover, the factor 2 that must be included in converting from register-number to the register-address has led to several hard-to-catch errors in the past; introducing this abstraction will reduce the likelihood of these mistakes. |
There was a problem hiding this comment.
This feels more like a PR description than part of a spec.
(not entirely convinced by my own suggestion yet either, but maybe)
| Moreover, the factor 2 that must be included in converting from register-number to the register-address has led to several hard-to-catch errors in the past; introducing this abstraction will reduce the likelihood of these mistakes. | |
| Moreover, the factor 2 that must be included in converting from register-number to the register-address can be error-prone, so this reduces the likelihood of these mistakes in writing chips. |
There was a problem hiding this comment.
I rewrote the paragraph. let me now whether you agree that it is better now.
| 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. | ||
|
|
||
| For both templates hold: when not provided, `cond` defaults to `1`. |
There was a problem hiding this comment.
Agreed. Better now?
| input = [1, ["arr", ["cast", ["*", 2, "address"], "Word"], 0], ["arr", ["idx", "val", 0], ["idx", "val", 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 = ["-", "μ_read"] | ||
| kind = "template" |
There was a problem hiding this comment.
This feels like a strange thing to do.
It's correct, and probably readable, I'm just not sure if the providing side of a signature should be a template.
There was a problem hiding this comment.
agreed. reverted it.
This PR introduces templates for the short-hand notation of register reads and writes.
Note: this PR is awaiting
spec/streamingto get merged first.