Professional Documents
Culture Documents
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
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
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 )
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)?
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
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