Skip to content

[multitop] generate Rust register library for current top#29253

Merged
jwnrt merged 4 commits intolowRISC:masterfrom
jwnrt:mt-rust-regs
Feb 5, 2026
Merged

[multitop] generate Rust register library for current top#29253
jwnrt merged 4 commits intolowRISC:masterfrom
jwnrt:mt-rust-regs

Conversation

@jwnrt
Copy link
Contributor

@jwnrt jwnrt commented Feb 4, 2026

This PR:

  • Moves the Tock Rust modules to a separate package
  • Adds the generic Rust modules and a library for them

This library (//hw/top:ot_regs) is intended to replace bindgen-ing to the autogenerated C headers in opentitanlib.

@jwnrt jwnrt requested a review from pamaury February 4, 2026 17:42
@jwnrt jwnrt marked this pull request as ready for review February 4, 2026 17:42
@jwnrt jwnrt requested a review from cfrantz as a code owner February 4, 2026 17:42
jwnrt added 2 commits February 5, 2026 11:06
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
In a future commit we will generate generic Rust modules as well and
their names could conflict, so I'm separating them to their own package
like with DT.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
@jwnrt
Copy link
Contributor Author

jwnrt commented Feb 5, 2026

I've merged those rule impls and also moved the Tock modules to their own package under hw/top because the names collide with the generic Rust modules, and we can't change the file names as they're tied to the module names used in code.

@jwnrt jwnrt requested a review from pamaury February 5, 2026 11:07
jwnrt added 2 commits February 5, 2026 11:12
`reggen` can generate Rust modules for both generic use and for Tock.
Make the rule configurable for both. Also renames "header" to "module"
which is more accurate for Rust.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
@jwnrt
Copy link
Contributor Author

jwnrt commented Feb 5, 2026

@pamaury do you think the ot_regs Rust library makes more sense under //sw/host than //hw/top?

@pamaury
Copy link
Contributor

pamaury commented Feb 5, 2026

@pamaury do you think the ot_regs Rust library makes more sense under //sw/host than //hw/top?

It think it's fine under //hw/top

Copy link
Contributor

@pamaury pamaury left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for improving that.

@jwnrt jwnrt added this pull request to the merge queue Feb 5, 2026
Merged via the queue into lowRISC:master with commit 736567c Feb 5, 2026
46 checks passed
@jwnrt jwnrt deleted the mt-rust-regs branch February 5, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants