Computer Organization and Architecture: Internal Memory
Computer Organization and Architecture: Internal Memory
Organization
and Architecture
Internal Memory
+ Outline Internal
Memory
Control Control
Dynamic cell
Simpler to build, smaller
DRAM
Static
Faster
Used for cache memory (both on and off chip)
+
Read Only Memory (ROM)
Contains
a permanent pattern of data that cannot
be changed or added to.
Non volatile-No power source is required to
maintain the bit values in memory
While it is possible to read a ROM, it is not
possible to write new data into it
+
Read Only Memory (ROM)
Dataor programs are permanently in main memory and
never need to be loaded from a secondary storage device
Data is actually wired into the chip as part of the
fabrication process
Disadvantages of this:
No room for error, if one bit is wrong the whole batch of
ROMs must be thrown out
Data insertion step includes a relatively large fixed cost
+
Programmable ROM (PROM)
Less expensive alternative
Nonvolatile and may be written into only once
Writing process is performed electrically and may be
performed by supplier or customer at a time later than the
original chip fabrication
Special equipment is required for the writing process
Provides flexibility and convenience
Attractive for high volume production runs
Read-Mostly Memory
EEPRO Flash
EPROM
M Memory
Electrically erasable
programmable read-only Intermediate between
Erasable programmable
memory EPROM and EEPROM in
read-only memory
both cost and functionality
Data Out M
Corrector
Data In M M K
f
Memory Compare
K K
f
1 1
Hamming 1
Error 1 0 1
Correcting
Code C
(c)
• Use VennAdiagramsBto illustrate
(d)
the A
use of this code on 4-bit words (M =
4). 1 1 0 1
• With three intersecting
1 circles, there
0 0
are seven compartments. 0
• We assign the 4 data bits to the inner
compartments0
+ (a) A B (b) A B
1 1 1 0
Hamming 1
1
0 1
1
0
Error 0
Correcting C C
1
• The 1 0 1 1 0
remaining compartments are
1 1
filled
0 with
0 what are called
0 parity
0
bits.
0 0
• Each parity bit is chosen so that
C number of 1s in itsC
the total
circle is even
Figure 5.8 Hamming Error-Correcting Code
+ (a) A B (b) A B
1 1 1 0
1 1
Hamming 1 0 1 0
Error 0
Correcting (c) A
C
B (d) A
C
B
Code 1 1 1 1
0 0
1 1
0 0 0 0
0 0
C C
If an error changes one of the data bits it
is easily
Figurefound.
5.8 Hamming Error-Correcting Code
+
Hamming Codes
Bychecking the parity bits, discrepancies are
found in circle A and circle C but not in circle B.
Onlyone of the seven compartments is in A and C
but not B.
The error can therefore be corrected by changing
that bit.
+
Hamming codes
To clarify the concepts involved, we will develop a
code that can detect and correct single-bit errors in 8-
bit words.
In the Hamming code, k parity bits are added to an M-
bit data word, forming a new word of M+k bits.
The bit positions are numbered in sequence from 1 to
M+k.
+ Increase in Word Length with Error
Correction
Data Bits Check Bits
8 4
16 5
32 6
64 7
• We include four parity bits with this word and arrange the 12
bits.
+
Layout of Data Bits and Check Bits
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
12 11 10 9 8 7 6 5 4 3 2 1
sition
sition No 1100 1011 1010 1001 1000 0111 0110 0101 0100 0011 0010 0001
ta D8 D7 D6 D5 D4 D3 D2 D1
eck C8 C4 C2 C1
• C1 = D1 Å D2 Å D4 ÅD5 ÅD7
• C2 = D1 Å D3 ÅD4 ÅD6 ÅD7
• C8 = D5 Å D6 ÅD7 ÅD8
• C4 = D2 ÅD3 ÅD4 ÅD8
+
Hamming Codes Example
Consider, for example, the 8-bit data word 00111001,
with data bit D1 in the rightmost position.
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 1 0 0 1
+ Calculate the check Bits
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 1 0 0 1
• C1 = D1 + D2 + D4 + D5+D7 (1 + 0 + 1 + 1+0 )
• C2 = D1+D3+D4+D6+D7 (1 + 0 + 1 + 1 + 0)
• C4 = D2+ D3+D4+D8 (0+0+1+0)
• C8 = D5+ D6+D7+D8 (1+1+0+0 )
+ Calculate the check Bits
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 1 0 0 1
• C1 = D1 + D2 + D4 + D5+D7 (1 + 0 + 1 + 1+0 = 1)
• C2 = D1+D3+D4+D6+D7 (1 + 0 + 1 + 1 + 0 = 1)
• C4 = D2+ D3+D4+D8 (0+0+1+0 = 1)
• C8 = D5+ D6+D7+D8 (1+1+0+0 = 0)
+ With Error bits added to the word
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 0 1 0 0 1 1 1 1
• C1 = D1 + D2 + D4 + D5+D7 (1 + 0 + 1 + 1+0 = 1)
• C2 = D1+D3+D4+D6+D7 (1 + 0 + 1 + 1 + 0 = 1)
• C4 = D2+ D3+D4+D8 (0+0+1+0 = 1)
• C8 = D5+ D6+D7+D8 (1+1+0+0 = 0)
+
Hamming Codes Example
Suppose now that data bit 3 sustains an error and
is changed from 0 to 1.
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 0 1 1 0 1 1 1 1
+ With data bit changed
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 1 1 1 0 0 1 1 1
• C1 = D1 + D2 + D4 + D5+D7 (1 + 0 + 1 + 1+0 = 1)
• C2 = D1+D3+D4+D6+D7 (1 + 1 + 1 + 1 + 0 = 0)
• C4 = D2+ D3+D4+D8 (0+1+1+0 = 0)
• C8 = D5+ D6+D7+D8 (1+1+0+0 = 0)
+
Hamming Codes Example
The old codes are XORed with the new codes.
C8 C4 C2 C1
0 1 1 1
0 0 0 1
0 1 1 0
C8 C4 C2 C1
0 1 1 1
0 0 0 1
0 1 1 0
+ With data bit changed
Bit 12 11 10 9 8 7 6 5 4 3 2 1
Position
Position No 1100 1011 1010 100 100 011 0110 0101 0100 0011 0010 0001
1 0 1
Data D8 D7 D6 D5 D4 D3 D2 D1
Bit
Check C8 C4 C2 C1
Bit
Word 0 0 1 1 1 1 1 0 0 1 1 1