# Why the one-hot state encoding has an advantage in decoding compared to binary state encoding?

Before I asked the question, I've googled advantages of the one-hot state encoding compared to others such as binary and gray state encoding.

I could understand one-hot's advantages and disadvantages over others encoding scheme, such as constant hamming distance (two), fast but requiring an N flops, etc.

Many articles mentioned that the one-hot is fast and it suits high-speed design and they also mentioned the reason is that it has very small decoding time compared to gray coding and binary coding.

However, I couldn't understand why one-hot decoding is faster compared to others. For example, when we decode the one-hot encoded state machine, it could be implemented by the case statement like below

parameter STATE_ONE    = 3'b001,
STATE_TWO    = 3'b010;
STATE_THREE  = 3'b100;
parameter STATE_ONE_ID = 'd0,
STATE_TWO_ID = 'd1;
STATE_THR_ID = 'd2;
reg [2:0] states;

switch(1'b1)
states[STATE_ONE_ID]: begin end
states[STATE_TWO_ID]: begin end
...


Also for the binary encoded states we could use below code for decoding

parameter STATE_ONE   = 2'b00,
STATE_TWO   = 2'b01,
STATE_THREE = 2'b10;
case (current_state)
STATE_ONE   : begin end
STATE_TWO   : begin end
STATE_THREE : begin end
....


When we look at the RTL implementing the decoder for one-hot and binary, it looks not really different.

I would like to know why one-hot decoding is much faster than the binary case?

Is the difference induced when they are synthesized?

Your case statement is describing the behaviour that you want, but the synthesis tools have to convert it in to logic gates. There is no simple case logic gate. Both infer chains of multiplexers for each signal controlled within.