DexterLab

🎂 🎉 🎈 🤖 💡 📈 🧱 ⭐ 🥂DexterLab turns one year old 🎂 🎉 🎈 🤖 💡 📈 🧱 ⭐ 🥂🔥 New release: DexterLab Parser AXI‑Lite Documentation Suite (2026 Edition)🔥 AXI‑Full Edition updated — unified command interface + full docs🔥 Roadmap updated: AHB‑Full/Lite + AXI‑Full→AHB‑Full bridge in development📘 Unified command architecture — new documentation planned📘 Timing diagrams and bus models expanding with AXI‑Lite & AHB support📘 Theory ↔ Design Library integration continues across all backends

CRC – Verification & Test Vectors

Verification is a critical part of any CRC implementation. Even small differences in reflection rules, initialization values, or final XOR settings can cause mismatches between hardware and reference models. This page provides standard test vectors, verification strategies, and guidelines for validating both serial and parallel CRC implementations.

1. Why Verification Matters

CRC implementations differ across protocols because of:

  • generator polynomial
  • initial value
  • final XOR
  • input and output reflection
  • bit ordering (LSB-first vs MSB-first)
  • parallel width (4, 8, 16, 32 bits)

Two CRCs with the same width may produce completely different results. Verification ensures that:

  • the RTL matches the intended CRC variant
  • parallel equations are correct
  • reflection and XOR rules are applied properly
  • the implementation is compatible with protocol specifications

2. Standard Test Vector: “123456789”

The ASCII string:

“123456789”

is the universal test vector used to validate CRC implementations.
It is recommended because:

  • it exercises a wide range of bit transitions
  • it is short and easy to reproduce
  • reference values exist for all common CRCs

3. Reference Results for Common CRCs

CRC VariantExpected Result for “123456789”
CRC-8 ATM0xF4
CRC-8 Maxim0xA1
CRC-16 IBM0xBB3D
CRC-16 CCITT (0xFFFF init)0x29B1
CRC-16 USB0xB4C8
CRC-32 Ethernet0xCBF43926
CRC-32 Castagnoli0xE3069283
CRC-32 MPEG-20x0376E6E7
CRC-64 ECMA0x6C40DF5F0B497347

These values are essential for validating both serial and parallel implementations.

4. Verification Strategy

A robust verification flow includes:

  • Golden model
    A software reference (Python, C, MATLAB) implementing the exact CRC variant.
  • Serial RTL model
    Used as a reference for parallel versions.
  • Parallel RTL model
    The implementation under test (4‑bit, 8‑bit, 32‑bit).
  • Self-checking testbench
    Compares RTL output with golden model output.
  • Randomized testing
    Random frames of varying lengths.
  • Corner cases
  • empty frame
  • single byte
  • all zeros
  • all ones
  • alternating patterns

5. Python Reference Model (Golden Model)

A minimal Python implementation for CRC‑32 Ethernet:

def crc32_eth(data):
    crc = 0xFFFFFFFF
    for b in data:
        crc ^= b
        for _ in range(8):
            if crc & 1:
                crc = (crc >> 1) ^ 0xEDB88320
            else:
                crc >>= 1
    return crc ^ 0xFFFFFFFF

This model is ideal for generating test vectors and validating RTL.

6. Testbench Guidelines

A typical VHDL or SystemVerilog testbench should:

  • feed bytes into the CRC block with data_valid = 1
  • assert data_last on the final byte
  • capture crc_out when crc_valid = 1
  • compare against the golden model
  • report mismatches with full context

For parallel CRCs:

  • test all possible byte alignments
  • test multiple frame lengths
  • test back‑to‑back frames

7. Debugging Common Issues

Most CRC mismatches come from:

  • incorrect reflection (RefIn / RefOut)
  • wrong initial value
  • missing final XOR
  • incorrect bit ordering
  • wrong polynomial representation
  • incorrect unrolling of parallel equations

Reflection errors are the most frequent cause of failure.

8. Related Pages