digital electronics chapter 7 memory and programmable logic

22
Digital Electronics

Upload: eileen-brooks

Post on 01-Jan-2016

226 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Digital Electronics Chapter 7 Memory and Programmable Logic

Digital Electronics

Page 2: Digital Electronics Chapter 7 Memory and Programmable Logic

Chapter 7

Memory

and

Programmable Logic

Page 3: Digital Electronics Chapter 7 Memory and Programmable Logic

Some Terminology

A Memory is a device in which binary information can be stored (write) and later retrieved (read)

Memory

RAM PLD

random access programmable

memory logic device

Page 4: Digital Electronics Chapter 7 Memory and Programmable Logic

PLD Galore ...

PLD

ROM PAL PLA FPGA

RAM loses information when the power is turned off

PLD does not lose the information when the power is turned off

Page 5: Digital Electronics Chapter 7 Memory and Programmable Logic

ROM’s R us!

ROM

Mask PROM EPROM EEPROM

ROM is non-volatile. It does not lose the information when the power is turned off

Page 6: Digital Electronics Chapter 7 Memory and Programmable Logic

Types of RAM

RAM

SRAM DRAM

Static Dynamic

RAM is volatile. It will lose information when the power is turned off. But DRAM needs to be refreshed every few milliseconds even when the power is on. SRAM is like a latch. DRAM is a MOS capacitor.

Page 7: Digital Electronics Chapter 7 Memory and Programmable Logic

Random Access Memory (RAM)

Address Content

0000 10011101 0001 10110101 0010 00110101 0011 10101110 0100 10000101

………..

1110 00011101 1111 10000011

Page 8: Digital Electronics Chapter 7 Memory and Programmable Logic

RAM Problem

A 1K x 8 RAM chip has 1024 locations (addresses). Each location stores a byte (8 bits)

(a) How many address lines are on the RAM chip?

(b) How many data lines are on the RAM chip?

(c) What other lines are on the RAM chip?

Page 9: Digital Electronics Chapter 7 Memory and Programmable Logic

RAM Problem

(a) 10 (b) 8 (c) Read, Write, and Enable

Page 10: Digital Electronics Chapter 7 Memory and Programmable Logic

Memory Decoding Schemes

Simple Decoding: Each word (say 8 bits) is decoded by one output of a decoder. A 1K x 8 RAM would require a 10x1024 decoder. This is way too complicated!

Coincident Decoding: This is 2-D decoding. Each word is at the intersection of an X-decoder and a Y-Decoder. So a 1K X 8 RAM would require two 5 X 32 Decoders. One decoder points to the column of the word and the other decoder points to the row. Much simpler!

Address Multiplexing in DRAM: The column address and the row address are sent via the same address lines and latched on CAS (column address strobe) and RAS (row address strobe). This saves on the number of pins but slows down RAM access.

Page 11: Digital Electronics Chapter 7 Memory and Programmable Logic

Hamming Code

Detecting errors is easy (attach a parity bit)

Correcting errors is complex and requires Hamming code with several parity bits

Hamming distance between two code words is the number of single bit errors required to convert one code word to another. Example: 1101 and 1110 are a distance 2 apart

n = m + r where r = parity bits, m = bits in the original data and n = total number of bits transmitted

Page 12: Digital Electronics Chapter 7 Memory and Programmable Logic

2r >= m+r+1

Example: For 8‑bit code one needs 4 parity bits for a total of 12 bits

Parity bits are bits 1, 2, 4, 8 (P1, P2, P4, P8 )

3 = 1+25 = 1+46 = 2+4 P1 checks bits 3, 5, 7, 9, 117 = 1+2+4 P2 checks bits 3,6,7,10,119 = 1+8 P4 checks bits 5,6,7,1210 =2+8 P8 checks bits 9,10,11,1211 = 1+2+812 = 4+8

Page 13: Digital Electronics Chapter 7 Memory and Programmable Logic

Problemo du Jour ...

Example We need to send 11101001. What 12-bit Hamming word should we send?

Page 14: Digital Electronics Chapter 7 Memory and Programmable Logic

Solution de Problemo du Jour …

101111001001

Page 15: Digital Electronics Chapter 7 Memory and Programmable Logic

Programming a 32 x 8 ROM

X = Fuse intact = 1 ; otherwise fuse blown = 0

Page 16: Digital Electronics Chapter 7 Memory and Programmable Logic

Programming a 32 x 8 ROM

Example: What are the contents of memory location 11101?

Page 17: Digital Electronics Chapter 7 Memory and Programmable Logic

Solution to 32 x 8 ROM

Address location 11110 = 30 whose contents are 01001010

Practice: Address 11100 has 00001001

Page 18: Digital Electronics Chapter 7 Memory and Programmable Logic

Programmable Array Logic

X = Fuse intact

Blown Fuse = 1

y = A'B + CD + B'D’

Problemo: What is the Boolean Expression for w?

Page 19: Digital Electronics Chapter 7 Memory and Programmable Logic

Solution ...

w = ABC' + A'B'CD'

Page 20: Digital Electronics Chapter 7 Memory and Programmable Logic

Sequential PLD

Page 21: Digital Electronics Chapter 7 Memory and Programmable Logic

//Memory size is 64 words of 4 bits each. module memory (Enable,ReadWrite,Address,DataIn,DataOut);

input Enable,ReadWrite; input [3:0] DataIn; input [5:0] Address; output [3:0] DataOut; reg [3:0] DataOut; reg [3:0] Mem [0:63]; //64 x 4 memory always @ (Enable or ReadWrite)

if (Enable) if (ReadWrite) DataOut = Mem[Address]; //Read else Mem[Address] = DataIn; //Write

else DataOut = 4'bz; //High impedance stateendmodule

VHDL for RAM

Page 22: Digital Electronics Chapter 7 Memory and Programmable Logic

That’s All Folks!