9.2 DESIGNING WITH THE TWO-PROCESS PS/NS METHOD
Throughout this chapter, we will place our emphasis on designing complex state machines that
are driven by a clock—that is, synchronous or clock mode digital circuits. The two-process
PS/NS method is very versatile and can be used to design either simple or complex state
machines. When you use this method, you do not have to obtain the excitation equations and
draw the circuit. You simply use the method and let the VHDL software do the work. You can
always observe the circuit that is produced using either View RTL Schematic or View Technology
Schematic if you are using Xilinx software. Other software vendors have a similar option
to allow you to view the resulting schematic.
Figure 9.1 shows a circuit model for the two-process PS/NS method. The two-process
PS/NS method uses a behavioral design style with two processes. The first process is called
the synchronous process (sync_proc), and the second process is called the combinational process
(comb_proc). The synchronous process generates D flip-flops for the design, while the
combinational process decodes the next-state (NS) functions for the D flip-flop inputs and also
provides the flip-flop outputs as shown in Figure 9.1.
A SET, RST, or INIT input is not shown for the flip-flops in Figure 9.1, because this state
machine model may be designed with a SET input, a RST input, or INIT input—that is, the
required input is provided in the design specification.
The synchronous process generates the D flip-flops for the state machine design and the
following signals:
1. The present-state (PS) value after SET, RESET, or INITIALIZATION (a SET, RST, or INIT
input is not shown in Figure 9.1).
2. The present-state (PS) value after the next rising edge (or falling edge) of the clock—that is,
the value of the next state, or PS ,5 NS.
The combinational process generates the following signals:
1. The next-state (NS) value—that is, the decoded next state functions—based on the presentstate
(PS) value and the external inputs (EIs) via the cloud of combinational logic.
2. The flip-flop output values for Qs or Ys.
3. The Moore and Mealy output values (covered later).
The two-process PS/NS method requires less hardware understanding, but a more detailed
understanding of VHDL. The two-process PS/NS method is considered the preferred VHDL
coding style for complex state machine designs. By following this coding style, someone can
easily understand the code that you write, and you can understand someone else’s code.
Figure 9.2 shows a complex state machine named binary up/down counter (2 bits) with
an external