Verification #68 · 2026-11-30 · UVM · Medium · about 30 min
Check a streaming CRC engine
crc8.sv is a streaming CRC-8 engine: polynomial 0x07 (x^8 + x^2 + x + 1), MSB first, initial value 0, no final XOR. A byte is accepted on any rising clock edge where valid is 1, and last marks the final byte of a packet. One clock after the edge that accepted the last byte, crc_valid is 1 for one clock and crc holds the CRC of the whole packet. The next packet starts again from 0. valid may drop for any number of clocks in the middle of a packet.
Write the verification components in components.sv. The monitor and environment in env.sv are provided, and they use your four classes by name:
crc_item: one packet.datais a random dynamic array of 1 to 8 bytes, andgapis a random array of the same size, wheregap[i](0 to 2) is the number of idle clocks before bytei. Makegap0 common, and the corner byte values 0x00 and 0xFF much more common than one in 256.crc_seq: sendscountrandom packets.crc_driver: waits out reset, then for each packet drives the bytes one at a time: waitgap[i]clocks, present the byte for exactly one clock withvalid1, and setlaston the final byte only. With everygap0, packets go back to back, with no idle clock between them.crc_scoreboard: for each packet the monitor reports, computes the CRC-8 ofdataand compares it withcrc. Count packets incheckedand mismatches inerrors; report the first few withuvm_error.
Run uses tb.sv: 50 random packets into the correct engine. Submit runs your testbench against the correct engine and against four faulty ones. Your scoreboard must stay quiet on the first and catch each of the others.
Write and run your answer in the browser. The hidden tests check it, and it’s free.