one-hot
A set of bits with only a single high (1) bit, with the remaining bits low (0).
one-hot: binary encoding where exactly one bit is always 1
One-hot is a method of representing a discrete state or value using a group of bits, where exactly one bit is set to logic level 1 (high) and all others are 0 (low). If you have n possible states, you need n bits to represent them. For example, a 4-bit one-hot code for selecting one of four states might look like 0001, 0010, 0100, or 1000, depending on which state is active.
One-hot encoding differs fundamentally from binary counting. Standard binary uses the minimum number of bits (for four states, just 2 bits suffice: 00, 01, 10, 11), but forces you to decode the result. One-hot uses more wires or flip-flops but eliminates decoding overhead. A decoder circuit or logic gates are needed to generate one-hot from standard binary, or to convert one-hot back to another format.
Common applications in control and selection
One-hot shines in multiplexer control, state machine design, and priority encoding. In a multiplexer selecting one of eight input lines, one-hot control signals map directly to the selection gates with minimal logic delay. Priority encoders often output one-hot to identify which interrupt line asserted first. Field-programmable gate arrays (FPGAs) and asynchronous state machines favour one-hot because the hardware directly represents the concept: only one thing is true at a time.
The main disadvantage is resource consumption. A one-hot representation wastes bits compared to binary; representing 256 states requires 256 one-hot bits but only 8 binary bits. In large designs, this translates to more interconnect, more power, and more silicon area. Detection circuits must also guarantee that corrupted states (no bits set, or multiple bits set) are handled safely.
The term originates from the idea that the encoding contains exactly one "hot" (active, high) signal at any moment. In hardware design, one-hot simplifies timing and decoding at the cost of width, making it the preferred choice when speed and clarity matter more than code density.