Skip to content

spec: REG(W) templates#854

Open
erik-3milabs wants to merge 5 commits into
spec/streamingfrom
spec/REG
Open

spec: REG(W) templates#854
erik-3milabs wants to merge 5 commits into
spec/streamingfrom
spec/REG

Conversation

@erik-3milabs

@erik-3milabs erik-3milabs commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR introduces templates for the short-hand notation of register reads and writes.

Note: this PR is awaiting spec/streaming to get merged first.

@erik-3milabs erik-3milabs self-assigned this Jul 21, 2026
@erik-3milabs erik-3milabs added the spec Updates and improvements to the spec document label Jul 21, 2026
@github-actions

Copy link
Copy Markdown

Kimi Code Review

⚠️ Review failed: Kimi API request failed with status 401


Automated review by Kimi (Moonshot AI)

@github-actions

Copy link
Copy Markdown

Codex Code Review

No issues found in the PR diff. The new register templates preserve the replaced MEMW interaction semantics, and specification validation passes.

Comment thread spec/src/commit.toml
@erik-3milabs
erik-3milabs requested a review from RobinJadoul July 21, 2026 13:51
@erik-3milabs
erik-3milabs marked this pull request as ready for review July 21, 2026 13:51
@github-actions

Copy link
Copy Markdown

Kimi Code Review

⚠️ Review failed: Kimi API request failed with status 401


Automated review by Kimi (Moonshot AI)

@github-actions

Copy link
Copy Markdown

Codex Code Review

No issues found in the PR changes. The specification structure/type validator passes successfully.

Comment thread spec/reg.typ Outdated
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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels more like a PR description than part of a spec.

(not entirely convinced by my own suggestion yet either, but maybe)

Suggested change
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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote the paragraph. let me now whether you agree that it is better now.

Comment thread spec/reg.typ Outdated
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`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird sentence

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Better now?

Comment thread spec/src/memw_register.toml Outdated
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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. reverted it.

@erik-3milabs
erik-3milabs requested a review from RobinJadoul July 22, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spec Updates and improvements to the spec document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants