Q062FreeDesign Verification
Verify a cascading flit-collision resolver
Interview prompt
Question
Write a stack oracle and header check for a framed flit-collision resolver. A right-moving flit is marked R, a left-moving flit L, and only an R survivor followed by an incoming L can collide. The oracle input contains known direction bits and unsigned 8-bit magnitudes; 1 denotes R and 0 denotes L. An empty input frame is also invalid. The observed error and 32-bit survivor count retain four-state logic, so header_matches must return false for unknown observed fields as well as ordinary mismatches.
Candidate starting point
Implementation scaffold
class collision_oracle;
typedef struct { bit dir_right; byte unsigned mag; } flit_t;
typedef struct { bit error; flit_t survivors[$]; } prediction_t;
function automatic prediction_t predict(flit_t input_q[$]);
// TODO: implement.
endfunction
function automatic bit header_matches(
prediction_t p, logic got_error, logic [31:0] got_survivor_count);
// TODO: implement.
endfunction
endclassReviewed example
Trace one case
Input
accepted flits=[R5,R3,L4] followed by lastExpected output
header survivor_count=1,error=0; sole survivor=R5 with last=1L4 first eliminates the smaller opposing R3 and then loses to R5, exercising a two-level collision cascade while preserving survivor order.
What to cover
Requirements
- Use a stack oracle for one to 16 nonzero direction/magnitude flits, including arbitrary-depth collision cascades.
- Magnitude zero or a seventeenth flit predicts an error header with survivor_count zero.
- For a legal frame, require the header count to equal the ordered survivor queue length; an empty result has no data beats.
- Treat handshake assembly, header-before-data state, output beat checking, reset, and coverage as follow-up scoreboard work.
