Computer Organization and
Software Systems
Contact Session 2 Dr. Lucy J. Gudino
Running a Hello.c Program
Reading ./hello command from Keyboard
Loading the executable from disk into main memory
Writing the output string from memory to the
display
Why do we need to know how compilation works?
• Optimizing program performance.
• Understanding link-time errors
• Avoiding security holes.
Today’s Class
Contact List of Topic Title Text/Ref
Hour Book/external
resource
Memory Organization T1, R2
3-4 - Internal Memory
- External Memory
Memory Organization
Internal Memory Organization
• Internal Memory
• Also known as main memory or Primary Memory
• Small data storage but quick access.
• Examples : RAM, ROM
• External Memory
• Also Known as secondary Memory
• Huge data stored persistently
• Examples: hard disk, solid state drives, USB flash drives etc.
Semiconductor Memory
Semiconductor Memory
Semiconductor Memory
Random-Access Memory (RAM)
• Key features
• RAM is traditionally packaged as a chip.
• Basic storage unit is normally a cell (one bit per cell).
• Multiple RAM chips form a memory.
• RAM comes in two varieties:
• SRAM (Static RAM)
• DRAM (Dynamic RAM)
• SRAM and DRAM are volatile memories
• Loose information if powered off.
DRAM vs SRAM
Read Only Memory
• Permanent Storage and Nonvolatile Memories
• Read Only Memory Variants:
• Read-only memory (ROM): programmed during production
• Programmable ROM (PROM): can be programmed once
• Erasable PROM (EPROM): can be bulk erased (UV, X-Ray)
• Electrically erasable PROM (EEPROM): electronic erase capability
• Flash memory: EEPROMs. with partial (block-level) erase capability
• Wears out after about 100,000 erasing
• Firmware
Applications
• Storing fonts for printers
• Storing sound data in musical instruments
• Video game consoles
• Implantable Medical devices.
• High definition Multimedia Interfaces(HDMI)
• BIOS chip in computer
• Program storage chip in modem, video card and many electronic gadgets,
controllers for disks, network cards, ….
Memory Read Operation (1)
• CPU places address A and then read control signal on the memory bus
Register file Load operation: MOV R4, A
R4 [A]
ALU
R4
Main memory
I/O bridge 0
A
Bus interface x A
Memory Read Operation (2)
• Main memory reads A from the memory bus, retrieves word x, and places
it on the bus
Load operation: MOV R4, A
R4 [A]
Register file
ALU
R4
Main
memory
I/O bridge x 0
Bus interface x A
Memory Read Operation (3)
• CPU read word x from the bus and copies it into register R4.
Load operation: MOV R4, A
R4 [A]
Register file
ALU
R4 x
Main memory
I/O bridge 0
Bus interface x A
Memory Write Operation (1)
• CPU places address A and WRITE control signal on bus. Main memory
reads them and waits for the corresponding data word to arrive.
Load operation: MOV A, R4
Register file
[A] R4
ALU
R4 y
Main memory
I/O bridge 0
A
Bus interface A
Memory Write Operation (2)
• CPU places data word y on the bus
Register file Load operation: MOV A, R4
[A] R4
ALU
R4 y
Main memory
0
I/O bridge y
Bus interface A
Memory Write Operation (3)
• Main memory reads data word y from the bus and stores it at address A.
Load operation: MOV A, R4
Register file
[A] R4
ALU
R4 y
main memory
I/O bridge 0
Bus interface y A
SDR Vs DDR
• SDR Single Data Rate
• DDR Double Data Rate
Clk
SDR
Data
Clk
DDR
Data
Typical Memory Connection Examples
• Construct 1K X4 bit memory using 1Kx1 bit chip
D3 D2 D1 D0
CE
C3 C2 C1 C0
1K x 1 1K x 1 1K x 1 1K x 1
R/W
Address Bus – A9 - A0
Typical Memory Connection Examples
• Construct 2K X4 bit memory using 1Kx4 bit chip
A10
CS
C1
1K x 4
Address Bus A0 to A9
CS Data Bus D0- D3
C2
1K x 4
Error Correction
• Hard Failure
• Caused by harsh environmental abuse or manufacturing defects or wear
• Memory cell is permanently stuck at 0 or 1
• Permanent defect
• Soft Error
• Random, non-destructive
• alters the contents of one or more memory cells without damaging the
memory.
• No permanent damage to memory
• Caused by power supply problems
• Detected using Hamming error correcting code
Error Correcting Code Function
Error Correcting Code Function
• The comparison logic receives as input two K-bit values. A bit-by-bit
comparison is done by taking the exclusive-OR of the two inputs. The result
is called the syndrome word.
• The comparison yields one of three results
• No errors are detected.
• An error is detected and it is possible to correct the error
• An error is detected but it is not possible to correct it.
Hamming Code…..
• What should be the length of the code K ?
• Result of comparison is known as syndrome word
• length of the syndrome word is K bits, Length of Data is “M” bits
• Length of K should satisfy
• 2k-1 >= M+K
Hamming code….
• Generate 4-bit syndrome for an 8 bit data word with following characteristics
• If the syndrome contains all 0’s, no error has been detected.
• If the syndrome contains one and only one bit set to one, then an error
has occurred in one of the 4 check bits. No correction is needed
• If the syndrome contains more than one bit set to 1, then the numerical
value of the syndrome indicates the position of the data bit in error. This
data bit is inverted to correction
Layout of Data and Check bits
Layout of Data and Check bits
Layout of Data and Check bits
Problem 1
Consider the data + code k is as follows:
110101011101
Find out if there is an error. If so which bit is having error?
Problem 1 - Solution
Consider the data + check bit is as follows:
110101011101
Find out if there is an error. If so which bit is having
Problem 2
Data : 10101100 (M = 8)
Compute Check Bits