220 likes | 358 Views
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
E N D
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
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
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
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.
Random Access Memory (RAM) Address Content 0000 10011101 0001 10110101 0010 00110101 0011 10101110 0100 10000101 ……….. 1110 00011101 1111 10000011
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?
RAM Problem (a) 10 (b) 8 (c) Read, Write, and Enable
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.
Hamming Code Detecting errorsis easy (attach a parity bit) Correcting errorsis complex and requires Hamming code with several parity bits Hamming distancebetween 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 + rwhere r = parity bits, m = bits in the original data and n = total number of bits transmitted
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+2 5 = 1+4 6 = 2+4 P1 checks bits 3, 5, 7, 9, 11 7 = 1+2+4 P2 checks bits 3,6,7,10,11 9 = 1+8 P4 checks bits 5,6,7,12 10 =2+8 P8 checks bits 9,10,11,12 11 = 1+2+8 12 = 4+8
Problemo du Jour ... Example We need to send 11101001. What 12-bit Hamming word should we send?
Solution de Problemo du Jour … 101111001001
Programming a 32 x 8 ROM X = Fuse intact = 1 ; otherwise fuse blown = 0
Programming a 32 x 8 ROM Example: What are the contents of memory location 11101?
Solution to 32 x 8 ROM Address location 11110 = 30 whose contents are 01001010 Practice: Address 11100 has 00001001
Programmable Array Logic X = Fuse intact Blown Fuse = 1 y = A'B + CD + B'D’ Problemo: What is the Boolean Expression for w?
Solution ... w = ABC' + A'B'CD'
VHDL for RAM //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 state endmodule