What does 1-, 2- or 3-process mean for FSM in VHDL?

There seems to be quite a bit of debate about how to encode end machines (FSM) in VHDL. People talk about 1-process, 2-process or 3-process FSM, as if everyone knows exactly what this means and what each process does. However, I could not find an exact definition, and the existing examples seem contradictory.

This is an objective question: what is the difference in code terms for each FSM style (1-process, 2-process, 3-process)? I understand that there is a component of personal preferences, but, of course, you can objectively answer the question and list the advantages of each approach.

Thanks,

+7
coding-style vhdl fsm
source share
1 answer

I try to answer if it is difficult, because each person encodes as he likes, and depending on the conditions in which the hardware should work (frequency, external paths, ...).

In the final machine, you have several elements:

  • entrances
  • exits
  • Current state
  • next state

The next state depends on the current state and inputs. In order not to have combinational loops, you need to try the next state in the clock event so that it becomes the current state. So, you need a VHDL process to create a trigger for the state. In this process, you can put all the logic needed to calculate the next state. If your outputs depend only on state, you do not need other processes.

I don’t like to insert the same combinatorial process logic when the logic is not very simple (I like it, but it is not necessary!), Therefore, as a rule, I divide FSM into two processes: the first very simple process that try the following state, so that to have the current, and one combinatorial process, where I calculate all the outputs and the next state as a function of inputs and current state.

In the same cases, you need to select the output: for example, when for a frequency problem you need to separate the internal paths from the external ones or when the outputs have a large load. In this case, you can add all the necessary triggers to the first process in which you select the next state or create one or more selected processes.

But you can also have many options as the number of processes: I worked in code where each signal is calculated in a dedicated process, so that as a result the state machine had a 20/30 process.

+1
source share

All Articles