![]() If the FSM has an arbitrary set of state transitions or is expected to run at high frequencies, maybe one-hot encoding is the way to go.If the FSM cycles through its states in one path (like a counter) then Gray code is a very good choice.If a very simple system yields very similar results across encodings, then the original encoding is the best choice.This is a tough question, mostly because each encoding has its benefits and shortcomings, so it comes down to an optimization problem that depends on a large number of factors. The bits are the states.įor more on state encodings, you may want to check out the article Encoding the States of a Finite State Machine in VHDL by Steve Arar. However, one-hot encoding is very good at simplifying the stimulus logic for the flip flops because there’s no need to decode the states. This may not seem very efficient at first because of the number of bits used, and the excessive number of invalid states. Image from Marie Christianoįinally, one-hot encoding consists in using one bit representing each state, so that at any point in time, a state will be encoded as a 1 in the bit that represents the current state, and 0 in all other bits. In addition to also using the minimum number of bits, this encoding minimizes dynamic power consumption if the sequence of states is followed optimally. Gray code consists of a sequence where only one bit changes between one value and the next. This way, you are using as few bits as possible to encode your states.Īn example of one-hot encoding. The three most popular encodings for FSM states are binary, Gray, and one-hot.īinary encoding is the straightforward method you may intuitively use when you assign values sequentially to your states. If you’d like to brush up on implementing state machines in Verilog, you should read my article titled Creating Finite State Machines in Verilog.Įncoding of States: Gray vs. It doesn’t matter if you carefully selected and specified the values that implement your states in your source code, the synthesis tool may replace those values with others that may even have a different bit length than your original encoding. That’s why synthesis tools often inspect your code to detect FSMs and perform optimizations that may modify the encoding of the states. ![]() Finite state machines (FSMs) are a very common part of nearly every digital system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |