Skip to content

Feature Request: Option to avoid read-modify-write #305

@parthkalgaonkar

Description

@parthkalgaonkar

Basically what the title says. I want to avoid a read-modify-write when I'm writing to fields. The basic idea is to keep track of current value of the neighboring fields (a shadow copy) and encode the values accordingly.

The challenge: Hardware writable fields

  • Hardware could have written to a field since the last time the shadow copy was updated.
  • Currently there is a branch to check if the reg is read-write or write-only. An additional check may be needed to tell if there are hardware-writable fields in the reg
  • Technically, current read-modify-write solution also has a race-condition wrt hardware-writable fields

Possible solutions:

  1. Keep a shadow copy and read-from that when appropriate for read-modify-writes
  2. Offload this to the callback. Then the callback needs to know that a given read was a part of a read-modify-write sequence. I'm personally not a fan of this. The callback will not have enough information to do the hardware-writable fields check

Workaround:

User keeps two instances of the top-level reg_model. One for writing and the other for reading. Then, in the writing reg_model, all reads happen from a shadow copy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions