Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to avoid illegal state with one-hot encoding?

Status
Not open for further replies.
The occurance of illegal state in one-hot coding is quite low. However, the design of state-machine with one-hot code will consume a lot of logic. According to simplicity recommendation of state-machine design, if the number of states are less then 5, use binary code; if between 24 and 5, use one-hot; if more than 24, use gray code. Of course you need to consider the target device that you are using, either as cpld or fpga.
 

Read this, it's cover your question...
For Verilog
**broken link removed**
For VHDL
**broken link removed**
 

cawan said:
The occurance of illegal state in one-hot coding is quite low...

According to (1)
...
“Safe” State Machines
If the number of states (N) is a power of 2, and you use a binary or gray-code encoding algorithm, the state machine is “safe”. This ensures that you have M number of registers where N = 2M. Because all of the possible state values (or register statuses) are reachable, the design is “safe.”

“Unsafe” State Machines
If the number of states is not a power of 2, or if you do not use binary or gray-code encoding algorithm, e.g. one-hot, the state machine is “unsafe.”
...

According (2)

... a 14-state state machine-implemented with a binary encoding scheme requires four state bits, for a total of 16 possible states. In this case, the state machine has only two possible illegal states. One-hot-encoded state machines, however, generally have more potential illegal states. A 14-state one-hot encoded state machine requires 14 state bits. The number of illegal states for a one-hot encoded state machine is determined by the equation (2")-n, where n equals the number of states in the state machine. Therefore, a 14-state state machine with one-hot encoding has 16,370 possible illegal states. However, as long as vour design does not violate the setup or hold time of the state bit registers, your state machine should not enter an illegal state...
 

The occurance of illegal state in one-hot coding is so low. Just for this, use defaut/others language.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top