RTL Studio Open IDE

Shift & Bit Manipulation

8-Bit Bit Reversal (Endianness Swap) — L1 Upgrade — L2 Upgrade

8-bit bit reversal module with parallel and serial input modes and registered output.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

8-Bit Bit Reversal (Endianness Swap) — L1 Upgrade — L2 Upgrade is a Verilog reference block in the Shift & Bit Manipulation catalog. Shifters, rotators, bit masks, and bitwise manipulation blocks. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This OpenIP provides a configurable 8-bit bit reversal module with support for both parallel and serial data inputs.

It is designed for high-speed digital systems requiring endianness conversion or serial-to-parallel data alignment.

The module features registered outputs for stable timing, asynchronous reset, and mode selection between immediate parallel swapping and 8-cycle serial accumulation.

  1. Parallel Mode: Instantly reverses the bit order of data_in upon enable assertion.
  2. Serial Mode: Accumulates 8 bits from serial_in (LSB first) over 8 clock cycles, then outputs the reversed result.
  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit Bit Reversal (Endianness Swap) — L1 Upgrade — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 8-bit bit reversal module with parallel and serial input modes and registered output.
  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 standard byte-sized data.
  • Dual Input Modes:

- Parallel: Immediate bit reversal with 1-cycle latency. - Serial: Shift-register accumulation over 8 cycles.

  • Registered Output: Ensures setup/hold time compliance in synchronous designs.
  • Control Signals:

- rst_n: Active-low asynchronous reset. - en: Enable signal to process data. - mode: Selects between Parallel (0) and Serial (1) operation.

Ports

Port NameDirectionWidthDescription
clkInput1System clock
rst_nInput1Active-low asynchronous reset
enInput1Enable signal (High = Process)
modeInput1Mode Select (0=Parallel, 1=Serial)
data_inInput[7:0]Parallel data input
serial_inInput1Serial data input (LSB first)
valid_outOutput1Output valid flag
data_outOutput[7:0]Reversed/swapped data output

Architecture

The module utilizes a shift register for serial accumulation and combinational logic for parallel swapping.

  • Parallel Path: Uses a continuous assignment to reverse bit order. When mode is 0, the swapped data is loaded into the output register on the next clock edge.
  • Serial Path: When mode is 1, bits shift into a register. A 3-bit counter tracks the 8 cycles. After 8 cycles, the accumulated data is loaded into the output register, and valid_out is asserted.

Verification

The included testbench verifies parallel swapping, serial shifting, valid flag behavior, and reset conditions. All test cases passed successfully.

Test CaseDescriptionResult
TC1Parallel Swap 0xAA -> 0x55PASS
TC2Parallel Swap 0xF0 -> 0x0FPASS
TC3Parallel Swap 0x00 -> 0x00PASS
TC4Serial Shift Data 0x55PASS
TC5Serial Valid Flag EarlyPASS
TC6Disable ValidPASS
TC7Reset DataPASS

More in Shift & Bit Manipulation

All Shift & Bit Manipulation blocks