Parity
8-Bit Even/Odd Parity Bit Generator — L1 Upgrade
Generates even parity for 8-bit data and latches a sticky error flag for odd parity occurrences.
About this block
Simulate it in the Verilog IDE
8-Bit Even/Odd Parity Bit Generator — L1 Upgrade is a Verilog reference block in the Parity catalog. Even/odd parity generators, checkers, and error-detection helpers. Marked Medium: more state or a wider datapath, still one workspace in the IDE.
This IP core generates an even parity bit for 8-bit data streams and includes a sticky error flag to detect odd parity conditions. Designed for Level 1 upgrade scenarios, it provides simple, low-latency error detection.
The module uses combinational logic for parity calculation and sequential logic for data latching and error flag management. The sticky error persists until explicitly cleared via a synchronous signal (clear_sticky) or an asynchronous reset (rst_n), ensuring transient faults are not missed.
- Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit Even/Odd Parity Bit Generator — L1 Upgrade.
- Read the Verilog module in the editor. The catalog line for this block: Generates even parity for 8-bit data and latches a sticky error flag for odd parity occurrences.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- 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.
Architecture
The design comprises two main parts:
- Combinational Parity Logic: Computes the XOR reduction of the 8-bit input data immediately.
- Sequential Output Registers: Latches the input data and valid signal on the rising clock edge. It also manages the sticky error flag.
### Block Diagram
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input for sequential logic |
rst_n | Input | 1 | Active-low asynchronous reset |
valid_in | Input | 1 | Valid input data strobe |
data_in | Input | 8 | 8-bit data input |
clear_sticky | Input | 1 | Synchronous clear for sticky error. Effective when valid_in is low or on reset. |
valid_out | Output | 1 | Valid output data strobe |
data_out | Output | 8 | Output data (latched from data_in) |
parity_bit | Output | 1 | Calculated parity (0=even, 1=odd) |
sticky_error | Output | 1 | Latched error flag for odd parity |
Integration
- Clock Domain: The module operates on a single clock domain (
clk). - Reset:
rst_nis asynchronous and active-low. Ensure reset deassertion is synchronized if crossing clock domains. - Latency:
- parity_bit: Zero combinational latency (combinational output). - data_out / valid_out: 1-cycle latency. - sticky_error: Updates 1 cycle after the error condition is detected on valid_in.
- Clearing Sticky Error: The
clear_stickysignal clears the error flag synchronously.
- Important: In the current implementation, the sticky error is only cleared if valid_in is low at the time of the clear request, or if rst_n is asserted. This prevents clearing the error flag during active data transfer to ensure data integrity tracking.
More in Parity
- 4-Bit Parity OK Checker (XOR vs Type) — L1 Upgrade — L2 Upgrade
- 8-Bit Parity Error Counter with Accumulator — L2 Upgrade
- 8-Bit Parity Generator (Muxed Even/Odd)
- Byte-Strobe Parity Scrub 32-bit — L2 Upgrade
- Even Parity over 16-Bit Bus — L1 Upgrade — L2 Upgrade
- Hamming Distance 8-Bit — L1 Upgrade
- Odd/Even Parity Select 8-bit — L1 Upgrade — L2 Upgrade
- Parity Byte Checker 8-Bit — L1 Upgrade — L2 Upgrade
- Parity Invert-Select 8-bit — L1 Upgrade — L2 Upgrade
- Parity-Protected 8-Bit Register — L2 Upgrade
- SECDED Hamming Check (13,8)
- SECDED Nibble Syndrome (toy) — L2 Upgrade
- Sticky Parity Error Flag 8-Bit — L1 Upgrade
- XOR-Reduce Parity Tree 16-bit