You are on page 1of 33

Lect 15

Programmable Logic 

CS221: Digital Design

Dr. A. Sahu
Dept of Comp. Sc. & Engg.
Indian Institute of Technology Guwahati
Indian Institute of Technology Guwahati
1
Outline
• Programmable Logic
• PAL, PLA, 
PAL PLA
• Memory
–ROM, PROM, EPROM, EEPROM
SRAM : Memory Cell
–SRAM : Memory Cell
• CPLD, CLB, FPGA
• FPGA/ASIC Design Flow 
• HDL Programming : Verilog
HDL Programming : Verilog HDL
2
Programmable
Programmable 
Logic Devices
Logic Devices
Programmable Via Control :  
Adder/Substractor
/
• C= B‐A=B+(‐A)=B+ (Ab+1), Ab is complement of A
• D is control bit: D=0/1 operation is add/sub 

A
Result

B ALU

Operation

4
Programmable Via Select: ALU
Programmable Via Select: ALU
• Arithmetic and Logic Unit 
• Add/Sub/OR/AND/Shift…
R=0
if Control=0 R =A +B
if   Control=0     R =A +B 
A R>0
Co if   Control=1     R =A ‐ B 
if   Control=2     R =NOT A  
R if   Control=3     R =A AND B 
if   Control=4     R =A OR B 
if   Control=5     R =A XOR B
B if   Control=6    R = (A<B)?0:A 
if Control=7 R =A SHFT B
if   Control=7     R =A SHFT B 
Control: What to do ? 5
Programmable
Programmable 
Logic Devices
Logic Devices
Programmable Logic Organization
• Pre‐fabricated building block of many AND/OR 
gates (or NOR, NAND)
• "Personalized" by making or breaking 
connections among the gates

Inputs 

Dense Array of  Dense Array of 
AND gates Product   OR Gates
terms 
terms

Outputs

Programmable Array Block Diagram for Sum of Products Form
Basic Programmable Logic 
Organizations
• Depending
Depending on which of the AND/OR logic 
on which of the AND/OR logic
arrays is programmable, we have three basic 
organizations

ORGANIZATION AND ARRAY OR ARRAY

PAL PROG. FIXED

PROM FIXED PROG.

PLA PROG. PROG.


PLA Logic Implementation
Key to Success: Shared Product Terms
Key to Success: Shared Product Terms
Example: Equations Personality Matrix
F0 A + B’ C’
F0 = A  + B’ C’ Product Inputs 
Product  Inputs Outputs 
Outputs
t erm A  B  C  F 0  F 1  F 2  F 3 
F1 = A C ‘ +  A B
F2 = B ‘C’  +  A B A B  1  1  ‐ 0  1  1  0 
F3 = B ‘C  +  A B’ C ‐ 0 
B’ C  1 0 
0 1  0 0 0 0  0 1  1 Reuse 
Reuse
A C’  1  ‐ 0  0  1  0  0  of 
t erms
B’ C’  ‐ 0  0  1  0  1  0 
A  1  ‐ ‐ 1  0  0  1 
Input Side:
1 = asserted in term
1  asserted in term
0 = negated in term
‐ = does not participate
Output Side:
1 = term connected to output
0 = no connection to output
PLA Logic Implementation
Example Continued ‐
l i d Unprogrammed device
dd i
A B C
All possible connections are available
b f
before programming
i

F0 F1 F2 F3
PLA Logic Implementation
Example Continued ‐ Programmed part
A B C

Unwanted connections are "blown"
AB
B’C
AC’’
B’C’

Note: some array structures
work by making connections
rather than breaking them F0 F1 F2 F3
PLA Logic Implementation
Alternative representation
Un‐programmed device

Short‐hand notation  so we don't have to
Sh t h d t ti d 't h t
draw all the wires!
X at junction indicates a connection 
PLA Logic Implementation
Notation for implementing
F0 = A B  +  A’ B’
F1 = CD’  +  C
F1 = CD + C’D D Programmed device
Programmed device
A    B       C       D

AB
A’B’
CD’
C’D

