Vous êtes sur la page 1sur 2


From Wikipedia, the free encyclopedia

In digital circuits, one-hot refers to a group of bits among which the legal combinations of values are only those with a single high (1) bit and all the others low (0). [1] A similar implementation in which all bits are '1' except one '0' is sometimes called one-cold.

Binary Gray code One-hot 000 001 010 011 100 101 110 111 000 001 011 010 110 111 101 100 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000

1 Applications 2 Differences from other encoding methods

o o

2.1 Advantages 2.2 Disadvantages

3 References 4 See also

One-hot encoding is often used for indicating the state of a state machine. When using binary or gray code, a decoder is needed to determine the state. A one-hot state machine, however, does not need a decoder as the state machine is in the nth state if and only if the nth bit is high. A ring counter with fifteen sequentially-ordered states is an example of a state machine. A 'one-hot' implementation would have fifteen flip flops chained in series with the Q output of each flip flop connected to the D input of the next and the D input of the first flip flop connected to the Q output of the fifteenth flip flop. The first flip flop in the chain represents the first state, the second represents the second state, and so on to the fifteenth flip flop which represents the last state. Upon reset of the state machine all of the flip flops are reset to '0' except the first in the chain which is set to '1'. The next clock edge arriving at the flip flops advances the one 'hot' bit to the second flip flop. The 'hot' bit advances in this way until the fifteenth state after which the state machine returns to the first state. An address decoder converts from binary or gray code to one-hot representation. A priority encoder converts from one-hot representation to binary or gray code.

Differences from other encoding methods[edit]


Determining the state has a low and constant cost of accessing one flip-flop Changing the state has the constant cost of accessing two flip-flops Easy to design and modify Easy to detect illegal states Takes advantages of an FPGA's abundant flip-flops

Using a one-hot implementation typically allows a state machine to run at a faster clock rate than any other encoding of that state machine.[2]


Requires a lot more flip-flops and so is impractical for PAL devices Lots of illegal states