Hardware Reference
In-Depth Information
3.7.2 One-Hot Encoding
At the other extreme is the one-hot code, in which only one bit is high in each code-
word, so with N l ip-l ops only N states can be encoded (see i gure 3.9a). For the type
state above, i ve bits would be needed, resulting in A = “00001”, B = “00010”, C =
“00100”, D = “01000”, and E = “10000”.
This code demands the largest number of l ip-l ops, but the amount of combi-
national logic tends to be smaller than that of other encodings (illustrated in
exercise 3.2), often leading to a slightly faster implementation. For big machines
(say, over 40 or 50 states), the hardware for this type of encoding tends to be
prohibitively large.
Just to illustrate the one-hot code, i gure 3.9d depicts a one-hot counter, which
consists simply of a shift register with a direct feedback loop. Note that the initial state
is q 3 q 2 q 1 q 0 = “0001” because the reset signal is connected to the reset port of three DFFs
and to the preset port of the other.
3.7.3 Johnson Encoding
This is an implementation in between the two above. With N l ip-l ops, 2 N states can
be encoded (see i gure 3.9a). It does not require much more combinational logic than
the one-hot alternative, but it can encode twice the number of states. Each codeword
is obtained by circularly shifting the previous codeword to the left and inverting the
incoming bit. For the type state above, three bits would be needed, resulting A = “000”,
B = “001”, C = “011”, D = “111”, and E = “110”.
Just to illustrate the Johnson code, a Johnson counter is depicted in i gure 3.9c,
which consists simply of a shift register with an inverter in the feedback loop.
An important property of this code is that the Hamming distance (number of bits
that are different) between any two adjacent codewords is just 1 (see i gure 3.9a), so
it can be useful in the same applications as the Gray code, described below.
3.7.4 Gray Encoding
Gray code is similar to the sequential code in the sense that it too requires the least
number of l ip-l ops (with N l ip-l ops, up to 2 N states can be encoded), but the amount
of combinational logic can be slightly larger (illustrated in exercise 3.3) and the speed
slightly lower.
This code too exhibits the property of unitary Hamming distance between any
two adjacent codewords, useful in certain implementations involving multiple
clock domains (recall comments of section 2.3). Because of this property, a Gray
counter is free from glitches during state transitions (except when returning to the
initial state if the counter's modulo is not a power of 2); consequently, if a Gray-
encoded FSM has a long path without branching, transitions along that path are
glitch-free.
Search WWH ::




Custom Search