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 Foundations57
  • Combinational Design58
  • Sequential Design61
  • FSM & Control66
  • Timing & Clocking64
  • Reset & CDC58
  • Memory & Buses94
    • SRAM and ROM
    • Register Files
      • Multi-Port Register File Fundamentals
      • 2R1W Register File with Bypass
      • Read-During-Write Hazards and Assertions
      • Read-during-write hazards in pipelines
      • Minimal hazard assertion
      • Key takeaways
      • Common pitfalls
      • Worked Examples and Waveforms
      • Corner Cases and Stress Tests
      • Integration and Sign-off Notes
    • Valid/Ready Handshake
    • AXI-Lite
    • AXI-Stream
    • Bus Integration
    • Synchronous FIFO
    • Register-Map and CSR RTL
    • Memory Reliability
    • Peripheral RTL Integration
    • Full AXI4: RTL Roadmap
  • Advanced RTL60
  • Senior & Interview175
  • Glossary and Notation
Loading lesson

‹Memory & Buses
  1. Topics
  2. RTL Design
  3. Memory & Buses
  4. Register Files

Part 7 · Memory & Buses · Intermediate

Register Files

What a register file is, when it is built from flops or SRAM, and the three lessons that build a 2R1W file.

  • 10topics
  • 10lessons

Topics in this section

  1. 1Multi-Port Register File Fundamentals1 lesson
  2. 22R1W Register File with Bypass1 lesson
  3. 3Read-During-Write Hazards and Assertions1 lesson
  4. 4Read-during-write hazards in pipelines1 lesson
  5. 5Minimal hazard assertion1 lesson
  6. 6Key takeaways1 lesson
  7. 7Common pitfalls1 lesson
  8. 8Worked Examples and Waveforms1 lesson
  9. 9Corner Cases and Stress Tests1 lesson
  10. 10Integration and Sign-off Notes1 lesson
On this page

    A register file is a small, fast array of registers with several access ports. A CPU-style file serves two reads and one write in the same cycle, with fixed rules for collisions and for the zero register.

    The 2R1W register file built in this topic: one clocked write port into a 32 x 32 flop array, and two combinational read muxes

    Read it left to right: one write enters the array at the clock edge, and two independent reads leave it in the same cycle. Each read port costs a 32-to-1 mux; the bypass added in the second lesson sits after those muxes.

    Question

    Flop array

    SRAM bank

    Small file (illustratively tens of words)

    Resettable; read mux and routing cost grows with ports

    Macro/block overhead may dominate; compare mapped area

    Large table (illustratively hundreds of words)

    Area grows with every flop and every read mux

    May be denser; dimensions and replication can require several blocks

    Two reads plus one write in one cycle

    Two muxes on one array

    Needs replication or a true multi-port macro

    Reset to a known state

    A loop clears the array (fine for flops)

    No array reset; write zeros with a state machine

    Lessons in this topic

    3 lessons, about 11 min

    1. 1Multi-Port Register File FundamentalsYou can state the 2R1W contract, including x0 and a same-cycle read of the written register, and weigh a flop array against SRAM banks.4 min
    2. 22R1W Register File with BypassYou can build a 2R1W register file with write-through bypass and x0 hardwired to zero, and read a waveform that compares the plain and bypassed lanes.4 min
    3. 3Read-During-Write Hazards and AssertionsYou can write the assertion that a same-cycle read sees the write data, include the nonzero guard, and explain why x0 needs it.3 min

    Word counts here are illustrative, not break-even thresholds. Compare candidates at the same width, 2R1W throughput, reset/x0/bypass contract and required read latency. Record target/library and tool settings, mapped flop/LUT/RAM counts or cell area, replication and bypass cost, and timing at the required clock. A synchronous bank that adds a cycle is an architectural alternative requiring pipeline changes, not an equivalent drop-in. No mapped area or timing results are supplied here; physical timing signoff is separate.

    Check yourself A design needs 32 registers with two reads and one write per cycle. Why consider a flop array, and when would you choose banks instead?

    At 32-bit width it needs 1024 storage bits plus two read muxes, and supports combinational reads and reset. Compare mapped candidates on the chosen target; depth alone cannot decide the winner. Banks must meet the port, latency and collision contract, including replication and bypass overhead.

    Interview

    Expect whiteboard questions on same-cycle read-during-write: what a read of the written register returns, what x0 does, and where the bypass mux sits.

    Revision sheet

    The whole topic on one page, taken from each lesson's Remember box. Read it before an interview, or print it.

    Multi-Port Register File Fundamentals

    • 2R1W means two combinational reads and one clocked write in the same cycle.

    • By contract, a same-cycle read of the written register returns the write data. Register x0 reads zero and drops writes.

    • Synchronous SRAM banks cannot clear every word at once, and they change the read latency.

    Rule of thumb: fix read-during-write and x0 in the contract first, then write the code.

    2R1W Register File with Bypass

    • Each read port selects the write data when write enable is high and the write address matches.

    • A bypass keyed on the address alone forwards stale write data on idle cycles.

    • The bypass covers only the same-cycle case. A writeback one stage later needs pipeline forwarding.

    Read-During-Write Hazards and Assertions

    • The property: write enabled, write address equals read address and is nonzero, then read data equals write data.

    • Without the nonzero guard the property fails on every write while x0 is read, because x0 reads zero.

    • Check during the write cycle, before the edge commits the write. A check after the edge proves nothing about bypass.

    Practise it

    • Mini project: a two-master bus with decoder, default slave and timeout

    • Practice question: Register file with two read ports and one write port

    • Practice question: Multi-port register file (3+ ports)

    • Code lab: 2x8 register file

    • Practice question: 2R1W register file: read-first vs write-first semantics

    • Interview: run a mock interview on this topic

    PreviousNext: Multi-Port Register File Fundamentals

    Up next

    Up nextMulti-Port Register File Fundamentals

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • SRAM and ROM
    • Valid/Ready Handshake
    • AXI-Lite