Bit Unstuffer (bit_unstuffer)

Zero removal bit unstuffer.

Design

Bit unstuffing is the process of removing non‑information bits that were inserted into a transmitted bitstream by a bit‑stuffing mechanism. Bit stuffing is commonly used in digital communication protocols to prevent long runs of identical bits, which can disrupt receiver synchronisation, and to ensure that reserved bit patterns used for frame delimiters cannot occur within the payload data. Typically, stuffing limits the number of consecutive bits of the same value (for example, inserting a zero after a fixed number of consecutive ones). At the receiver, a bit unstuffer detects these inserted bits and removes them, thereby reconstructing the original data exactly as it was before transmission.

Implementation

The number of consecutively received ones to remove a zero after is set by consecutive_ones_g at build time.

If a bit following consecutive_ones_g ones is a one, an internal ones counter resets but the bit is not removed.

The reset signal, rst, resets the count of previously received ones on the next rising clock edge when high.

This implementation can generate a new output every clock cycle without any clock cycle latency.

Interface

Generics

  • consecutive_ones_g (integer): Number of consecutive ones to remove a zero after.

Ports

  • clk (std_logic), in: Clock. Inputs and outputs registered on rising edge.

  • rst (std_logic), in: Reset. Active high, synchronous with rising edge of clock.

  • enable (std_logic), in: Clock Enable. Enables all processes on a rising clock edge.

  • data_valid_in (std_logic), in: Valid Input. High when data on data_in port is available.

  • data_in (std_logic), in: Data input. Binary input data.

  • data_valid_out (std_logic), out: Valid Output. High when data on data_out port is available.

  • data_out (std_logic), out: Data Output. Binary bit unstuffed output data.

Dependencies

The dependencies to other elements in OpenCPI are:

  • None.

There is also a dependency on:

  • ieee.std_logic_1164

Limitations

Limitations of bit_unstuffer are:

  • consecutive_ones_g cannot be set to zero