Q048FreeDesign Verification
Verify matrix zero propagation
Question
Implement a two-pass predictor and two-entry tagged scoreboard for a matrix sanitizer that zeroes every row and column containing an original zero without cascading from newly written zeroes. R, C, and W are positive constants; input matrix elements are known unsigned W-bit values. Observed response elements retain four-state logic so unknown output corruption is rejected. Call the supplied scoreboard methods only for accepted transactions using serialized callbacks. For same-edge ID retirement and reuse, publish the response first. Reset flushes pending IDs; a delayed old response using an already reused ID requires an external generation or quarantine rule to distinguish it.

Implementation scaffold
class matrix_predictor #(int R = 4, C = 4, W = 8);
typedef logic [W-1:0] matrix_t[R][C];
static function void predict(
input matrix_t original,
output matrix_t expected,
output bit row_zero[R],
output bit col_zero[C]
);
// TODO: Implement this predictor or scoreboard operation.
endfunction
endclass
class matrix_scoreboard #(int R = 4, C = 4, W = 8);
typedef logic [W-1:0] matrix_t[R][C];
typedef struct {
matrix_t original;
matrix_t expected;
bit row_zero[R];
bit col_zero[C];
} expectation_t;
expectation_t pending[int unsigned];
function new();
if (R < 1 || C < 1 || W < 1)
$fatal(1, "matrix dimensions and element width must be positive");
endfunction
function void accept_request(int unsigned id, matrix_t original);
// TODO: Implement this predictor or scoreboard operation.
endfunction
function void reset_epoch();
// TODO: Implement this predictor or scoreboard operation.
endfunction
function void check_response(int unsigned id, matrix_t actual);
// TODO: Implement this predictor or scoreboard operation.
endfunction
endclass
// TODO: Explain the no-zero, single/intersecting/edge-zero, full-row/full-column, all-zero and non-square test cases.Trace one case
matrix=[[1,2,0],[4,5,6]]sanitized=[[0,0,0],[4,5,0]]Only original row 0 and original column 2 are marked; zeroes written during transformation do not cascade into row 1.
Requirements
- Deep-copy each accepted matrix and derive row and column masks exclusively from the untouched original snapshot.
- Match up to two outstanding responses by ID, compare every coordinate, and diagnose the first mismatch with the original matrix and both masks.
- Reject duplicate or unknown responses and flush accepted work on reset.
- Explain why no-zero, single-zero, intersecting, edge, full-row, full-column, all-zero, and non-square cases are useful follow-up tests.
