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.
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:
| Port | Dir | Width | Description |
|---|---|---|---|
clk, rst_n | input | 1 | Clock and active-low synchronous reset |
tx_valid, tx_data[31:0] | input | 1, 32 | Upstream data beat request |
tx_ready | output | 1 | High when credits > 0; low when credit exhausted |
phy_tx_valid, phy_tx_data[31:0] | output | 1, 32 | Transmitted flit out to chiplet PHY |
credit_return_in | input | 1 | 1-cycle strobe indicating receiver freed 1 buffer entry |
credits_available[3:0] | output | 4 | Current remaining credit balance (resets to 8) |
Timing Constraints & Synthesizable RTL Rules
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
Failing to handle simultaneous transmit and credit return, which causes credit loss or artificial stalls.
Silicon & Hardware Engineering Notes
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.
Connected EcrioniX Learning Resources
Accelerate your VLSI engineering knowledge with these curated learning materials:
Progress through step-by-step verified modules from fundamentals to advanced silicon design.
Benchmark your hardware knowledge across 10 semiconductor domains and receive study roadmaps.
Explore foundational circuit theory, waveform timing, and physical hardware implementation.
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.