Part of Curriculum: Advanced SoC and Chiplet RTL (Module 5: Chiplet Die-to-Die Credit Flow Controller)
View Full Roadmap →
Level 6 Industry Challenge ★ Advanced #49 50 pts ✓ Solved

Credit-Based Flow Control Controller for Inter-Chiplet Links

Advanced RTL & Protocol Design · advanced-rtl, credit-based-flow-control, systemverilog, asic, fpga

Design a credit-based flow control transmit manager for high-speed chiplet and PCIe/UCIe links with zero-credit stalling and underflow protection.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
tx_validcredit_return_intx_readyphy_tx_validcredits_available[3:0]>clkrst_nCREDIT-BASED FLOW CODIGITAL HARDWARE BLOCK
⚡ Timing & Synthesizability Constraints

Timing Contract: Clocked on rising edge of clk with active-low synchronous reset rst_n. tx_ready must immediately deassert when credit count reaches 0.

RTL Constraints: No underflow below 0. Saturate at max credits (15). Synthesizable Verilog-2001.

Objective: Implement a transmitter-side credit tracking engine. Initialize with INIT_CREDITS (default 8). On each transmitted beat, consume 1 credit. On receiving credit_return_in, replenish credits. Stall upstream when credits reach zero, and correctly handle simultaneous transmission and credit returns.