AB+A’B’ CD’+C’D
PLA Logic Implementation
Multiple functions of A, B, C : List of all product terms
Multiple functions of A, B, C  :  List of all product terms  
A B C Programmed device
Design Example
ABC
F1 = A B C A
F2 = A + B + C B
F3 = (A B C)’
F3 = (A B C) C
A’
F4 = (A + B + C)’ B’
F5 = A ⊕ B ⊕ C C’
F6 = (A ⊕ B ⊕ C)’ A’B’C’
A’B’C
A’BC’
AB’C’
ABC’
A’BC
AB’C

F1 F2 F3 F4 F5 F6
PLA Logic Implementation
Another Example: Magnitude Comparator

AB  A  AB  A 
CD
CD  00 
00 01 
01 11 
11 10 
10 CD
CD  00 
00 01 
01 11 
11 10 
10
00  1  0  0  0  00  0  1  1  1 
01  0  1  0  0  01  1  0  1  1 
D  D 
11  0  0  1  0  11  1  1  0  1 
C  C 
10  0  0  0  1  10  1  1  1  0 
B  B 
K‐map for  EQ  K‐map for NE 

AB  A  AB  A 
CD  00  01  11  10  CD  00  01  11  10 
00  0  0  0  0  00  0  1  1  1 
01  1  0  0  0  01  0  0  1  1 
D  D 
11  1  1  0  1  11  0  0  0  0 
C  C 
10  1  1  0  0  10  0  0  1  0 
B  B 
K‐map for L T  K‐map for GT 
PLA Logic Imp: Magnitude Comparator
A
A      B
B         C     
C D

A’B’C’D’
A’BC’D
A BC D
ABCD
AB’CD’
AC’
A’C
B’D
BD
A’B’D
B’CD
ABC
B’C’D’

EQ NE LT GT
PALs and PLAs
What is difference between Programmable Array Logic (PAL) and
Programmable Logic Array (PLA)?
PAL concept 
PAL concept — implemented by Monolithic Memories
implemented by Monolithic Memories
AND array is programmable, OR array is fixed at fabrication

A given column of the 
OR array has access to 
only a subset of the 
possible product terms

PLA concept — Both AND and OR arrays are programmable


PALs and PLAs
• Of the two organizations the PLA is the most 
flexible
– One PLA can implement a huge range of logic 
functions
– BUT many pins; large package, higher cost
• PALs
PALs are more restricted / you trade number 
are more restricted / you trade number
of OR terms vs number of outputs
– Many device variations needed
Many device variations needed
– Each device is cheaper than a PLA
Read‐Only Memory
Read‐Only Memory

ROM
ROM
• Decoder : Produces minterms
• Ors : Produce SOP’s
0 A‘B’C’D’
1 A ‘B’C’D F1
2 A‘B’CD’
A B CD
3 A‘B’CD
A S3 4 A‘BC’D’
B S2 5 A‘BC’D
6 A‘BCD’
A BCD
4:16
4 16 7 A‘ BCD
C S1
dec 8 A B’C’D’ F2
9 A B’C’D
D S0 10 AB’CD’
A B CD
11 A B’CD
12 A B C’D’
13 A B C’D
14 AB
A B C D’ F3
15 AB C D
Enb
ROM
• A decoder
• A set of programmable OR’s

D7 X X X
D6
D5 X X
D4 X
A A2 D3
D2 X
B A1 D1 X X
C A0 D0 X

F3 F2 F1 F0
21
ROM vs. PLA/PAL
Fixed Programmable
Inputs Programmable Outputs
AND array
Connections OR array
(d
(decoder)
d )

(a) Programmable read-only memory (PROM)

Programmable Programmable Fixed


Inputs Outputs
Connections AND array OR array

(b) Programmable array logic (PAL) device

Programmable Programmable Programmable Programmable


Inputs Outputs
Connections AND array Connections OR array

(c) Programmable logic array (PLA) device

