RTL Studio Open IDE

Parity

SECDED Hamming Check (13,8)

Single Error Correction Double Error Detection Hamming check for 13-bit codewords.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

SECDED Hamming Check (13,8) is a Verilog reference block in the Parity catalog. Even/odd parity generators, checkers, and error-detection helpers. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.

This IP implements a Single Error Correction Double Error Detection (SECDED) Hamming check for 13-bit codewords. It accepts 8-bit data and a 5-bit syndrome as inputs. The module determines if a single-bit error or double-bit error has occurred based on the syndrome value and outputs corrected data if a single-bit error is detected.

Note: This implementation assumes a specific mapping where the lower 4 bits of the syndrome directly indicate the bit position within the 8-bit data word for correction. This is a simplified model. For standard Hamming codes, the syndrome typically maps to the full 13-bit codeword position.

This IP provides a lightweight, combinational SECDED check mechanism for 13-bit codewords. It is suitable for memory systems or data paths requiring basic error detection and correction. The implementation relies on direct syndrome bit mapping for simplicity.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for SECDED Hamming Check (13,8).
  2. Read the Verilog module in the editor. The catalog line for this block: Single Error Correction Double Error Detection Hamming check for 13-bit codewords.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Features

  • Supports SECDED logic for 13-bit codewords (8 data bits + 5 parity/syndrome bits).
  • Detects single-bit errors and corrects them automatically.
  • Detects double-bit errors without attempting correction.
  • Identifies valid codewords with no errors.
  • Simple combinational logic implementation.

Interface

Signal NameDirectionWidthDescription
data_inInput[7:0]Original data input
syndrome_inInput[4:0]Syndrome input including parity bit
sec_errOutput1Single Error Correction flag
ded_errOutput1Double Error Detection flag
data_outOutput[7:0]Corrected data output

Architecture

The module operates as follows:

The core logic evaluates the syndrome input:

  • If the syndrome is zero, no error is present.
  • If the syndrome is non-zero and the parity bit (bit 4) is zero, a single-bit error is indicated.
  • If the syndrome is non-zero and the parity bit (bit 4) is one, a double-bit error is indicated.
  • For single-bit errors, the data is corrected by XORing with the lower 4 bits of the syndrome.

Verification

The testbench verifies the following scenarios:

Test CaseDescriptionExpected Result
TC1No error (syndrome 0)sec_err=0, ded_err=0, data_out=data_in
TC2Single bit error (syndrome 1)sec_err=1, ded_err=0, data_out=corrected
TC3Double bit error (syndrome with parity bit set)sec_err=0, ded_err=1, data_out=data_in

All test cases passed in simulation.

More in Parity

All Parity blocks