Prerequisites: Credit-based flow control theory, UCIe / PCIe transaction layers, saturating counters.
PortDirWidthDescription
clk, rst_ninput1Clock and active-low synchronous reset
tx_valid, tx_data[31:0]input1, 32Upstream data beat request
tx_readyoutput1High when credits > 0; low when credit exhausted
phy_tx_valid, phy_tx_data[31:0]output1, 32Transmitted flit out to chiplet PHY
credit_return_ininput11-cycle strobe indicating receiver freed 1 buffer entry
credits_available[3:0]output4Current remaining credit balance (resets to 8)
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
Initialize credits_available to 4'd8 on reset.
Hint 2: Implementation Architecture & Approach
tx_ready is combinationally high when credits_available > 0.
Hint 3: Edge Cases, Timing & Verilog Syntax
A transmit happens when tx_valid && tx_ready. If credit_return_in happens on the same cycle, the net delta is 0.
🔒 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        clk,
  input  wire        rst_n,
  input  wire        tx_valid,
  input  wire [31:0] tx_data,
  output wire        tx_ready,
  output reg         phy_tx_valid,
  output reg  [31:0] phy_tx_data,
  input  wire        credit_return_in,
  output reg  [3:0]  credits_available
);

  assign tx_ready = (credits_available > 4'd0);
  wire send_beat = tx_valid && tx_ready;

  always @(posedge clk or negedge rst_n) begin
    if (!rst_n) begin
      credits_available <= 4'd8;
      phy_tx_valid      <= 1'b0;
      phy_tx_data       <= 32'h0;
    end else begin
      phy_tx_valid <= send_beat;
      if (send_beat) begin
        phy_tx_data <= tx_data;
      end

      case ({send_beat, credit_return_in})
        2'b10: begin // Sent, no return -> decrement
          if (credits_available > 4'd0)
            credits_available <= credits_available - 4'd1;
        end
        2'b01: begin // No send, return -> increment
          if (credits_available < 4'd15)
            credits_available <= credits_available + 4'd1;
        end
        2'b11: begin // Simultaneous send and return -> net zero change
          credits_available <= credits_available;
        end
        default: ; // 2'b00 -> hold
      endcase
    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 Credit-Based Flow Control Controller for Inter-Chiplet Links, 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 a credit-based flow control transmit manager for high-speed chiplet and PCIe/UCIe links with zero-credit stalling and underflow protection.

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 transmitter-side credit tracking engine. Initialize with INIT_CREDITS (default 8). On each transmitted beat, consume 1 credit. On receiving credit_return_in, replenish credits. Stall upstream when credits reach zero, and correctly handle simultaneous transmission and credit returns.

Prerequisites: Credit-based flow control theory, UCIe / PCIe transaction layers, saturating counters.

Port List & Interface Timing

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

PortDirWidthDescription
clk, rst_ninput1Clock and active-low synchronous reset
tx_valid, tx_data[31:0]input1, 32Upstream data beat request
tx_readyoutput1High when credits > 0; low when credit exhausted
phy_tx_valid, phy_tx_data[31:0]output1, 32Transmitted flit out to chiplet PHY
credit_return_ininput11-cycle strobe indicating receiver freed 1 buffer entry
credits_available[3:0]output4Current remaining credit balance (resets to 8)

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Clocked on rising edge of clk with active-low synchronous reset rst_n. tx_ready must immediately deassert when credit count reaches 0.

Synthesis Constraints: No underflow below 0. Saturate at max credits (15). Synthesizable Verilog-2001.

Architectural Deep Dive & Implementation Walkthrough

Why Chiplet Links Use Credit Flow Control

In on-chip buses (like AXI), valid-ready backpressure requires the consumer to immediately assert READY = 0 to halt the producer. However, across a multi-die package (such as UCIe or optical chiplet interconnects), signal propagation latency can span multiple clock cycles.

If a receiver ran out of buffer space, its READY = 0 backpressure would arrive too late, causing buffer overflow and packet loss. Credit-based flow control solves this by granting the transmitter a known allowance of credits corresponding to physical buffer slots. The transmitter only sends when it possesses a credit, guaranteeing zero buffer overflows regardless of physical distance.

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

Failing to handle simultaneous transmit and credit return, which causes credit loss or artificial stalls.

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

Universal Chiplet Interconnect Express (UCIe) Flit Transfer protocols rely on credit-based flow control between the D2D Adapter and the remote die Die-to-Die controller.

Starter RTL Code

module top_module (
  input  wire        clk,
  input  wire        rst_n,
  input  wire        tx_valid,
  input  wire [31:0] tx_data,
  output wire        tx_ready,
  output reg         phy_tx_valid,
  output reg  [31:0] phy_tx_data,
  input  wire        credit_return_in,
  output reg  [3:0]  credits_available
);

  // Implement credit-based flow control:
  // 1. Reset value of credits_available = 4'd8.
  // 2. tx_ready = (credits_available > 0).
  // 3. When tx_valid && tx_ready: transmit data (phy_tx_valid=1) and decrement credit.
  // 4. When credit_return_in: increment credit.
  // 5. Handle simultaneous send and credit return without count jitter or underflow.

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module (
  input  wire        clk,
  input  wire        rst_n,
  input  wire        tx_valid,
  input  wire [31:0] tx_data,
  output wire        tx_ready,
  output reg         phy_tx_valid,
  output reg  [31:0] phy_tx_data,
  input  wire        credit_return_in,
  output reg  [3:0]  credits_available
);

  assign tx_ready = (credits_available > 4'd0);
  wire send_beat = tx_valid && tx_ready;

  always @(posedge clk or negedge rst_n) begin
    if (!rst_n) begin
      credits_available <= 4'd8;
      phy_tx_valid      <= 1'b0;
      phy_tx_data       <= 32'h0;
    end else begin
      phy_tx_valid <= send_beat;
      if (send_beat) begin
        phy_tx_data <= tx_data;
      end

      case ({send_beat, credit_return_in})
        2'b10: begin // Sent, no return -> decrement
          if (credits_available > 4'd0)
            credits_available <= credits_available - 4'd1;
        end
        2'b01: begin // No send, return -> increment
          if (credits_available < 4'd15)
            credits_available <= credits_available + 4'd1;
        end
        2'b11: begin // Simultaneous send and return -> net zero change
          credits_available <= credits_available;
        end
        default: ; // 2'b00 -> hold
      endcase
    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 Credit-Based Flow Control Controller for Inter-Chiplet Links require?

Design a credit-based flow control transmit manager for high-speed chiplet and PCIe/UCIe links with zero-credit stalling and underflow protection. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: advanced-rtl, credit-based-flow-control, 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 Credit-Based Flow Control Controller for Inter-Chiplet Links to assess real-world synthesizability and race-condition awareness.