RTL Studio Open IDE

Shift & Bit Manipulation

Nibble Interleave / Deinterleave 16-bit — L2 Upgrade

A 16-bit nibble interleave module that reverses nibble order with skid buffer support for backpressure handling.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Nibble Interleave / Deinterleave 16-bit — 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 IP provides a robust nibble interleaving solution for 16-bit data paths. It handles backpressure gracefully using a skid buffer. The design is simple and easy to integrate into larger systems. It is suitable for applications requiring data reordering.

This IP implements a 16-bit nibble interleave (reverse) function, rearranging four 4-bit nibbles from input order (N3 N2 N1 N0) to output order (N0 N1 N2 N3). It supports backpressure via a skid buffer for flow control and is designed for L2 difficulty verification and synthesis.

The design is fully synchronous with an active-low reset and has been verified using Icarus Verilog.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Nibble Interleave / Deinterleave 16-bit — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: A 16-bit nibble interleave module that reverses nibble order with skid buffer support for backpressure handling.
  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

  • Nibble Reversal: Reverses nibble order in a 16-bit data word (N3N2N1N0 -> N0N1N2N3).
  • Flow Control: Supports valid/ready handshaking protocol.
  • Backpressure Handling: Includes a skid buffer to hold data when the output is not ready.
  • Synchronous Design: Fully synchronous with active-low reset.
  • Verification: Verified with Icarus Verilog testbench covering basic functionality and backpressure scenarios.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
in_validInput1Input data valid signal
in_dataInput16Input data bus
in_readyOutput1Input ready signal
out_validOutput1Output data valid signal
out_dataOutput16Output data bus
out_readyInput1Output ready signal

Architecture

The design uses a three-state finite state machine (FSM).

  • IDLE: Waits for valid input data.
  • SHIFT: Prepares the data for output by shifting/rotating nibbles.
  • OUTPUT: Drives the output valid signal.

A skid buffer stores data when the output is not ready (out_ready is low). The output data is generated combinatorially from either the shift register (if no skid data) or the skid buffer (if data is pending).

Verification

The testbench verifies basic functionality and backpressure handling. It checks nibble reversal for various input patterns and ensures the skid buffer correctly holds data during backpressure, resuming correctly after backpressure is released.

### Test Cases

Test CaseDescriptionExpected ResultStatus
TC1Basic Nibble Reverse0xABCD -> 0xDCBAPASS
TC2Skid Buffer BackpressureData held until out_readyPASS
TC3Multiple Words0x5678 -> 0x8765PASS
TC4Zero Input0x0000 -> 0x0000PASS
TC5Skid OverflowBackpressure on second wordPASS

### Simulation Log

After Run Simulation, the Log panel should show:

  • TC1 PASS out_data=DCBA
  • TC2 PASS out_data=4321 (skid pending)
  • TC2 PASS skid consumed
  • TC3 PASS out_data=8765
  • TC4 PASS out_data=0000
  • TC5a PASS in_ready=0 (skid full)
  • TC5b PASS out_data=AAAA
  • TC5c PASS out_data=BBBB

More in Shift & Bit Manipulation

All Shift & Bit Manipulation blocks