Elysia Tools

Browse tools, examples, visual explainers, and topic guides from one clear workspace.

Top Categories

Hubs

Language
ZHESPTRUFRDEEN

Elysia Tools

Navigation

Development

Gray Code and Thermometer BCD Encoder Visualizer

· Last updated:2026-09-20

Convert an N-bit value to binary, Gray, one-hot and thermometer codes with a counting truth table, Hamming-distance chart and Verilog/VHDL encoder stubs.

Details

What this tool helps you do

A digital-design visualizer for binary-code alternatives on words of 2–6 bits.

Encodings produced simultaneously for the chosen value: plain binary; Gray/reflected code (G = B XOR (B >> 1), the unit-distance code whose adjacent values — including the wrap — differ in exactly one bit); one-hot (2ⁿ bits, a single 1); and thermometer/unary (2ⁿ−1 bits, MSB-aligned, the native flash-ADC comparator output).

The Hamming-distance chart walks every counting transition and shows the hazard directly: binary flips up to all n bits at carry boundaries (0111→1000), Gray and thermometer never flip more than one bit, one-hot always flips exactly two. A full counting truth table doubles as the Karnaugh-map axis order and rotary-encoder disc pattern.

Ready-to-paste HDL stubs: parameterized Verilog and VHDL modules with binary→Gray (XOR), binary→one-hot (sized shift), binary→thermometer (MSB-aligned unary shift), and the Gray→binary cascading-XOR decoder.

Execution

Run this tool

Fill in the form, run the tool, and review the result in one place.

Samples

Examples that match this tool

Related

Continue with connected tools and hubs

Written by the Elysia Tools team

Tool usage guide

Learn when to use this tool, what it supports, and how real users apply it.

Key facts

Category
Development
Input types
select, number, checkbox
Output type
html
Sample coverage
4
API ready
Yes

Overview

The Gray Code and Thermometer BCD Encoder Visualizer converts 2-to-6-bit integer values into standard binary, Gray (reflected), one-hot, and thermometer encodings simultaneously. It visualizes bit-transition hazards across carry boundaries, plots Hamming distances across the full count range, and generates synthesizable Verilog and VHDL encoder and decoder logic.

When to use

  • Designing asynchronous FIFO pointers or clock domain crossing logic that require unit-distance Gray codes to eliminate multi-bit sampling glitches.
  • Modeling flash ADC comparator outputs and verifying thermometer-to-binary or thermometer-to-Gray encoder logic.
  • Evaluating state machine encoding schemes to compare bit-switching activity and Hamming distances between binary, one-hot, and Gray implementations.

How it works

  1. 1Select the word width between 2 and 6 bits and enter the decimal value to convert.
  2. 2Choose the desired HDL stub language (Verilog, VHDL, or both) and toggle the full counting sequence table option.
  3. 3Inspect the resulting binary, Gray, one-hot, and thermometer codes alongside transition bit flips, the Hamming-distance chart, and synthesizable HDL modules.

Use cases

  • Asynchronous FIFO pointer synchronizer design and verification.
  • Flash ADC thermometer code conversion and decoder logic drafting.
  • Rotary encoder disc layout mapping and unit-distance transition analysis.

Examples

1. 4-Bit Value 11 Multi-Encoding Inspection

FPGA Design Engineer

Background

An engineer needs to design a dual-clock FIFO pointer and verify the 4-bit binary-to-Gray conversion mapping for decimal 11.

Problem

Verify binary, Gray, one-hot, and thermometer representations for value 11 and export HDL conversion modules.

How to use

Select 4 bits, input value 11, set HDL Stub Language to Both, and enable the full counting sequence table.

bits: 4, value: 11, outputLanguage: both, showFullSequence: true

Outcome

Displays binary 1011, Gray 1110, one-hot 0000100000000000, and thermometer 111111111110000 with complete Verilog and VHDL stubs.

2. Carry Boundary Hazard Analysis at 7 to 8

Digital Logic Student

Background

A student is analyzing switching hazards and Hamming distance spikes across counter rollover boundaries.

Problem

Demonstrate the multi-bit glitch risk when stepping from 7 to 8 in binary versus unit-distance Gray code.

How to use

Set word width to 4 bits, enter input value 8, and select Verilog output to examine the 7-to-8 transition.

FAQ

What word widths does the visualizer support?

The visualizer supports word widths from 2 bits (values 0–3) up to 6 bits (values 0–63).

Why do Gray and thermometer codes prevent multi-bit switching hazards?

Adjacent values in Gray and thermometer codes differ by only one bit per step (Hamming distance of 1), preventing intermediate sampling errors at counter boundaries.

How is binary converted to Gray code?

Binary values are converted to Gray code using the standard bitwise equation G = B XOR (B >> 1).

What is the difference between one-hot and thermometer encoding?

One-hot sets exactly one active high bit across 2ⁿ bit positions, while thermometer code fills an MSB-aligned continuous run of 1s across 2ⁿ−1 bits.

What HDL code templates are provided?

The tool outputs parameterized Verilog and VHDL modules for binary-to-Gray, binary-to-one-hot, binary-to-thermometer encoders, and cascading XOR Gray-to-binary decoders.

Home
Tools3201
Samples593
Visualizations465
Viewers103
Hubs233
Tags333
Images, Audio & Video657

Image, audio, and video processing, conversion, and optimization tools

Math, Date & Finance644

Calculators, numerics, date logic, statistics, and finance tools

Design & Color297

Color, layout, graphics, visual styling, and design helper tools

Text & Writing209

Writing, cleanup, formatting, extraction, and text analysis tools

Developer & Web193

Developer utilities, networking, web debugging, and automation helpers

Conversion & Encoding175

Format, file, archive, unit, and encoding conversion tools

FLAC/WAV Source Screening and Evidence Handoff
Self-Hosted Giveaway Widget Review and Embed Handoff
Stripe Promo Code Batch Review and Import Preflight
Batch Photo Culling Review and Editing Shortlist Handoff
UI Screenshot Structure Review and Development Handoff

© 2026 Elysia Tools. All rights reserved.

DocsPricingAboutTerms of ServicePrivacy PolicyCookiesContact
Media

QR Code Samples

Sample QR code images for testing QR code reading and generation tools

Code Processing

Code Comment Samples

Sample code files with various comment styles for testing comment removal

Python

Web Image Processing Python Samples

Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion

Development

Code Viewer Samples

Sample long-tail code and config files (shell, Vue, C++, TOML, Graphviz) for the in-browser Code Viewer

Development

Tailwind Color Palette Sync

Generate theme.extend.colors for tailwind.config.ts from HEX colors, with WCAG contrast levels and optional dark mode.

Text Processing

Extended Text Base Codecs (Base65536 + netstring)

Encode and decode with less-common text codecs: Base65536 (binary → dense Unicode) and netstring (self-delimiting framing). Base85 is intentionally not rebuilt (already covered).

Development

cURL to Go (net/http) Converter

Convert a cURL command into a Go net/http code snippet with http.NewRequest, headers, and body

Development

cURL to JavaScript (axios) Converter

Convert a cURL command into a JavaScript axios code snippet with config object, headers, and data

bits: 4, value: 8, outputLanguage: verilog, showFullSequence: false

Outcome

Highlights all 4 binary bits flipping (0111 to 1000) versus only 1 bit flipping in Gray code (0100 to 1100), with the 4-bit spike mapped on the Hamming chart.