22
General Logic Implementation
k
• Given a 2 xn ROM, we can implement 
ANY
ANY combinational circuit with at most k 
bi ti l i it ith t tk
inputs and at most n outputs.
• Why?
k  k 
– k‐to‐2
k to 2 decoder will generate all 2
decoder will generate all 2 possible 
possible
minterms
– Each of the OR gates must implement a 
h f h l
∑m()
– Each ∑m() can be programmed
23
Example
• Find a ROM‐based circuit 
implementation for:
implementation for:
– f(a,b,c) = a’b’ + abc
– g(a,b,c) = a’b’c’ + ab
( b ) ’b’ ’ b + bc b
– h(a,b,c) = a’b’ + c
• Solution:
Express f(), g(), and h() in ∑m() format (use 
– Express f(), g(), and h() in ∑m() format (use
truth tables)
Program the ROM based on the 3 ∑m()’ss
– Program the ROM based on the 3 ∑m()
24
Example
• There are 3 inputs and 3 outputs, thus we need a 
8x3 ROM block.
8x3 ROM block.
f = ∑m(0, 1, 7),    g = ∑m(0, 3, 6, 7), h = ∑m(0, 1, 3, 5, 7)

a 0
1
3-to-8 2
b 3
decoder 4
5
c 6
7

f g h
25
ROM as a Memory
• Read Only Memories (ROM) or Programmable 
Read Only Memories (PROM) have:
Read Only Memories (PROM) have:
– N input lines, 
– M output lines, and 
M output lines and
– 2N decoded minterms. 
• Can be viewed as a memory with the inputs as 
addresses of data (output values), 
– hence ROM or PROM names!

26
Memories
• Volatile: Random Access Memory (RAM)
– SRAM "static" 
– DRAM "dynamic" 
• Non
Non‐Volatile:
Volatile: Read Only Memory (ROM): 
Read Only Memory (ROM):
– Mask ROM "mask programmable" 
– EPROM 
EPROM "electrically
electrically programmable
programmable" 
– EEPROM “electrically erasable electrically 
p g
programmable" 
– FLASH memory ‐ similar to EEPROM with 
programmer integrated on chip

27
ROM as Memory
•Read Example: For input (A2,A1,A0) = 011, output is
(F0,F1,F2,F3 ) = 0010.
•What are functions F3, F2 , F1 and F0 in terms of (A2, A1, A0)?

Address 8x4 ROM


D0 X X X 0 1 1 0 1
D1
X X
1 0 0 0 0
D2
D3 X 2 1 0 0 1
A A2 D4 X A[2:0] 3 F[3:0]
D5 0 0 1 0
B A1 D6 X X
A0 D7 X 3 4 0 0 0 0 4
C
5 1 0 0 0
6 0 0 1 1
7 0 1 0 0
F0 F1 F2 F3
28 A[2:0] =A2A1A0  F[3:0]=F3F2F1F0
Design by ROM: Example
• BCD to 7 Segment Display Controller
l ll
ABCD a b c d e f g
0000 1 1 1 1 1 1 0
0001 0 1 1 0 0 0 0
0010
0011
1
1
1
1
0
1
1
1
1
0
0
0
1
1
a
0100 0 1 1 0 0 1 1
0101 1 0 1 1 0 1 1
0110 1 0 1 1 1 1 1 f b
0111 1 1 1 0 0 0 0
1 1 1 1 1 1 1
1000
1001 1 1 1 0 0 1 1 e c
1010 X X X X X X X
1011 X X X X X X X
1100 X X X X X X X d
1101 X X X X X X X
1110 X
X
X
X
X
X
X
X
X
X
X
X
X
X
g
29 0111
Memory Unit
Memory Unit
Read/Write

D
e
Address M c Data
A o
R d
Data to 
Data to e
Read/Write r 
Memory Unit
Memory Unit
n bits Memory cell

bit 0
0
bit 1 1
dress regisster

Address decoder 2
3
4
emory add
Me

bit n ‐ 1 2n‐1
0 1 2 m ‐ 1
Memory data register m bits
Memory Cell 
Select
R

S D
Input Output

R/W’ S RW’ D O/p


0 X X 0
1 1 X D
1 0 In 0
32
Memory 
Data Inputs
W0

BC BC BC BC
W1
2x4 
Dec BC BC BC BC
Addr
ode W2
r
BC BC BC BC
W3
Enable
Enable 
BC BC BC BC

R/W’ 
R/W

33

Data  Outputs

You might also like