Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify a mirrored topology checker

Hardware interview practice

Verify a mirrored topology checker

MediumReference ModelsSystemVerilog

Verify a bounded level-order tree checker that distinguishes value asymmetry, shape asymmetry, and malformed ancestry.

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 →
Level-order binary tree showing matching mirror pairs and a malformed case with a valid child under an invalid parent.
Map each node to its mirror partner, then check ancestry validity separately from value symmetry.
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=1

Every nonroot node has a valid parent, and mirror pairs match in both presence and value at each level.

What to cover

Requirements

  1. 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.
  2. Require a valid root for a nonempty tree and a valid parent for every valid nonroot node.
  3. Compare every same-level mirror pair for both presence and value without reading invalid-node data.
  4. Return a fixed malformed-input result and require one bounded completion unless reset cancels it.
Continue practicing

Related questions

Reference ModelsTrack named bin hits→Reference ModelsModel a recent-ID replay stream→Reference ModelsVerify a minimum energy-window engine→
asic.fyi · Learn silicon end to end.info@asic.fyi