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.
INPUTS: x;
OUTPUTS: z;
A: IF x THEN A ELSE B;
B: IF NOT x THEN B ELSE C0;
C0: IF x THEN A ELSE D;
C1: ASSERT z;
IF x
THEN A ELSE D;
D: IF x THEN C1 ELSE B;
The output truth table file (peg.eqn) generated by
Peg
is shown below.
Note: The statements `INORDER' and `OUTORDER'
give the ordering of inputs and outputs in the PLA layout that will be
finally generated.
In the above command line, -l and -O
are used to provide clocked inputs and outputs in the PLA layout. All the
above commands can be combined on one command line as follows:
The above command will generate the Magic layout seqdet.mag.
(Note: At present Eqntott only runs on an old machine called
tulia ). The sequence detector PLA layout is shown in Fig
2.
Figure 2: 0101 sequence detector PLA layout (without supply and feedback connection)
Figure 3: 0101 sequence detector PLA layout with supply and feedback connections
-- 1-bit Serial Adder using Moore MachineIn 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.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;
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.
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.