Part of Curriculum: Protocol RTL Design (Module 1: Valid-Ready Flow Control & Handshake Contracts)
View Full Roadmap →
Level 6 Industry Challenge ★ Advanced #44 50 pts ✓ Solved

AXI4 Handshake Engine with Protocol Hold Rules & Backpressure

Advanced RTL & Protocol Design · advanced-rtl, axi-protocol, systemverilog, asic, fpga

Implement an AXI valid-ready handshake engine enforcing the AMBA AXI handshake stability rules under severe downstream backpressure.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
s_validm_readys_readym_validstall_detected>clkrst_nAXI4 HANDSHAKE ENGINPROTOCOL INTERFACE
⚡ Timing & Synthesizability Constraints

Timing Contract: Clocked on posedge ACLK, active-low reset ARESETn. When s_valid is asserted, s_data must not change until s_valid && s_ready occurs.

RTL Constraints: No combinational path from m_ready to s_valid. Synthesizable Verilog-2001.

Objective: Design a valid-ready handshake controller adhering to Arm AMBA AXI4 specifications. Ensure transfers occur strictly on clock edges where VALID && READY are both high. Ensure VALID cannot depend combinationally on READY, and payload is held stable during stall cycles.

Prerequisites: AMBA AXI4 valid/ready handshake principles, pipelining, combinational loops avoidance.
PortDirWidthDescription
ACLK, ARESETninput1Global clock and active-low synchronous reset
s_valid, s_data[31:0]input1, 32Upstream producer handshake and data
s_readyoutput1Upstream ready indicating buffer readiness
m_valid, m_data[31:0]output1, 32Downstream consumer handshake and data
m_readyinput1Downstream consumer ready backpressure signal
stall_detectedoutput1Status flag asserted during backpressure stalls
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
A transfer happens if and only if (VALID && READY) on the rising clock edge.
Hint 2: Implementation Architecture & Approach
According to AMBA AXI, VALID cannot wait for READY combinationally. But READY can wait for VALID.
Hint 3: Edge Cases, Timing & Verilog Syntax
When m_valid is high and m_ready is low, s_ready must drop to 0 to prevent upstream overwriting the unstalled payload.
🔒 Reveal Verified Reference RTL Solution (Click to expand)
⚠️ Self-Discovery Warning: Try solving and simulating first! Viewing the verified reference implementation will bypass the real debugging experience.
Verified Synthesizable RTL
module top_module (
  input  wire        ACLK,
  input  wire        ARESETn,
  input  wire        s_valid,
  output wire        s_ready,
  input  wire [31:0] s_data,
  output reg         m_valid,
  input  wire        m_ready,
  output reg  [31:0] m_data,
  output wire        stall_detected
);

  assign stall_detected = m_valid && !m_ready;
  assign s_ready = !m_valid || m_ready;

  always @(posedge ACLK or negedge ARESETn) begin
    if (!ARESETn) begin
      m_valid <= 1'b0;
      m_data  <= 32'h0;
    end else begin
      if (s_ready) begin
        m_valid <= s_valid;
        if (s_valid) begin
          m_data <= s_data;
        end
      end
    end
  end

endmodule
Verilog-2001 / SV Saved
Font: |
// Click Run Tests (or press Ctrl+Enter) to compile your RTL and simulate against hidden testbenches.
Simulation Timing Diagram (VCD Waveform)
100%
No simulation waveform yet. Run tests to simulate and generate VCD traces.
No compilation run yet. Syntax warnings and elaboration messages will appear here.
No simulation output yet. Raw stdout from vvp will appear here.

RTL Problems / Level 6 · Advanced RTL & Protocol Design

What You Will Learn

By solving AXI4 Handshake Engine with Protocol Hold Rules & Backpressure, you will acquire core industry skills:

  • Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
  • Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
  • Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
  • Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.

Problem Statement & Requirements

Implement an AXI valid-ready handshake engine enforcing the AMBA AXI handshake stability rules under severe downstream backpressure.

Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.

Objective: Design a valid-ready handshake controller adhering to Arm AMBA AXI4 specifications. Ensure transfers occur strictly on clock edges where VALID && READY are both high. Ensure VALID cannot depend combinationally on READY, and payload is held stable during stall cycles.

