RTL Studio Open IDE

Parity

8-Bit Parity Generator (Muxed Even/Odd)

Combinational even/odd parity generator using explicit even-parity XOR and mode mux.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

8-Bit Parity Generator (Muxed Even/Odd) 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 core implements a lightweight, combinational logic module for generating an 8-bit even or odd parity bit.

It accepts an 8-bit data word and a mode selector to determine whether the output parity bit ensures an even or odd total count of 1s.

The design is fully verified, has zero-cycle latency, and is suitable for error detection in data paths.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit Parity Generator (Muxed Even/Odd).
  2. Read the Verilog module in the editor. The catalog line for this block: Combinational even/odd parity generator using explicit even-parity XOR and mode mux.
  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

  • 8-bit Data Width: Processes 8-bit input vectors.
  • Configurable Parity: Supports both Even and Odd parity modes via a single control bit.
  • Combinational Logic: Zero-cycle latency; output updates immediately with input changes.
  • Verified: Comprehensive testbench covering edge cases (all zeros, all ones, single bit set).

Ports

Port NameDirectionWidthDescription
data_inInput[7:0]8-bit input data word
parity_modeInput1Mode selector: 0=Even, 1=Odd
parity_outOutput1Computed parity bit

Architecture

The module computes the parity using a reduction XOR operation on the input data.

  1. Even Parity Calculation: The XOR of all bits in data_in is computed. If the count of 1s is even, the result is 0; if odd, the result is 1.
  2. Mode Selection:

- If parity_mode is 0, the even parity result is passed through. - If parity_mode is 1, the even parity result is inverted to produce odd parity.

Verification

The design includes a testbench (tb/tb_parity_gen_8b.v) that verifies functionality against six predefined test vectors covering all modes and edge cases.

Test Casedata_inparity_modeExpected parity_outDescription
TC10x000 (Even)00 ones is even
TC20xFF0 (Even)08 ones is even
TC30x010 (Even)11 one is odd, parity=1 makes total even
TC40x001 (Odd)10 ones is even, parity=1 makes total odd
TC50xFF1 (Odd)18 ones is even, parity=1 makes total odd
TC60x011 (Odd)01 one is odd, parity=0 keeps total odd

### Running the Simulation

To run the simulation, use your preferred Verilog simulator. For example, using Icarus Verilog:

More in Parity

All Parity blocks