Skip to content

riscv: Add macro to define CSR register types #218

@rmsyn

Description

@rmsyn

As discussed in #217, it would be nice to have a macro to define CSR register types.

I worked on a couple solutions:

  • macros using the paste crate: master...rmsyn:riscv:riscv/csr-macro-paste
    • less verbose
    • more consistent docs across definitions
    • requires adding the paste crate as a dependency, and exposing the paste! macro as a public re-export
  • macros without using the paste crate: master...rmsyn:riscv:riscv/csr-macro-no-paste
    • more verbose
      • requires caller-supplied docstrings and set_<field> values
      • can potentially omit the docstrings at the expense of having generic documentation, e.g. /// Gets the field value.
    • potentially less consistent docs across definitions
    • requires no additional dependencies

What are some thoughts and/or preferences about the two implementations?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions