06 TheCPUAndMemory
06 TheCPUAndMemory
06 TheCPUAndMemory
Introduction
The Little Man Computer (LMC) is cute, but
Real computers
Memory is separate from the CPU Data are in binary (not decimal) Central Processing Unit
ITEC 1011
Components of a CPU
ALU (arithmetic and logic unit)
Perform arithmetic and logic operations Arithmetic: add, subtract, multiply, divide, etc. Logic: AND, OR, NOT, Shift, etc.
Control unit
Interprets instructions Controls the flow of information within the CPU Works with a program counter (address of next instruction)
Input/output interface
Provides mechanism for input and output of data Many variations possible
p. 166 ITEC 1011 Introduction to Information Technologies
LMC Counterparts
ALU Input/output interface
456 123 00 01 02 03 04 05 123 500 199 500 399
Control unit
95 96 97 98 99 05
789
123
Program counter
p. 167 ITEC 1011 Introduction to Information Technologies
Memory
ITEC 1011
Registers
A register is a single storage location within the CPU Unlike memory, which is outside the CPU Examples of registers:
Accumulator (ACC) Program counter (PC) Instruction register (IR) Memory address register (MAR) Memory data register (MDR) Status register
Memory Unit
n bits Memory address register
bit 0
Memory cell
bit 1 0 1 2 3 4
Address decoder
bit n - 1 0 1 2 m-1
2n-1
m bits
p. 170
Memory Capacity
2n x m n address bits = 2n addresses m data bits m is the width of the data path Typical values:
n: 16, 17, 18, 19, 20, 21, 22, etc. m: 8, 16, 32, 64
ITEC 1011
Question
Q: How many bits of memory are contained in a memory unit with 512KB of memory? A: 512 = 29, K = 210, B = byte = 8 = 23 29 x 210 x 23 = 222 = 4,194,304
ITEC 1011
Skip answer
ITEC 1011 Introduction to Information Technologies
Answer
Q: How many bits of memory are contained in a memory unit with 2MB of memory? A: 2 = 21, M = 220, B = byte = 8 = 23 21 x 220 x 23 = 224 = 16,777,216
ITEC 1011
Memory Implementations
RAM random access memory
Static RAM Dynamic RAM
Fetch-Execute Cycle
Two steps, or cycles, in the execution of every instruction
Fetch fetch the code for the instruction from memory and place it in the IR (instruction register) Execute execute the instruction
Execute time
PC Fetch MDR
PC + 1
ITEC 1011
PC Fetch MDR
ITEC 1011
Buses
Definition: a collection of wires with a common purpose Each wire is called a line Typically, buses carry information from one place to another
bus Printer Mouse Keyboard Modem CPU RAM Network card Computer
ITEC 1011 Introduction to Information Technologies
Ports
Speakers
Types of Buses (1 of 3)
Point-to-point
Serial port Modem
Control unit
ALU
ITEC 1011
Types of Buses (2 of 3)
Multipoint
Computer Computer
Computer
Computer
Types of Buses (3 of 3)
Daisy chain
Device controller Device Device Device Terminator
ITEC 1011 Introduction to Information Technologies
I/O Device
ITEC 1011 Introduction to Information Technologies
Data Bus
Carries data between the CPU and memory or I/O devices Bi-directional
Data transferred out of the CPU for write operations Data transferred into the CPU for read operations
ITEC 1011
Address Bus
Carries an address from the CPU to Memory or I/O devices Unidirectional
The address is always supplied by the CPU
(There is one exception to this, which well discuss later.)
ITEC 1011
Control Bus
Collection of signals for coordinating CPU activities Each signal has a unique purpose Typical sizes: 10-20 lines Signals are output, input, or bi-directional Typical signals
ITEC 1011
/RD (read) /WR (write CLK (clock) /IRQ (interrupt request) etc.
Introduction to Information Technologies
Memory Maps
The usage of memory space on a system is commonly depicted in a memory map The height of the map is determined by the number of addresses The width of the map is usually 8 bits E.g.,
a system with a capacity of 216 bytes
ITEC 1011
Memory Map
7 6 5 4 3 2 1 0 FFFF
Hexadecimal address
ITEC 1011
E.g.,
a memory map for a system with a capacity of 224 bytes with two 1 MB RAM modules residing consecutively at the bottom of memory
ITEC 1011 Introduction to Information Technologies
Memory Map
FFFFFF
empty
1 MB RAM
100000 0FFFFF
1 MB RAM
000000 ITEC 1011 Introduction to Information Technologies
Answer
Q: A system with a memory capacity of 128 GB has four 32 MB memory modules installed. The rest of the memory is unused. How much memory space is available for future expansion? (Give your answer in decimal in megabytes.) A: 128 GB 4 x 32 MB = 27 x 210 MB - 22 x 25 MB = (217 27) MB = (131,072 128) MB = 130,944 MB
ITEC 1011 Introduction to Information Technologies
Answer
Memory Map
Answer 7FFFFFFF
ITEC 1011
ITEC 1011
Thank you
ITEC 1011