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. Interrupt Register Pattern

Part 7 · Memory & Buses · Intermediate

Interrupt Register Pattern

Sticky pending causes, enables, masks, clear behavior, and the limits of a one-bit event latch.

Why this matters

An interrupt output pulsed straight from an event can be missed by software. Events that arrive close together also merge into one pending bit, so a count is lost unless you design for it.

After this lesson you can: build pending, enable and clear registers with a level interrupt output, and say when events need a counter instead.

Hardware event sets sticky pending; software clears it; enable gates the interrupt output.
Pending remembers short events until software acknowledges them.

The packet processor routes done, configuration error, timeout, and datapath fault events into this one pending bank. The earlier set-wins equation is reused unchanged, so the interrupt view and STATUS view cannot disagree about collision policy.

design.sv
1
2
3
4
5
6
7
8
9
10
11
// snippet: set-dominant interrupt bank
always_ff @(posedge clk or negedge rst_n) begin
  if (!rst_n) begin
    pending_q <= '0;
    enable_q  <= '0;
  end else begin
    if (wr_enable) enable_q <= (enable_q & ~write_mask) | (wdata & write_mask);
    pending_q <= (pending_q & ~w1c_clear) | event_i;
  end
end
assign irq_o = |(pending_q & enable_q);
  • Pending is sticky so one-cycle events survive software latency.

  • Enable controls notification, not event capture; disabled events may remain visible in status.

  • The interrupt output is normally level-sensitive until all enabled pending causes are cleared.

  • Software reads cause bits, services sources, then clears only those handled.

Each slot is one clock cycle, and an input takes effect at the edge that ends its slot, so pending and irq change one slot later. The enable is held at 1, so irq follows pending. The page's four edges E0 to E3 end slots 1 to 4.

  • Slots 1 and 2 (E0, E1): event A sets pending, and irq rises in slot 2. Event B arrives while pending is already 1, so the two events coalesce into one bit.

  • Slot 3 (E2): the clear removes pending in slot 4. No count of B remains.

  • Slot 4 (E3): event C and the clear arrive on the same edge. Set wins, so pending is 1 again in slot 5.

A sticky bit retains a captured pending cause, not every occurrence. For lossless completions, count events with a defined saturation/overflow policy, enqueue records, or drain an underlying FIFO and use a level condition. Service/W1C alone cannot reconstruct two occurrences that coalesced.

Common pitfall

Do not pulse irq_o directly from event_i. Software can miss a one-cycle pulse, and interrupt controllers generally expect a level that remains asserted until acknowledged.

Check yourself An event occurs while its enable bit is zero. Should pending record it?

Usually yes: capture and notification are separate policies. The status remains observable, and enabling later may raise the interrupt. If the product requires masked events to be discarded, state that explicitly.

Remember

  • Pending is sticky, so a one-cycle event survives software latency.

  • Enable controls notification, not capture. The level output stays high until every enabled cause is cleared.

  • Two events before a clear give one pending bit. Use a counter or a FIFO if each occurrence matters.

Rule of thumb: give the interrupt controller a level that stays high until the cause is acknowledged.

Keep going

  • Code lab: Interrupt aggregator

  • Interview: run a mock interview on this topic

Related topics

  • Adapter and signoff

  • The firmware side: a C driver

Previous

228 / 350

Next: Adapter and Signoff

Up next

Up nextAdapter and Signoff

Sign in to save progress

Practice this lessonReport an error

See also

  • CSR Contract and Address Map
  • Field Access Types
  • Hardware/Software Arbitration
clkevent_iclear_ipendingirq
One sticky pending bit with its enable set: two events coalesce into one pending bit, a clear removes it, and an event that arrives with a clear wins