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. data is a random dynamic array of 1 to 8 bytes, and gap is a random array of the same size, where gap[i] (0 to 2) is the number of idle clocks before byte i. Make gap 0 common, and the corner byte values 0x00 and 0xFF much more common than one in 256.
  • crc_seq: sends count random packets.
  • crc_driver: waits out reset, then for each packet drives the bytes one at a time: wait gap[i] clocks, present the byte for exactly one clock with valid 1, and set last on the final byte only. With every gap 0, packets go back to back, with no idle clock between them.
  • crc_scoreboard: for each packet the monitor reports, computes the CRC-8 of data and compares it with crc. Count packets in checked and mismatches in errors; report the first few with uvm_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.