Enter into Zilicon Zone


RocketTheme Joomla Templates


Read more...
State machine encoding (Gray, Binary and One-hot) Print E-mail
Save this page
Delicious
YahooMyWeb
Stumble
NewsVine
Reddit
YahooMyWeb
Technorati
Each state of a state machine can be represented with a unique pattern of high (1) and low (0) register output signals, this process called "encoding." The two primary encoding methods are binary and one-hot encoding.
One-hot encoding uses one flip-flop for each state. For example if there are 10 states in logic then it will use 10 flip-flops. This type of encoding is fast because only one bit needed to check for each state. It implies complex logic and more area inside the chip due to more number of flip-flops. Check the following one hot encoded state values (for a 4 state state-machine)
                                                1000
                                                0100
                                                0010
                                                0001    
Gray encoding (a type of binary encoding) is especially useful when the outputs of the state bits are used asynchronously. This kind of state coding avoids intermediate logics. For example if a sate wants to change it’s state from "01" to "10". Here both bits are getting changed, in reality both flip-flops will not change at the same time. So there are two possibilities for this transition. Check this following diagram for the two possible transitions.
Intermediate_state
Intermediate_state
Now it is clear that there is an intermediate state exits while state transitioning. If any logic reads this state variable asynchronously then output will be unpredictable. This intermediate logic avoided by using gray code. In Gray coding; between state transitions only one bit will change. See the following gray state values there is only one bit is changing during state transition. This completely eliminates intermediate states.
                                                      00
                                                      01
                                                      11
                                                      10

Binary-encoding implements very less logic. Also it used minimum number of FFs. Possible state values for a 4 state binary state machine
                                                      00
                                                      01
                                                      10
                                                      11
State Diagram
State Diagram
Above state diagram for the logic which is used in the following examples. Here we have three examples for each type of encoding

 
VLSI-world.com