Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ795
Page ↗
Q795ArchNVIDIAASIC interview problem

Check per-channel link credits

TechniquesArchMicroarchitectureInterconnectCheckcredits
DifficultyHard
TopicComputer Architecture
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

A two-channel link starts with four transmit credits per channel. Sending consumes one credit; a returned credit restores one. Write a SystemVerilog checker for credit accounting and protocol errors.

Starting declarationSystemVerilog
input logic clk, rst_n;
input logic tx_fire, tx_ch;
input logic cr_valid, cr_ch;
output logic error;

Example input and output

Use this case to check your interpretation
Input
Channel 1 has two credits and observes tx_fire and cr_valid for channel 1 on the same edge.
Output
Channel 1 remains at two credits and error remains clear.
Explanation

At a non-boundary count, the legal send consumes exactly the credit restored by the same-channel return.

02

Requirements (4)

  • Track an integer available[2], initialized to four for each channel on reset and constrained to 0..4.
  • A tx_fire consumes one from tx_ch; if its pre-edge count is zero, leave the count unchanged and set sticky error.
  • A return without a same-channel send adds one; if its pre-edge count is four, leave that count unchanged and set sticky error.
  • For a same-channel send and return: counts 1..3 stay unchanged; at 0 flag the send and apply the return to reach 1; at 4 flag the return and apply the send to reach 3.