Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify duplicate token supply

Hardware interview practice

Verify duplicate token supply

EasyReference ModelsSystemVerilog

Verify a command-admission block that decides whether a stock list contains enough copies of every requested 4-bit token.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

logic clk, rst_n, start;
logic [5:0] request_len, stock_len;
logic [3:0] request_token [32];
logic [3:0] stock_token [32];
logic busy, done, request_error, can_supply;
parameter int MAX_LATENCY = 70;
Reviewed example

Work through one case

Input
request tokens=[2,2,5]; stock tokens=[2,5,2,7]
Expected output
can_supply=1

Fresh histograms count demand token 2 twice and token 5 once, both no greater than their stock multiplicities.

What to cover

Requirements

  1. For legal lengths 0 through 32, count only active entries in fresh 16-bin histograms.
  2. Return true exactly when every requested count is no greater than the stock count; an empty request is true.
  3. Illegal lengths return request_error with can_supply zero, and inactive suffix entries never affect prediction.
  4. Snapshot accepted inputs, check one bounded done pulse, and suppress late completion after reset.
Continue practicing

Related questions

Reference ModelsVerify a decimal palindrome checker→Reference ModelsBuild a FIFO reference model→Reference ModelsModel sparse banked memory with packed keys→
asic.fyi · Learn silicon end to end.info@asic.fyi