RTL Studio Open IDE

Coding & Line Codes

NRZI to NRZ Decoder

Converts NRZI encoded signals to standard NRZ format by detecting transitions.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

NRZI to NRZ Decoder is a Verilog reference block in the Coding & Line Codes catalog. Line codes, serializers, and digital encoding/decoding blocks. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.

This IP core implements a lightweight, synchronous NRZI (Non-Return-to-Zero Inverted) to NRZ decoder.

It converts NRZI encoded signals into standard NRZ format by toggling the output on input transitions.

The design is optimized for area efficiency, requiring only a single flip-flop for state retention, making it ideal for high-speed serial interfaces and area-constrained FPGA designs.

  • Logic High (1) on nrzi_in: Indicates a transition (toggle).
  • Logic Low (0) on nrzi_in: Indicates no transition (hold).
  1. Choose Open in IDE. RTL Studio loads the packaged workspace for NRZI to NRZ Decoder.
  2. Read the Verilog module in the editor. The catalog line for this block: Converts NRZI encoded signals to standard NRZ format by detecting transitions.
  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.

Architecture

The design utilizes a single synchronous flip-flop to store the previous input state (prev_nrzi). The output logic is defined as:

$$ nrz_{out}[n] = nrz_{out}[n-1] \oplus nrzi_{in}[n] $$

This means the output toggles when nrzi_in is high and holds its value when nrzi_in is low.

Interface

SignalDirectionWidthDescription
clkInput1System clock input
rst_nInput1Active-low asynchronous reset
nrzi_inInput1NRZI encoded data input
nrz_outOutput1Decoded NRZ data output

Verification

The provided testbench (tb_nrzi_to_nrz_decoder) validates the following scenarios:

Test CaseDescriptionExpected Result
TC1Reset CheckOutput is 0 after reset
TC2Known SequenceCorrect decoding of 1, 0, 1, 0, 1
TC3All ZerosOutput holds previous state
TC4All OnesOutput toggles every cycle

### Running Simulation

  1. Compile the RTL and testbench.
  2. Run the simulation.
  3. Check the log for PASS messages corresponding to each test case.

More in Coding & Line Codes

All Coding & Line Codes blocks