I am relatively new to UVM, and I'm trying to think through the architecture of a transaction. Assume that in this case, I have the ability to modify the object under discussion directly.
I have a transaction that includes a payload and a CRC. I'd like to be able to run tests where the payload or the CRC is corrupted, but only sometimes.
It seems I have at least two choices. The CRC would get generated at the creation time for the packet. I could have a randomized boolean, bad_crc, that corrupts one or more bits of the CRC during creation. Normally this would be constrained to FALSE. On a test-by-test basis, this could be shaped by overriding the constraint.
But, I could also extend the class and call it bad_crc_packet_tx, with its own "new" function that mangles the CRC.
I could also envision even weirder ways to get the same functionality, and there may be a better one.
Any advice on standard UVM practice, benefits to either approach, or better approaches than those two?