Hardware interview practice
Compare transactions with useful messages
Compare expected and actual transactions. Return an empty string when they match, otherwise return a human-readable list of mismatched fields.
Reviewed example
Work through one case
Input
expected=(id=7,addr=0x10,data=16'hA5XZ); actual=(id=8,addr=0x14,data=16'hA5X1)Expected output
message reports mismatches for id, addr, and dataThe comparator accumulates all three field mismatches and uses case inequality so a four-state data difference is not hidden.
What to cover
Requirements
- Report every mismatch, not just the first.
- Use case inequality to expose X or Z differences.
- Include expected and actual values.
