Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
    • SRAM and ROM
    • Register Files
    • Valid/Ready Handshake
    • AXI-Lite
    • AXI-Stream
    • Bus Integration
    • Synchronous FIFO
    • Register-Map and CSR RTL
      • CSR Contract and Address Map
      • Field Access Types
      • Hardware/Software Arbitration
      • Byte Strobes and Partial Writes
      • Atomic and Shadowed Updates
      • Interrupt Register Pattern
      • Adapter and Signoff
      • Generated Register Workflow
      • The Firmware Side: a C Driver for W1C, RC and Shadow Registers
    • Memory Reliability
    • Peripheral RTL Integration
    • Full AXI4: RTL Roadmap
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹Register-Map and CSR RTL
  1. Topics
  2. RTL Design
  3. Memory & Buses
  4. Register-Map and CSR RTL
  5. Field Access Types

Part 7 · Memory & Buses · Intermediate

Field Access Types

Implement common software-visible field types without ambiguous read or write side effects.

Why this matters

Calling a whole register read-write hides the fields that are not. A write-1-to-clear bit written from stale data, or a read-to-clear bit read by a debugger, loses events that software never saw.

After this lesson you can: choose RW, RO, W1C, pulse and read-clear types per field, and write the update equation with an explicit priority.

Type

Software write

Hardware update

Typical use

RW

Replaces selected bits

Optional

Configuration

RO

Ignored

Sets current value

Live status

W1C

Writing 1 clears; 0 holds

Sets sticky events

Error/interrupt status

W1S

Writing 1 sets; 0 holds

May clear

Command latch

RC

Internal read acceptance snapshots then clears

Sets event (set wins)

Read-to-acknowledge status variant

Pulse

Accepted write produces one-cycle pulse

Not stored

Start/flush command

One write of 0110 0101 to an 8-bit field holding 1010 1100, under three access types: RW copies the data, W1C clears where the data has ones, W1S sets where the data has ones

Read each result row against the top row: outlined bits are the ones the write changed. All four byte strobes are set here.

  • RW: the field becomes the write data. Four bits change.

  • W1C: only bits 5 and 2 clear. They are 1 in both the old value and the data. A 1 written over a 0 does nothing, and a 0 never clears.

  • W1S: only bits 6 and 0 set. Bits that were already 1 stay 1.

In the running block, CONTROL.enable is RW, CONTROL.start is a pulse, STATUS.busy is RO, and STATUS.done/error are W1C sticky fields. Keeping those semantics field-specific avoids ambiguous labels such as treating an entire mixed register as simply RW.

design.sv
1
2
3
4
5
6
// snippet: common field equations
wire [N-1:0] sw_clr = (sw_write && addr_hit) ? (wdata[N-1:0] & write_mask[N-1:0]) : '0;
rw_q      <= (sw_write && addr_hit) ? ((rw_q & ~write_mask) | (wdata & write_mask)) : rw_q;
w1c_q     <= (w1c_q | hw_set) & ~sw_clr;
w1s_q     <= (w1s_q | sw_clr) & ~hw_clear;
start_p_o <= sw_write && addr_hit && write_mask[START_BIT] && wdata[START_BIT];

The shared sw_clr mask is zero unless a write actually targets this register, so stale wdata can never clear or set a sticky bit. This generic equation favours clear and can erase a simultaneous new cause; the canonical STATUS/IRQ map instead uses the set-wins form in the next lesson. Set-wins preserves a simultaneous pending cause, not an occurrence count.

Read-clear is dangerous when a debugger, speculative master, or mirrored software reader can issue reads. Prefer explicit W1C acknowledgement unless the system contract guarantees a single intentional reader.

Try it: write and read one field

The tool starts on the example above as a W1C field: it holds 000000AC (1010 1100) and the write data is 00000065 (0110 0101), with all four byte strobes set, so bits 5 and 2 would clear.

Register field access

Loading register field tool…

Simplified: the whole 32-bit register is one field of the chosen type, and hardware set or clear inputs are not modelled. Pulse is modelled as a one-cycle output on each strobed 1 in the write data; it is not stored, so the field and every read stay 0.
  • Press Write: the field becomes 00000088. Press it again and nothing clears, because bits 5 and 2 are already 0: repeating a W1C acknowledgement is harmless.

  • Choose RW and the result is 00000065, four bits changed; choose W1S and it is 000000ED, with only bits 6 and 0 set.

  • Choose RC and press Read twice: the first read returns the value and clears the field, the second returns 00000000. That second read is what a debugger costs you.

Common pitfall

Do not implement W1C as status <= status & ~wdata if hardware can set the same bit on that edge. State the priority explicitly or a new event can be lost.

Check yourself Why does writing zero to a W1C bit leave it unchanged?

The write data is a clear mask. Only written ones acknowledge events; zero means no action.

Check yourself A write targets another register: sw_write=1, addr_hit=0, and every byte strobe is set. Does this RW field change?

No. Both the accepted write and this register's address hit must qualify the RW update. Without addr_hit, a write elsewhere would overwrite this field with unrelated write data.

Remember

  • Access type belongs to the field, not the register.

  • A W1C write is a clear mask: only written ones acknowledge, and the write must target this register.

  • Read-clear is dangerous when a debugger or a speculative master can read. Prefer W1C.

Rule of thumb: state what wins when hardware sets and software clears the same bit.

Keep going

  • Practice: AXI4-Lite slave with read-only and write-only register access

  • Code lab: Maskable interrupt register

  • Interview: run a mock interview on this topic

Related topics

  • Hardware/software arbitration

Previous

224 / 350

Next: Hardware/Software Arbitration

Up next

Up nextHardware/Software Arbitration

Sign in to save progress

Practice this lessonReport an error

See also

  • Byte Strobes and Partial Writes
  • Atomic and Shadowed Updates
  • Interrupt Register Pattern