Prerequisites: AMBA AXI4 valid/ready handshake principles, pipelining, combinational loops avoidance.

Port List & Interface Timing

The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:

PortDirWidthDescription
ACLK, ARESETninput1Global clock and active-low synchronous reset
s_valid, s_data[31:0]input1, 32Upstream producer handshake and data
s_readyoutput1Upstream ready indicating buffer readiness
m_valid, m_data[31:0]output1, 32Downstream consumer handshake and data
m_readyinput1Downstream consumer ready backpressure signal
stall_detectedoutput1Status flag asserted during backpressure stalls

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Clocked on posedge ACLK, active-low reset ARESETn. When s_valid is asserted, s_data must not change until s_valid && s_ready occurs.

Synthesis Constraints: No combinational path from m_ready to s_valid. Synthesizable Verilog-2001.

Architectural Deep Dive & Implementation Walkthrough

The AMBA AXI Valid-Ready Handshake Contract

In all 5 AXI channels (AR, R, AW, W, B) as well as AXI4-Stream, data movement is governed by the two-way VALID / READY handshake contract:

  • The Transfer Point: Data is consumed strictly when VALID = 1 and READY = 1 at a positive clock edge.
  • The Stability Requirement: Once a master asserts VALID, it must maintain VALID = 1 and keep the payload unchanged until READY = 1 is observed.
  • Deadlock Prevention: The specification forbids VALID from waiting for READY combinationally. A master cannot check if a slave is ready before deciding whether to assert VALID.

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

Allowing payload signals to mutate while VALID is high and READY is low, or creating a combinational loop from READY to VALID.

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

Cascading simple valid-ready stages introduces a half-bandwidth bubble (1 beat every 2 cycles). Eliminating this requires a skid buffer (Problem 45).

Starter RTL Code

module top_module (
  input  wire        ACLK,
  input  wire        ARESETn,
  input  wire        s_valid,
  output wire        s_ready,
  input  wire [31:0] s_data,
  output reg         m_valid,
  input  wire        m_ready,
  output reg  [31:0] m_data,
  output wire        stall_detected
);

  // Implement an elastic valid-ready buffer stage:
  // 1. Data beat transfers when (VALID && READY) on posedge ACLK.
  // 2. Once m_valid is asserted, m_data and m_valid MUST remain stable until m_ready = 1.
  // 3. stall_detected = m_valid && !m_ready.

endmodule

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module (
  input  wire        ACLK,
  input  wire        ARESETn,
  input  wire        s_valid,
  output wire        s_ready,
  input  wire [31:0] s_data,
  output reg         m_valid,
  input  wire        m_ready,
  output reg  [31:0] m_data,
  output wire        stall_detected
);

  assign stall_detected = m_valid && !m_ready;
  assign s_ready = !m_valid || m_ready;

  always @(posedge ACLK or negedge ARESETn) begin
    if (!ARESETn) begin
      m_valid <= 1'b0;
      m_data  <= 32'h0;
    end else begin
      if (s_ready) begin
        m_valid <= s_valid;
        if (s_valid) begin
          m_data <= s_data;
        end
      end
    end
  end

endmodule

Related RTL Problems in Level 6

  • Manchester Encoder — Combine a data bit with the clock to produce a Manchester-encoded line signal — the self-clocking encoding used in classic Ethernet and RFID.
  • Manchester Decoder — Recover the original data bit from a Manchester-encoded line signal — the exact inverse of the Manchester Encoder problem.
  • Quadrature Rotary Encoder Decoder — Decode the two-phase A/B signal from a real rotary knob or mouse wheel into a direction and position count — sample B on every rising edge of A.

Frequently Asked Questions

What does AXI4 Handshake Engine with Protocol Hold Rules & Backpressure require?

Implement an AXI valid-ready handshake engine enforcing the AMBA AXI handshake stability rules under severe downstream backpressure. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: advanced-rtl, axi-protocol, systemverilog, asic, fpga. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.

How is my solution graded?

A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.

How does this challenge help with semiconductor interviews?

Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of AXI4 Handshake Engine with Protocol Hold Rules & Backpressure to assess real-world synthesizability and race-condition awareness.