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
    • Controller and Datapath
    • Moore vs Mealy
    • State Encoding
    • Multi-Cycle Sequencers
    • UART Transmitter
    • Memory Controller
      • Objective and Interface
      • State Machine and Bus Behavior
      • Request Latching
      • Design Closure Checklist
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹Memory Controller
  1. Topics
  2. RTL Design
  3. FSM & Control
  4. Memory Controller
  5. Objective and Interface

Part 4 · FSM & Control · Intermediate

Objective and Interface

The requester handshake, the RAM signals, and the ordering and latency rules.

On this page

    Why this matters

    A controller that lets req_ready depend on rsp_valid or on the requester's own outputs creates a combinational loop when it is wired to a real requester. Fixing the interface first avoids that.

    After this lesson you can: state the interface of a one-request-at-a-time memory controller, its ordering and throughput, and when a write counts as complete.

    The job

    • Accept one read or write request at a time through a valid/ready handshake.

    • For a write: drive the RAM for one cycle and be ready again.

    • For a read: drive the address, wait for the RAM's read latency, then present the data with a one-cycle rsp_valid.

    • Keep working correctly whatever the requester does to its inputs after the handshake.

    Interfaces

    The requester side uses a valid/ready handshake. The RAM side uses fixed-latency accesses.

    Requester side

    Signal

    Direction

    Meaning

    req_valid

    in

    A request is offered. The requester holds it, with stable fields, until req_ready is seen.

    req_ready

    out

    High only in IDLE. A transfer happens when req_valid && req_ready at a clock edge.

    req_we, req_addr, req_wdata

    in

    Operation, address, write data. Valid only while req_valid.

    rsp_valid, rsp_rdata

    out

    One-cycle pulse for each uncancelled read. No rsp_ready: consumer must capture every pulse. Writes produce no response; reset cancels outstanding requests.

    RAM side

    Signal

    Direction

    Meaning

    mem_en

    out

    One-cycle access strobe

    mem_we

    out

    Write enable (only during a write access)

    mem_addr, mem_wdata

    out

    Address and write data, driven from the latched request

    mem_rdata

    in

    RD_LAT registered stages: count the launch edge as stage 1. For launch at edge 1, data is available after edge RD_LAT, sampled by the consumer at RD_LAT+1.

    Ordering and throughput

    Property

    This controller

    Outstanding requests

    One at a time

    Ordering

    Strictly in order; a read after a write to the same address sees the written data

    Write timing (accept = edge 0)

    Commit and ready restored after edge 1; earliest next acceptance edge 2. Initiation interval 2.

    Read timing (accept = edge 0)

    RAM launch edge 1; response available after edge RD_LAT; consumer captures at RD_LAT+1. Ready restored after that edge; earliest next acceptance RD_LAT+2.

    One read with RD_LAT = 2, counted from the accepting edge 0: the RAM launches at edge 1, data is available in RESP after edge 2, the consumer captures at edge 3, and the next request can be accepted at edge 4.

    Read the picture left to right. Each arrow is a rising clock edge, and the box after it is the state the controller holds until the next edge.

    • Edge 0 accepts the read and moves to ACCESS, which drives mem_en for one cycle.

    • Edge 1 is the RAM launch: it counts as stage 1 of the two read stages. The controller waits in WAIT.

    • Edge 2 completes stage 2, so the data is available while the controller sits in RESP with rsp_valid high.

    • Edge 3 is where the always-accepting consumer captures it. Ready returns after that edge, so edge 4 (RD_LAT + 2) is the earliest next acceptance.

    Edge (RD_LAT = 2)

    Pre-edge action

    Post-edge state / signals

    0

    Accept read

    ACCESS; mem_en = 1

    1

    RAM launches read

    WAIT; mem_en = 0

    2

    RAM pipeline advances

    RESP; rsp_valid = 1 and data available

    3

    Always-accepting consumer captures response

    IDLE; req_ready = 1

    4

    Earliest next acceptance

    ACCESS for next request

    One request at a time keeps the FSM small and the ordering correct. More throughput needs a pipelined controller with a queue for outstanding reads; see the pipelining topic.

    Common pitfall

    Do not let req_ready depend on rsp_valid or on the requester's own outputs through a combinational path. Here req_ready is a pure function of the state register, which makes it safe to connect to any requester.

    Check yourself What does the requester see on rsp_valid after a write?

    Nothing: writes produce no response. A requester that must know a write has completed can treat the return of req_ready as completion, since the controller accepts a new request only once the write has gone to the RAM.

    Remember

    • One request at a time, through valid/ready. A write drives the RAM for one cycle. A read waits for the RAM latency and then gives a one-cycle rsp_valid.

    • req_ready is a pure function of the state register, so it is safe to connect to any requester.

    • Writes give no response. The return of req_ready is their completion.

    Rule of thumb: more throughput means a pipelined controller with a queue, not a faster single-request FSM.

    Keep going

    • Practice: Design a burst access controller with a ready/valid handshake

    • Interview: run a mock interview on this topic

    Related topics

    • State machine and bus behavior

    Previous

    112 / 350

    Next: State Machine and Bus Behavior

    Up next

    Up nextState Machine and Bus Behavior

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Request Latching
    • Design Closure Checklist