Part of Curriculum: Protocol RTL Design (Module 7: AXI Write Channel Handshake Controller)
View Full Roadmap →
Level 6 Industry Challenge ★ Advanced #46 50 pts ✓ Solved

Decoupled AXI4 Write Master Transaction Controller

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

Design an AXI4 write master controller handling independent, decoupled address and data channel handshakes with write response tracking.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
start_writewr_addr[31:0]AWVALIDWVALIDwrite_complete>clkrst_nDECOUPLED AXI4 WRITEPROTOCOL INTERFACE
⚡ Timing & Synthesizability Constraints

Timing Contract: Clocked on posedge ACLK, active-low reset ARESETn. AW and W handshakes can occur in any order. B channel handshake occurs only after both AW and final W beat complete.

RTL Constraints: Do not assume AW and W occur in the same cycle. Fully synthesizable Verilog-2001.

Objective: Implement a synthesizable AXI4 Write Controller. Address write (AW) and data write (W) channels must operate independently without assuming simultaneous handshakes. Coordinate AWVALID/AWREADY, WVALID/WREADY/WLAST, and capture write response on BVALID/BREADY.

Prerequisites: AXI4 write channel architecture (AW, W, B), decoupled handshakes, transaction state machines.
PortDirWidthDescription
ACLK, ARESETninput1Clock and active-low synchronous reset
start_writeinput1Trigger 1-beat write transaction
wr_addr[31:0], wr_data[31:0]input32Address and payload input from core
write_complete, write_erroutput1Status pulse on B handshake; err if BRESP != 2'b00
AWVALID, AWREADY, AWADDR[31:0]out/in/out1, 1, 32AXI Write Address channel
WVALID, WREADY, WDATA[31:0], WLASTout/in/out/out1, 1, 32, 1AXI Write Data channel
BVALID, BREADY, BRESP[1:0]in/out/in1, 1, 2AXI Write Response channel
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
Do NOT wait for AWREADY before asserting WVALID, or vice versa. The AMBA AXI spec requires address and data channels to be completely decoupled.
Hint 2: Implementation Architecture & Approach
Maintain two flags: aw_done and w_done. Each flag flips to 1 when its respective channel handshakes.
Hint 3: Edge Cases, Timing & Verilog Syntax
Only assert BREADY when both aw_done and w_done are true.
🔒 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        start_write,
  input  wire [31:0] wr_addr,
  input  wire [31:0] wr_data,
  output reg         write_complete,
  output reg         write_err,
  output reg         AWVALID,
  input  wire        AWREADY,
  output reg  [31:0] AWADDR,
  output reg         WVALID,
  input  wire        WREADY,
  output reg  [31:0] WDATA,
  output reg         WLAST,
  input  wire        BVALID,
  output reg         BREADY,
  input  wire [1:0]  BRESP
);

  reg aw_done, w_done;

  always @(posedge ACLK or negedge ARESETn) begin
    if (!ARESETn) begin
      write_complete <= 1'b0;
      write_err      <= 1'b0;
      AWVALID        <= 1'b0;
      AWADDR         <= 32'h0;
      WVALID         <= 1'b0;
      WDATA          <= 32'h0;
      WLAST          <= 1'b0;
      BREADY         <= 1'b0;
      aw_done        <= 1'b0;
      w_done         <= 1'b0;
    end else begin
      write_complete <= 1'b0;
      write_err      <= 1'b0;

      if (start_write && !AWVALID && !WVALID && !aw_done && !w_done && !BREADY) begin
        AWVALID <= 1'b1;
        AWADDR  <= wr_addr;
        WVALID  <= 1'b1;
        WDATA   <= wr_data;
        WLAST   <= 1'b1;
        aw_done <= 1'b0;
        w_done  <= 1'b0;
      end

      // Independent AW handshake
      if (AWVALID && AWREADY) begin
        AWVALID <= 1'b0;
        aw_done <= 1'b1;
      end

      // Independent W handshake
      if (WVALID && WREADY) begin
        WVALID <= 1'b0;
        WLAST  <= 1'b0;
        w_done <= 1'b1;
      end

      // When both AW and W have completed, enable B channel
      if ((aw_done || (AWVALID && AWREADY)) && (w_done || (WVALID && WREADY))) begin
        BREADY <= 1'b1;
      end

      // B channel handshake
      if (BREADY && BVALID) begin
        BREADY         <= 1'b0;
        aw_done        <= 1'b0;
        w_done         <= 1'b0;
        write_complete <= 1'b1;
        write_err      <= (BRESP != 2'b00);
      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 Decoupled AXI4 Write Master Transaction Controller, 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

Design an AXI4 write master controller handling independent, decoupled address and data channel handshakes with write response tracking.

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: Implement a synthesizable AXI4 Write Controller. Address write (AW) and data write (W) channels must operate independently without assuming simultaneous handshakes. Coordinate AWVALID/AWREADY, WVALID/WREADY/WLAST, and capture write response on BVALID/BREADY.

Prerequisites: AXI4 write channel architecture (AW, W, B), decoupled handshakes, transaction state machines.

Port List & Interface Timing

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

PortDirWidthDescription
ACLK, ARESETninput1Clock and active-low synchronous reset
start_writeinput1Trigger 1-beat write transaction
wr_addr[31:0], wr_data[31:0]input32Address and payload input from core
write_complete, write_erroutput1Status pulse on B handshake; err if BRESP != 2'b00
AWVALID, AWREADY, AWADDR[31:0]out/in/out1, 1, 32AXI Write Address channel
WVALID, WREADY, WDATA[31:0], WLASTout/in/out/out1, 1, 32, 1AXI Write Data channel
BVALID, BREADY, BRESP[1:0]in/out/in1, 1, 2AXI Write Response channel

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Clocked on posedge ACLK, active-low reset ARESETn. AW and W handshakes can occur in any order. B channel handshake occurs only after both AW and final W beat complete.

Synthesis Constraints: Do not assume AW and W occur in the same cycle. Fully synthesizable Verilog-2001.

Architectural Deep Dive & Implementation Walkthrough

Decoupled AXI Write Channel Architecture

Unlike simple buses where address and data are locked together in a single phase, AXI4 splits writes into three distinct channels:

  1. Write Address Channel (AW): Specifies write target address, burst length, and cache attributes.
  2. Write Data Channel (W): Carries the data payload beats and byte enables (WSTRB), terminating with WLAST.
  3. Write Response Channel (B): Transmits the final completion status from slave to master (OKAY, EXOKAY, SLVERR, DECERR).

A crucial rule of AXI is that AW and W channels are fully independent. The data can arrive before, during, or after the address phase. Attempting to tie them together causes inter-channel deadlocks in complex interconnect matrices.

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

Assuming AWREADY and WREADY arrive in the same clock cycle, or asserting BREADY before all data beats have been acknowledged.

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

High-performance AXI write masters track outstanding transaction IDs (AWID) to support multi-transaction pipelining.

Starter RTL Code

module top_module (
  input  wire        ACLK,
  input  wire        ARESETn,
  input  wire        start_write,
  input  wire [31:0] wr_addr,
  input  wire [31:0] wr_data,
  output reg         write_complete,
  output reg         write_err,
  output reg         AWVALID,
  input  wire        AWREADY,
  output reg  [31:0] AWADDR,
  output reg         WVALID,
  input  wire        WREADY,
  output reg  [31:0] WDATA,
  output reg         WLAST,
  input  wire        BVALID,
  output reg         BREADY,
  input  wire [1:0]  BRESP

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module (
  input  wire        ACLK,
  input  wire        ARESETn,
  input  wire        start_write,
  input  wire [31:0] wr_addr,
  input  wire [31:0] wr_data,
  output reg         write_complete,
  output reg         write_err,
  output reg         AWVALID,
  input  wire        AWREADY,
  output reg  [31:0] AWADDR,
  output reg         WVALID,
  input  wire        WREADY,
  output reg  [31:0] WDATA,
  output reg         WLAST,
  input  wire        BVALID,
  output reg         BREADY,
  input  wire [1:0]  BRESP
);

  reg aw_done, w_done;

  always @(posedge ACLK or negedge ARESETn) begin
    if (!ARESETn) begin
      write_complete <= 1'b0;
      write_err      <= 1'b0;
      AWVALID        <= 1'b0;
      AWADDR         <= 32'h0;
      WVALID         <= 1'b0;
      WDATA          <= 32'h0;
      WLAST          <= 1'b0;
      BREADY         <= 1'b0;
      aw_done        <= 1'b0;
      w_done         <= 1'b0;
    end else begin
      write_complete <= 1'b0;
      write_err      <= 1'b0;

      if (start_write && !AWVALID && !WVALID && !aw_done && !w_done && !BREADY) begin
        AWVALID <= 1'b1;
        AWADDR  <= wr_addr;
        WVALID  <= 1'b1;
        WDATA   <= wr_data;
        WLAST   <= 1'b1;
        aw_done <= 1'b0;
        w_done  <= 1'b0;
      end

      // Independent AW handshake
      if (AWVALID && AWREADY) begin
        AWVALID <= 1'b0;
        aw_done <= 1'b1;
      end

      // Independent W handshake
      if (WVALID && WREADY) begin
        WVALID <= 1'b0;
        WLAST  <= 1'b0;
        w_done <= 1'b1;
      end

      // When both AW and W have completed, enable B channel
      if ((aw_done || (AWVALID && AWREADY)) && (w_done || (WVALID && WREADY))) begin
        BREADY <= 1'b1;
      end

      // B channel handshake
      if (BREADY && BVALID) begin
        BREADY         <= 1'b0;
        aw_done        <= 1'b0;
        w_done         <= 1'b0;
        write_complete <= 1'b1;
        write_err      <= (BRESP != 2'b00);
      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 Decoupled AXI4 Write Master Transaction Controller require?

Design an AXI4 write master controller handling independent, decoupled address and data channel handshakes with write response tracking. 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 Decoupled AXI4 Write Master Transaction Controller to assess real-world synthesizability and race-condition awareness.