Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Control a link with return credits

Q188·Free·Computer Architecture

Control a link with return credits

Difficulty
Medium
Topic
Computer Architecture
Language
SV
Interview prompt

Question

A sender crosses a latency-heavy link into an eight-entry receiver buffer. One credit represents one free receiver entry. Design the sender credit counter and transfer rule.

Candidate starting point

Implementation scaffold

module credit_sender (
  input logic clk, rst_n, tx_valid,
  output logic tx_ready,
  input logic [31:0] tx_data,
  input logic [3:0] credit_return,
  output logic credit_error
);
  logic [3:0] credits;
  logic accepted;
  logic signed [5:0] raw;

  always_comb begin : preedge_transfer_and_credit_sum
    // Implement here: reset-gated ready, accepted transfer and widened raw sum.
  end

  always_ff @(posedge clk) begin : registered_credit_state
    if (!rst_n) begin
      // Implement here: synchronous reset to eight credits and no error.
    end else begin
      // Implement here: validate return/raw, then hold with error or commit once.
    end
  end
  // Supplied serial datapath transfers tx_data when accepted; this module
  // supplies only its credit permission and error accounting.
endmodule
Reviewed example

Trace one case

Input
credits=0, tx_valid=1, credit_return=2
Expected output
accepted=0 on this edge; next credits=2; credit_error=0

tx_ready is based on the pre-edge zero count. Returned credits become usable only after the state update.

What to cover

Requirements

  1. Use synchronous active-low reset: on a rising edge with rst_n=0, set credits=8 and credit_error=0. Force tx_ready=0 while rst_n=0; otherwise use the pre-edge credit count.
  2. Compute raw=credits+credit_return-(tx_valid&&tx_ready) once per edge.
  3. Store raw only when it is 0 through 8 and credit_return<=8; otherwise hold credits and pulse credit_error.
  4. When credits is zero, accept no transfer on that edge even if credits return simultaneously.
Exact question handoffPractice Q188

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Partition and Contracts

Review state ownership, interfaces, acceptance, ordering, errors, reset, and cancellation.

  • Computer Architecture
  • Architecture
  • Interconnect
  • Flow control
Partition and Contracts →
Continue practicing

Related questions

Q213 · Computer ArchitectureSchedule four credited memory clients fairlyHardP→Q890 · Computer ArchitectureCheck per-channel link creditsHardP→Q581 · Computer ArchitecturePause headroom at 400 Gb/sMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi