0% found this document useful (0 votes)
88 views

Programmable Array Logic VHDL Enotes

The document describes programmable array logic (PAL) devices. It discusses the basic structure of a PAL, which has a programmable AND array and fixed OR array. An example PAL called a 16R4 is described in detail, including its logic diagram and typical applications for realizing sequential logic functions. Other types of programmable logic devices are also briefly mentioned. An example of designing a traffic light controller using a 22CEV10 PLD is provided.

Uploaded by

shrikant_talawar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views

Programmable Array Logic VHDL Enotes

The document describes programmable array logic (PAL) devices. It discusses the basic structure of a PAL, which has a programmable AND array and fixed OR array. An example PAL called a 16R4 is described in detail, including its logic diagram and typical applications for realizing sequential logic functions. Other types of programmable logic devices are also briefly mentioned. An example of designing a traffic light controller using a 22CEV10 PLD is provided.

Uploaded by

shrikant_talawar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

PROGRAMMABLE

ARRAY LOGIC

By:

Prof K R Shobha,
M S Ramiah Institute of Technology, Bangalore

e-Notes for the lectures VTU EDUSAT


Programme

nagaswetha Page 1 13/04/2005


PROGRAMMABLE ARRAY LOGIC
The PAL device is a special case of PLA which has a programmable AND array
and a fixed OR array. The basic structure of Rom is same as PLA. It is cheap compared
to PLA as only the AND array is programmable. It is also easy to program a PAL
compared to PLA as only AND must be programmed.

The figure 1 below shows a segment of an unprogrammed PAL. The input buffer
with non inverted and inverted outputs is used, since each PAL must drive many AND
Gates inputs. When the PAL is programmed, the fusible links (F1, F2, F3…F8) are
selectively blown to leave the desired connections to the AND Gate inputs. Connections
to the AND Gate inputs in a PAL are represented by Xs, as shown here:

Input
buffer

Figure 1: segment of an unprogrammed and programmed PAL.

As an example, we will use the PAL segment of figure 1 to realize the function
I1I2’+I1I2. the Xs indicate that the I1 and I2’ lines are connected to the first AND Gate, and
the I1’ and I2 lines are connected to the other Gate.

nagaswetha Page 2 13/04/2005


Typical combinational PAL have 10 to 20 inputs and from 2 to 10 outputs with 2
to 8 AND gates driving each OR gate. PALs are also available which contain D flip-flops
with inputs driven from the programming array logic. Such PAL provides a convenient
way of realizing sequential networks. Figure 2 below shows a segment of a sequential
PAL. The D flip-flop is driven from the OR gate, which is fed by two AND gates. The
flip-flop output is fed back to the programmable AND array through a buffer. Thus the
AND gate inputs can be connected to A, A’, B, B’, Q, or Q’. The Xs on the diagram
show the realization of the next-state equation.

Q+ = D = A’BQ’ + AB’Q

The flip-flop output is connected to an inverting tristate buffer, which is enabled when
EN = 1

Figure 2 Segment of a Sequential PAL

Figure 3 below shows a logic diagram for a typical sequential PAL, the 16R4.
This PAL has an AND gate array with 16 input variables, and it has 4 D flip-flops. Each
flip-flop output goes through a tristate-inverting buffer (output pins 14-17). One input
(pin 11) is used to enable these buffers. The rising edge of a common clock (pin 1) causes
the flip-flops to change the state. Each D flip-flop input is driven from an OR gate, and
each OR gate is fed from 8 AND gates. The AND gate inputs can come from the external
PAL inputs (pins2-9) or from the flip-flop outputs, which are fed back internally. In
addition there are four input/output (i/o) terminals (pins 12,13,18 and 19), which can be
used as either network outputs or as inputs to the AND gates. Thus each AND gate can
have a maximum of 16 inputs (8 external inputs, 4 inputs fed back from the flip-flop
outputs, and 4 inputs from the i/o terminals). When used as an output, each I/O terminal
is driven from an inverting tristate buffer. Each of these buffers is fed from an OR gate
and each OR gate is fed from 7 AND gates. An eighth AND gate is used to enable the
buffer.

nagaswetha Page 3 13/04/2005


nagaswetha Page 4 13/04/2005
Figure 3: logic diagram for 16R4 pal

When the 16R4 PAL is used to realize a sequential network, the I/O terminals are
normally used for the z outputs. Thus, a single 16R4 with no additional logic could
realize a sequential network with up to 8 inputs, 4 outputs, and 16 states. Each next state
equation could contain up to 8 terms, and each output equation could contain up to 7
terms. As an example, we will realize the BCD to Excess-3 code converter using three
flip-flops to store Q1,Q2 and Q3, and the array logic that drives these flip-flops is
programmed to realize D1, D2 and D3, as shown in figure 3 .The Xs on the diagram
indicate the connections to the AND-gate inputs. An X inside an AND gate indicates that
the gate is not used. For D3, three AND gates are used, and the function realized is

D3 = Q1Q2Q3 + X’Q1Q3’ + XQ1’Q2’

The flip-flop outputs are not used externally, so the output buffers are disabled. Since the
Z output comes through the inverting buffer, the array logic must realize

Z’ = (X + Q3)(X’ + Q3’) = XQ3’ + X’Q3

The z output buffer is permanently enabled in this example, so there are no connections
to the AND gate that drives the enable input, in which case the AND gate output is
logic1.

When designing with PALS, we must simplify our logic equations and try to fit them in
one or more PALs. Unlike the more general PLA, the AND terms cannot be shared
among two or more OR gates; therefore, each function to be realized can be simplified by
itself without regard to common terms. For a given type of PAL the number of AND
terms that feed each output OR gate is fixed and limited. If the number of AND terms in
a simplified function is too large, we may be forced to choose a PAL with more OR-gate
inputs and fewer outputs.

Computer aided design programs for PAL s are widely available. Such programs accept
logic equations, truth tables, state graphs, or state tables as inputs and automatically
generate the required fused patterns. These patterns can then be downloaded into a PLD
programmer, which will blow the required, fuses and verify the operation of the PAL.

Other sequential programmable logic devices (PLDs)

nagaswetha Page 5 13/04/2005


The 16R4 is an example of a simple sequential PLD. As the integrated technology has
improved, a wide variety of other PLDs have become available. Some of these are based
on extensions of PAL concept, and others have based on gate arrays.

The 22CEV10 is a CMOS electrically erasable PLD that can be used to realize both
combinational and sequential networks. It has 12 dedicated input pins and 10 pins that
can be programmed as either inputs or outputs. It contains 10 d flip-flops and 10 OR
gates. The number of AND gates that feed each OR gate ranges from 8 to 16. Each OR
gate drives an output logic macrocell. Each macrocell contains one of the 10 D flip-flops.
The flip-flops have the common clock , a common asynchronous reset (AR) input and a
common synchronous preset (SP) input. The name 22V10 indicates a versatile PAL with
a total of 22 input and output pins, 10 of which are bi-directional I/O (input/output) pins.

Figure 4: block diagram for 22CEV10

Figure 4 shows the details of a 22CEV10 output macrocell. The connections to


the output pins are controlled by programming the macrocell. The output mux controls
inputs S1 and S0 select one of the data inputs. For example, S1S0 = 10 selects data input
2. each macrocell has two programmable interconnect bits. S1 or S0 is connected to
ground (logic 0) when the corresponding bit is programmed. Erasing a bit disconnects the
control line (S1 or S0) from ground and allows it to float to Vcc (logic 1). When S1 = 1,
the flip flop is bypassed, and the output is from the OR gate. The OR gate output is
connected to the I/O pin through the multiplexer and the output buffer. The OR gate is
also fed back so that it can be used as an input to the AND gate array. If S1 = 0, then the
flip-flop output is connected to the output pin, and it is also fed back so that it can be used

nagaswetha Page 6 13/04/2005


for AND gate inputs. when S0 = 1, the output is not inverted, so it is active high. When
S0 = 0 ,the output is inverted, so it is active low. The output pin is driven from the
tristate-inverting buffer. When the buffer output is in the high impedance state, the OR
gates and the flip-flops are disconnected from the output pin, and the pin can be used as
input. The dashed lines on figure 5 show the path when both S0 and S1 are 1. Note that in
the first case the flip flop Q output is inverted by the output buffer, and in the second case
the OR gate output is inverted twice so there is no net inversion.

nagaswetha Page 7 13/04/2005


Figure 5: internal diagram of macro cell of 22CEV10

For any further details regarding 22CEV10 please visit the site
(http://www.anachip.com/downloads/datasheets/pld/PEEL22CV10AZ.pdf)s

Traffic light controller


As an example of using 22v10, we design a sequential traffic-light controller for
the intersection of “A” street and “B” street. Each street has traffic sensors, which detect
the presence of vehicles approaching or stopped at the intersection. Sa =1 means a
vehicle is approaching on “A” street, and Sb=1 means a vehicle is approaching on “B”
street. “A” street is a main street and has a green light until the car approaches on “B”.
Then the light changes and “B” has a green light. At the end of 50 seconds, the light
changes back unless there is a car on “B ” street and none on “A”, in which case the “B”
cycle is extended to another 10 more seconds. When “A” is green, it remains green at
least 60 seconds, and then the lights change only when the car approaches on “B”. Figure
6 shows the external connections to the controller. Three outputs (Ga, Ya, Ra) drives the
green, yellow and red lights on the “A” street. The other three (Gb, Yb, Rb) drives the
green, yellow and red lights on the “B” street.

Figure 7 shows the Moore state graph for the controller. For timing purposes, the
sequential network is driven by a clock with a 10 second period. Thus, a state change can
occur at most once every 10 seconds. The following notation is used: GaRb in a state
means that Ga=Rb=1 and all other output variables are 0. Sa’Sb on an arc implies that
Sa=0 and sb=1 will cause a transition along that arc. An arc without a label implies that a
state transition will occur when clock occurs, independent of the input variables. Thus,
the green “A” light will stay on for 6 clock cycles (60 seconds) and then changes to
yellow if a car is waiting on “B” street.

nagaswetha Page 8 13/04/2005


Figure 6 : block diagram of traffic light controller

Figure 7 : state diagram of traffic light controller

The vhdl code for the traffic light controller given below represents the state
machine by two processes. Whenever the state , Sa, or Sb changes, the first processes
updates the outputs and next state. Whenever the rising edge of the clock occurs, the
second process updates the state register. The case statement illustrates use of a when
clause with a range.since state s0 through s4 have the same outputs, and the next states
are in numeric sequence, we use a when clause with a range instead of five separate when
clauses:

When 0 to 4 => Ga<= ‘1’; Rb <= ‘1’; nextstate <= state +1;

For each state, only the signals that are ‘1’ are listed within the case statement.
Since in VHDL a signal will hold its value until it is changed, we should turn off each
signal when the next state is reached. In state 6 we should set Ga to ‘0’, in state 7 we
should set Ya to ‘0’, etc..This could be accomplished by inserting appropriate statements
in the when clauses. for example, we could insert Ga < = ‘0’ in the when 6 => clause. An
easier way to turn off three outputs is to set them all to zero before the case statement. At
first, it seems that a glitch might occur in the output when we set as signal to zero that
should remain 1. however, this is not a problem because sequential statement within the
process execute instantaneously. For example, suppose that the time = 20 a state change
from S2 to S3 occurs. Ga and Rb are ‘1’, but as soon as the process starts executing, the

nagaswetha Page 9 13/04/2005


first liner of the code is executed and Ga and RB are scheduled to change to ‘0’at time 20
+ delta. The case statement then executes, and Ga and Rb are scheduled to change to ’1’
at time 20 + delta. Since this is the same time as before the new value (1) preempts the
previously scheduled value zero and the signal never changes to ‘0’.
To make it easier to interpret the simulator output, we define a type name light
with values R, Y, G and two signals lightA and lightB which can assume these values.
Then we add code to set lightA to R when the light is red, to Y when the light is yellow
and to G when the light is green.
The test results after simulation are as shown in the figure 8.

VHDL CODE FOR TRAFFIC CONTROLLER

library ieee;
use ieee.std_logic_1164.all;
entity traffic_light is
port (clk, sa, sb: in bit;
ra, rb, ga, gb, ya, yb: inout bit);
end traffic_light;
architecture behave of traffic_light is
signal state, nextstate: integer range 0 to 12;
type light is (r, y, g);
signal lighta, lightb: light;
begin
process(state, sa, sb)
begin
ra <= '0'; rb <= '0'; ga <= '0'; gb <= '0'; ya <= '0'; yb <=
'0';
case state is
when 0 to 4 => ga <= '1'; rb <= '1'; nextstate <= state+1;
when 5 => ga <= '1'; rb <= '1'; if sb = '1'then nextstate
<= 6; end if;
when 6 => ya <= '1'; rb <= '1'; nextstate <= 7;
when 7 to 10 => ra <= '1'; gb <= '1'; nextstate <= state+1;
when 11 => ra <= '1'; gb <= '1';
if (sa='1'or sb='0') then nextstate <= 12; end if;
when 12 => ra <= '1'; yb <= '1'; nextstate <= 0;
end case;
end process;
process(clk)
begin
nagaswetha Page 10 13/04/2005
if clk = '1'then state <= nextstate; end if;
end process;
Figure 8:test results for traffic controller

Figure 9: State table for traffic-light controller

nagaswetha Page 11 13/04/2005


Figure 9:state table for traffic controller

Binary Value Assignment:


S0 = 0000, S1 = 0001, S2 = 0010, S3 = 0011, S4 = 0100
S5 = 0101, S6 = 0110, S7 = 0111 , S8 = 1000, S9 = 1001
S10 = 1010, S11 = 1011, S12 = 1100
S13 = XXXX, S14 = XXXX, S15 = XXXX

Figure 10: excitation table

To get the excitation table from the state table of the traffic controller we replace all the
state names with its equivalent binary values as shown in the figure 10.

nagaswetha Page 12 13/04/2005


To get the equations for the O/Ps Ra, Ga, Ya, Rb, Gb, Yb. we have to draw a k-
map for 4 variables Q1Q2Q3Q4. For the different combinations of these variables
Q1Q2Q3Q4 the value of Ga is read from the state table and written into the K-map as
shown in figure 12. For states S13 to S15 which are not present in the excitation table we
can write the values for Ga as X inputs in the K-map (don’t cares). We then group two
1’s or four 1’s or eight 1’s and simplify the K-map as shown in figure –12 to get the
simplified expression for Ga. Following the same procedure the equations for Ra, Ya, Rb,
Gb, Yb can be obtained.

The equations for D1, D2, D3 and D4 have six variables Q1, Q2, Q3, Q4, Sa and
Sb. So for different combinations of Sa Sb. The four variable K-map with Q1Q2Q3and
Q4 are solved the resulting four equations are ANDed with their respective Sa Sb values.
These expressions are then Ored together to get the desired expressions for D1 D2 D3
D4. the detailed procedure for D1 is shown in the figure 11.

AT SaSb=01
AT SaSb=00 D1= Q1Q2’ + Q2Q3Q4
D1= Q1Q2’ + Q2Q3Q4

nagaswetha Page 13 13/04/2005


AT SaSb=10 AT SaSb=11
D1= Q1Q2’ + Q2Q3Q4 D1= Q1Q2’ + Q2Q3Q4

Figure 11: K-map for simplification of D1

D1= Q1Q2’ + Q2Q3Q4 at Sa’Sb’ (i.e Sa=0 and Sb=0)


D1= Q1Q2’ + Q2Q3Q4 at Sa’Sb (i.e Sa=0 and Sb=1)
D1= Q1Q2’ + Q2Q3Q4 at SaSb’ (i.e Sa=1 and Sb=0)
D1= Q1Q2’ + Q2Q3Q4 at SaSb (i.e Sa=1 and Sb=1)
Solving for the first case i.e. D1

D1 = (Q1Q2’ + Q2Q3Q4) Sa’Sb’ +(Q1Q2’ + Q2Q3Q4) Sa’Sb +


(Q1Q2’ + Q2Q3Q4) SaSb’ + (Q1Q2’ + Q2Q3Q4) SaSb

Simplifying further

D1= (Q1Q2’ + Q2Q3Q4) (Sa’Sb’ + Sa’Sb + SaSb’ + SaSb)

D1 = (Q1Q2’ + Q2Q3Q4) (Sa’ (Sb’ + Sb) + Sa(Sb’ + Sb) )

we know that Sa + Sa’ =1 and Sb + Sb’ =1


Thus we see the final value of

D1 = Q1Q2’ + Q2Q3Q4

nagaswetha Page 14 13/04/2005


Figure 12: K-map for simplification of Ga

Similarly the below equations can be solved and implemented using PAL.

nagaswetha Page 15 13/04/2005

You might also like