Checksum-Consistent Transaction

Problem Description

Model a Transaction with a rand bit [7:0] payload[4] and a rand bit [7:0] crc. Add a constraint that forces crc to equal the XOR of all four payload bytes.

Constraints / Notes

  • payload has exactly 4 bytes, each fully random (no range restriction).

  • crc must equal XOR of payload[0], payload[1], payload[2], payload[3].

SystemVerilog

Code Editor Access

Log in to write, run and submit your solution to this interview question. It's free.

Output

Output goes here...