ELE225 - Chapter 7 - 08-10-2024
ELE225 - Chapter 7 - 08-10-2024
Chapter 7:
Memory and Programmable Logic
1
Topics
2
Previously on ELE 225
We learned how to
Analyze and design registers, shift registers, and
universal shift registers in different modes.
Properly create the effect of a gated clock.
Analyze and design a serial adder circuit.
Analyze and design a ripple counter, synchronous
counter, ring counter, and Johnson counter.
3
Chapter Objectives
Know the organizational structure and functionality of
programmable logic devices (PLDs).
Know how array logic diagrams differ from conventional
logic diagrams.
Know how to specify and describe a memory unit.
Know how to interpret memory cycle timing waveforms.
Know how to differentiate between RAM, ROM, SDRAM,
DRAM.
Know how to use different methods in memory decoding.
Know how to use a Hamming code to detect and correct a
single error, and to detect a double error.
Analyze and design digital circuits with ROM, PLA, and PAL.
Know how to differentiate between SPLD, CPLD, and FPGA.
Know the basic architecture of an FPGA.
4
7-1. Introduction
Two types of memories are used in digital systems:
Random-access memory (RAM): performs both the write
and read operations.
5
Array logic
A typical programmable logic device may have
hundreds to millions of gates interconnected through
hundreds to thousands of internal paths.
So we employ a special gate symbology for array logic.
A single line enters the gate, and the input lines are
drawn perpendicular.
6
7-2. Random-Access
Memory
A memory unit stores binary information in groups of bits called words.
1 byte = 8 bits
16 bit word = 2 bytes; 32bit word = 4 bytes etc.
The communication
between a memory
and its environment is
achieved through data
input and output lines,
address selection
lines, and control lines
that specify the
direction of transfer.
7
Content of a memory
Each word in memory is
assigned an identification
number, called an address,
starting from 0 up to 2k-1,
where k is the number of
address lines.
The selection of a specific
word inside memory is
done by applying the k-bit
address to the address
lines.
An internal decoder accepts
the address and opens the Each address is of 10 bits k
= 10
paths to select the word. Generating 2^10 = 1024
8
Content of a memory
It is customary to refer to the number of
words (or bytes) in memory with one of
the letters K (kilo), M (mega), and G
(giga).
K=210, M=220, or G=230.
Thus, 64K = 216; 2M = 221; 4G = 232
9
Content of a memory
Ex: Consider a memory
unit with a capacity of 1K
words of 16 bits each.
1K = 1,024 = 210 words
1 word = 16 bits = 2
bytes
Therefore, the memory
10
Write and Read operations
RAM can perform read and write
operations.
Write operation = Transferring a new
word to be stored into memory:
1. Apply the binary address of the desired word to
the address lines.
2. Apply the data bits that must be stored in memory
to the data input lines.
3. Activate the write input.
11
Write and Read operations
Read operation = Transferring a stored
word out of memory:
1. Apply the binary address of the desired word to
the address lines.
2. Activate the read input.
The memory unit will then take the bits
from the word that has been selected by
the address and apply them to the output
data lines.
12
Write and Read operations
Commercial memory sometimes provide the
two control inputs for reading and writing in a
somewhat different configuration in table 7-1.
13
Timing Waveforms
The operation of the memory unit is controlled by an
external device such as a central processing unit
(CPU).
The CPU is synchronized by its own clock.
The memory does not have an internal clock.
The access time of memory is the time required to
select a word and read it.
The cycle time of memory is the time required to
complete a write operation.
The CPU must provide the memory control signals to
synchronize the read and write operations of memory.
This means that the access time and cycle time of the memory
must be within a time equal to a fixed number of CPU clock
cycles.
14
Timing Waveforms (write)
Ex: Consider a
CPU has a clock
frequency of 50
MHz, i.e. has a
period of 20 ns
for one clock
cycle.
Suppose the
memory has
cycle and
access time of
50 ns.
Then the
enable and
read/write
signals must
stay active for
15
at least 50 ns.
Timing Waveforms (read)
The memory
places the
word selected
by the address
into the output
data lines
within a 50 ns
interval.
The CPU can
transfer the
data into one
of its internal
registers
during the
negative
transition of
T3. 16
Types of memories
In a random‐access memory, the access time
is always the same regardless of the
particular location of the word.
In sequential-access memory, the
information the time it takes to access a
word depends on the position of the word
with respect to the position of the read head;
therefore, the access time is variable. Ex: CD
17
Static RAM
RAMs have two types: Static and Dynamic.
In SRAM, the stored information remains
valid as long as power is applied to the unit.
consists of internal latches that store the binary
information.
SRAM is easier to use and has shorter read
and write cycles.
18
Dynamic RAM
DRAM stores the binary information in the form
of electric charges on capacitors.
The capacitors tends to discharge with time and
must be periodically recharged by refreshing
the dynamic memory.
DRAM offers reduced power consumption and
larger storage capacity in a single memory chip.
19
Types of memories
Memory units that lose stored information
when power is turned off are said to be
volatile.
Both static and dynamic, are of this category
since the binary cells need external power to
maintain the stored information.
Nonvolatile memory, such as magnetic disk,
ROM, retains its stored information after
removal of power.
20
7-3. Memory decoding
The equivalent logic of a binary cell that stores one bit of
information is shown below.
Read/Write = 0, select = 1, input data to S-R latch
Read/Write = 1, select = 1, output data from S-R latch
21
4x4 RAM
There is a need for
decoding circuits to select
the memory word
specified by the input
address.
During the read operation,
the four bits of the
selected word go through
OR gates to the output
terminals.
During the write operation,
the data available in the
input lines are transferred
into the four binary cells of
the selected word.
A memory with 2k words of
n bits per word requires k
address lines that go into
kx2k decoder.
22
Coincident decoding address
23
Address multiplexing
DRAMs typically have four times the density of SRAM
(i.e., four times the memory on a same size chip).
The cost per bit of DRAM storage is three to four times
less than that of SRAM storage. They also have lower
power consumption. That’s why we prefer DRAMS on
PC’s!
To reduce the number of pins in the IC package,
address multiplexing is used.
In a two-dimensional array, the address is applied in
two parts at different times, with the row address first
and the column address second. Since the same set of
pins is used for both parts of the address, it can
decrease the size of package significantly.
24
Address multiplexing for 64K
DRAM
After a time
equivalent to the
settling time of the
row selection, RAS
goes back to the 1
level.
Registers are used to
store the addresses of
the row and column.
CAS must go back to
the 1 level before
initializing another
memory operation.
25
7-4. Error detection and
correction
There may be errors when storing/retrieving the
binary data to/from memory.
The most common error detection method is the
parity bit.
A parity bit is generated and stored along with the data
word in memory.
The parity of the word is checked after reading it from
memory.
The data word is accepted if the parity of the bits read
out is correct.
If the parity checked results in an inversion, an error is
detected, but it cannot be corrected.
26
7-4. Error detection and
correction
An error‐correcting code generates multiple parity
check bits that are stored with the data word in
memory.
Each check bit is a parity over a group of bits in the
data word.
When the word is read back from memory, the associated parity
bits are also read from memory and compared with a new set of
check bits generated from the data that have been read.
If the check bits are correct, no error has occurred; if not, they
generate a unique pattern, called a syndrome, that can be
used to identify the bit that is in error.
A single error occurs when a single bit changes during the write
or read operation. If the specific bit in error is identified, then
the error can be corrected by complementing the erroneous bit.
27
Hamming Code
One of the most common error‐correcting codes
used in RAMs was devised by R. W. Hamming.
In Hamming code, k parity bits added to n-bit
data word forming a new word of n+k bits.
The bit positions are numbered in sequence from 1 to
n+k.
Those positions numbered as a power of 2 are reserved
for the parity bits.
The remaining bits are the data bits.
The code can be used with words of any length.
28
Hamming Code
Example: Consider the 8-bit data word 11000100. We
include four parity bits with it and arrange the 12 bits as
follows:
Bit position: 1 2 3 4 5 6 7 8 9 10 11 12
P1 P2 1 P4 1 0 0 P8 0 1 0 0
36
Single-Error correction, Double-
Error detection
When the 13‐bit word is read from memory, the
check bits are evaluated as usual.
The parity P is evaluated over the entire 13 bits.
P = XOR (0011100101001)
If P=0, then the parity is correct (even parity)
If P=1, then the parity is incorrect (odd parity).
The following four cases can arise:
If C=0 and P=0, no error occurred
If C≠0 and P=1, a single error occurred that can be
corrected
If C≠0 and P=0, a double error occurred that is detected
but that cannot be corrected
If C=0 and P=1, an error occurred in the P13 bit
37
7-5. Read-Only Memory
A block diagram of a ROM is shown below. It consists of k
address inputs and n data outputs.
The number of words in a ROM is determined from the fact
that k address input lines are needed to specify 2k words.
38
Construction of ROM
Each output of the decoder represents a memory address.
Each OR gate must be considered as having 32 inputs.
A 2kn ROM will have an internal k2k decoder and n OR gates.
39
Truth table of ROM
A programmable connection between two lines is logically
equivalent to a switch that can be altered to either be close or
open.
Intersection between two lines is sometimes called a cross-
point.
40
Programming the ROM
In Table 7-3, 0 no connection
1 connection
Address 3 = 10110010 is permanent storage using fuse link
1 0 1 1 0 0 1 0
: means connection
41
Combinational circuit
implementation
The internal operation of a ROM can be interpreted
in two ways:
A memory unit that contains a fixed pattern of stored
words.
A unit which implements a combinational circuit.
43
Combinational circuit
implementation
We actually need to generate only four outputs with the
ROM; the other two are readily obtained.
The minimum size of ROM needed must have three inputs
and four outputs ROM must be of size 84.
44
Types of ROMs
The required paths in a ROM may be programmed in
four different ways.
Mask programming : fabrication process by the
semiconductor company.
Read-only memory or PROM : blown fuse /fuse intact
by the application of high-voltage pulse.
Erasable PROM or EPROM : erased by ultraviolet
light.
Electrically-erasable PROM(EEPROM) : erased with an
electrical signal
!!! In any case, all procedures for programming ROMs
are hardware procedures, even though the word
“programming” is used. 45
Combinational PLDs
A combinational programmable logic device
(PLD) is an integrated circuit with programmable
gates divided into an AND array and an OR array to
provide an AND-OR sum-of-product
implementation.
PROM: fixed AND array constructed as a decoder
and programmable OR array.
PAL: programmable AND array and fixed OR array.
PLA: both the AND and OR arrays can be
programmed.
46
Combinational PLDs
47
7-6. Programmable Logic
Array
Fig.7-14, the decoder in PROM is replaced by an
array of AND gates that can be programmed to
generate any product term of the input variables.
The product terms are then connected to OR gates
to provide the sum of products for the required
Boolean functions.
The output is inverted when the XOR input is
connected to 1 (since x⊕1 = x’). The output
doesn’t change and connect to 0 (since x⊕0 = x).
48
Fig. 7-14
PLA with 3 Inputs, 4 Product Terms, and 2
Outputs
Ex: implement with PLA
F1 = AB’+AC+A’BC’
F2 = (AC+BC)’
AB’
AC
BC
A’BC
’
49
PLA programming table
F1 = AB’+AC+A’BC’
F2 = (AC+BC)’
F1 = A’B’ + A’C’ + F2 = AB + AC +
B’C’ A’B’C’
52
F1’ = AB + AC + BC F2’ = A’C + A’B +
PLA Example 7.2
F1’ = AB + AC + BC F2 = AB + AC +
A’B’C’
This combination gives a minimum of four distinct
product terms: AB, AC, BC, and A’B’C’ .
53
PLA Example 7.2
AB
AC
BC
A’B’
C’
54
7-7. Programmable Array
Logic
The PAL is a programmable logic device with a fixed OR array
and a programmable AND array.
55
Programmable Array Logic
In designing with a PAL, the Boolean functions must
be simplified to fit into each section.
Unlike the PLA, a product term cannot be shared
among two or more OR gates.
Therefore, each function can be simplified by itself,
without regard to common product terms.
The number of product terms in each section is
fixed, and if the number of terms in the function is
too large, it may be necessary to use two sections to
implement one Boolean function.
The output terminals are sometimes driven by
three‐state buffers or inverters.
56
Example
w(A, B, C, D) = ∑ (2, 12, 13)
x(A, B, C, D) = ∑ (7, 8, 9, 10, 11, 12, 13, 14, 15)
y(A, B, C, D) = ∑ (0, 2, 3, 4, 5, 6, 7, 8, 10, 11, 15)
z(A, B, C, D) = ∑ (1, 2, 8, 12, 13)
w = ABC’ + A’B’CD’
x = A + BCD
y = A’B + CD + B’D’
z = ABC’ + A’B’CD’ + AC’D’ + A’B’C’D = w + AC’D’ +
A’B’C’D
57
PAL programming table
Every 3 rows go into one output
58
Fig. 7-17
59
7-8. Sequential Programmable
Devices
Sequential programmable devices include both
gates and flip-flops. Three major types:
Sequential (or simple) Programmable Logic Device
(SPLD)
Complex Programmable Logic Device (CPLD)
Field Programmable Gate Array (FPGA)
60
Sequential (or simple)
Programmable Logic Device (SPLD)
The configuration mostly used in an SPLD is the
combinational PAL together with D flip‐flops.
A PAL that includes flip‐flops is referred to as a
registered PAL, to signify that the device contains
flip‐flops in addition to the AND–OR array.
Each section of an SPLD is called a macrocell, which
is a circuit that contains a sum‐of‐products
combinational logic function and an optional flip‐flop.
We will assume an AND–OR sum‐of‐products
function, but in practice, it can be any one of the two‐
level implementations.
61
Sequential (or simple)
Programmable Logic Device (SPLD)
Basic macrocell 62
Complex Programmable Logic Device
(CPLD)
A typical SPLD has from 8 to 10 macrocells within
one IC package. All the flip-flops are connected to
the common CLK input and all three-state buffers
are controlled by the OE input.
The design of a digital system using PLD often
requires the connection of several devices to
produce the complete specification. For this type of
application, it is more economical to use a complex
programmable logic device (CPLD).
A CPLD is a collection of individual PLDs on a single
integrated circuit.
63
General CPLD configuration
CPLD consists of multiple PLDs interconnected
through a programmable switch matrix.
8 to 16 macrocells per PLD.
67