Skip to content

Conversation

@micha4w
Copy link

@micha4w micha4w commented Mar 24, 2025

This fork is currently being used in the implementation of the SD Host Controller.

Subregister Writes

The first commit adds the possibility to for example only write a single byte when reg_width is set to 32.
It returns an error if reg_be tries to write only part of a field.

This change is required to make most implementations of a SDHCI driver work.

Packed Register Type

Since the SDHC contains registers that are 1byte wide as long as ones that are 4 byte wide, we would have to do something like this:

registers: [
  {
    name: regs1_2_3_and_4
    fields: {
      reg1_field1: { ... }
      reg2_field1: { ... }
      reg3_field1: { ... }
      reg4_field1: { ... }
    }
  }
]

Which leads to having to write RTL code like this:

reg2hw.host_and_power_and_block_gap_and_wakeup_control.host_control_high_speed_enable

The second commit of this PR adds packed registers, which makes it work nicely like so:

registers: [
  {
    packed: [
      {
         name: reg1
         fields: [ field1: { ... } ]
      }
      {
         name: reg2
         fields: [ field1: { ... } ]
      }
      {
         name: reg3
         fields: [ field1: { ... } ]
      }
      {
         name: reg4
         fields: [ field1: { ... } ]
      }
    ]
  }
]
reg2hw.host_control.high_speed_enable

This is not strictly necessary for SDHCI to work, but its easier to work with :)

Note that neither of the two commits were tested on anything but gen_rtl.py with normal registers, hwqe and hwre.

OBI Adapter

The 3rd commit adds a simple adapter from OBI Crossbar used by croc to the Register Interface used by reggen.

@micha4w micha4w force-pushed the master branch 3 times, most recently from ef328d3 to b6d9eeb Compare April 2, 2025 13:21
@micha4w micha4w changed the title regtool: Add subregister writes and packed register type regtool: Add subregister writes, packed register type and OBI Apr 2, 2025
@micha4w micha4w force-pushed the master branch 2 times, most recently from 2ccf194 to 7b5c10f Compare July 7, 2025 14:11
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.

1 participant