Hardware interview practice
Verify a mirrored topology checker
Verify a bounded level-order tree checker that distinguishes value asymmetry, shape asymmetry, and malformed ancestry.

Starting point
Question code
logic clk, rst_n, start;
logic [4:0] node_count;
logic [30:0] node_valid;
logic [7:0] node_value [31];
logic busy, done, request_error, symmetric;
parameter int MAX_LATENCY = 40;Reviewed example
Work through one case
Input
node_count=7; valid bits all set; level-order values=[1,2,2,3,4,4,3]Expected output
well_formed=1; symmetric=1Every nonroot node has a valid parent, and mirror pairs match in both presence and value at each level.
What to cover
Requirements
- Use child indexes 2*i+1 and 2*i+2 below node_count, with no valid bits at indexes greater than or equal to node_count.
- Require a valid root for a nonempty tree and a valid parent for every valid nonroot node.
- Compare every same-level mirror pair for both presence and value without reading invalid-node data.
- Return a fixed malformed-input result and require one bounded completion unless reset cancels it.
