State Assignment and Minimization using Peg (Moore Machine)





Peg (PLA Equation Generator) is a state assignment and minimization tool for generating Moore sequential machines.  The output of Peg is a set of state and output equations.  These equations can be fed to Eqntott to generate a truth table which can be minimized using Espresso and fed into the PLA generation tool MPLA to generate a PLA layout of the Moore machine. Please refer to the Meg, Eqntott, Espresso and MPLA man pages for details. In this tutorial we will demonstrate the use of Peg using two different examples.
 

Example 1

In this simple example we will demonstrate the use Peg to create a Moore implementation of a sequence detector with one input and one output.  The output should become "1" when the detector receives the sequence "0101" on the input.  The state diagram for this detector is shown in Fig.1.
 
 

Figure 1:   State diagram of the 0101 sequence detector



 
 

Figure 3:  0101 sequence detector PLA layout with supply and feedback connections





Example 2

In the next example we will explore some other features of Peg using a Bit Serial Adder.  The Peg input program for this counter is given below.
-- 1-bit Serial Adder using Moore Machine

INPUTS   :   RESET a b;
OUTPUTS  :   sum;

W  :  CASE (a b)
         00 => W;
         01 => X;
         10 => X;
         11 => Y;
      ENDCASE;

X  :  ASSERT sum;
      CASE (a b)
         00 => W;
         01 => X;
         10 => X;
         11 => Y;
      ENDCASE;

Y  :  CASE (a b)
         00 => X;
         01 => Y;
         10 => Y;
         11 => Z;
      ENDCASE;

Z  :  ASSERT sum;
      CASE (a b)
         00 => X;
         01 => Y;
         10 => Y;
      ENDCASE => Z;

In the program, note the use of "RESET" input.  It is a good idea to include a reset signal in a sequential circuit.  It im proves testability of your circuit since you can always use this signal to initialize your circuit to a known "reset" state  (state "W" in n the above example). In the above reset is implemented by including the keyword "RESET" as one of the input signals. In this implementation the state machine will jump to the first state on the state list when the signal "RESET" is asserted high (i.e., state "W" in the above example). Alternatively, you may force a jump to the first state on the state list by adding logic to the PLA state outputs to pull all of the state output lines low when a reset is desired. Fig 4 shows a PLA layout for the counter.  Note:  This layout was modified by adding labels based on the notation used in the input .peg file.
 
 


 
 

Figure 4:  PLA layout of a Bit Serial Adder



Details of the IRSIM simulation of the above adder are presented in the IRSIM tutorials. The results of this simulation are depicted in Fig. 5 below.


 

Figure 5:  IRSIM simulation of the Bit Serial Adder


From the above results it can be seen that the output sum which is associated with the state (since it is a Moore machine), changes one cycle after the state change.  This because the output is also clocked due to the use of the -O option for mpla.
 
 


Return to EE6325 homepage