RTL Studio Open IDE

Code Conversion

Pipelined Gray↔Binary Register 8-bit

Synchronous 8-bit register performing bidirectional Gray code and Binary code conversion with enable and reset controls.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Pipelined Gray↔Binary Register 8-bit is a Verilog reference block in the Code Conversion catalog. Encoders, decoders, priority encoders, and binary/gray converters. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

A synchronous 8-bit register IP core that performs bidirectional conversion between Gray code and Binary code. Designed for low-latency applications requiring error-resistant data transmission or position sensing.

This IP provides a verified, pipelined method for converting between 8-bit Gray and Binary codes.

It supports configurable direction via a mode control signal, synchronous enable, and active-low reset.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Pipelined Gray↔Binary Register 8-bit.
  2. Read the Verilog module in the editor. The catalog line for this block: Synchronous 8-bit register performing bidirectional Gray code and Binary code conversion with enable and reset controls.
  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

  • Bidirectional Conversion: Converts Gray-to-Binary and Binary-to-Gray.
  • Pipelined Architecture: Combinatorial logic followed by registered outputs for improved timing.
  • Control Signals: Synchronous enable (en) and active-low synchronous reset (rst_n).
  • Configurable Mode: Single bit (mode) selects input/output direction.
  • Verified: Fully simulated with Icarus Verilog.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset input
enInput1Synchronous enable input
gray_inInput[7:0]Gray code input data
bin_inInput[7:0]Binary code input data
modeInput1Conversion mode select (0: Gray->Bin, 1: Bin->Gray)
bin_outOutput[7:0]Binary code output data
gray_outOutput[7:0]Gray code output data

Architecture

The module consists of two parallel combinatorial conversion blocks and a registered output stage. The mode signal selects which input path is active and which output is driven.

Integration

### Instantiation

### Simulation

To run the simulation, ensure Icarus Verilog is installed.

Verification

The testbench covers reset behavior, enable bubbles, and multiple conversion cases for both modes. All test cases passed successfully in the simulation run.

Test CaseDescriptionResult
TC1a-eGray to Binary conversionsPASS
TC2a-eBinary to Gray conversionsPASS
TC3a-cEnable hold and re-enable checksPASS
TC4aReset behavior checkPASS

More in Code Conversion

All Code Conversion blocks