RAM (cont.
)
• When you talk about the memory of a computer,
most often you’re talking about its RAM.
• If a program is stored in RAM, that means
that a sequence of instructions are stored in
consecutively addressed bytes in the RAM.
• Data values (variables) are stored anywhere in
RAM, not necessarily sequentially
• Both instructions and data are accessed from
RAM using addresses
• RAM is one (crucial) part of the computer’s
overall architecture
Computer Architecture
CPU Keyboard Display
Bus
Hard
CD-ROM
RAM Disk
The Bus
• What is a bus?
• It is a simplified way for many devices to
communicate to each other.
• Looks like a “highway” for information.
• Actually, more like a “basket” that they all
share.
CPU Keyboard Display
Bus
The Bus
CPU Keyboard Display
Bus
Buses
There are a number of possible
interconnection systems
Single and multiple BUS structures are most common
6
What is a Bus?
A communication pathway connecting two or more devices
more devices share the same bus
Usually broadcast
Often grouped
A number of channels in one bus
e.g. 32 bit data bus is 32 separate single bit channels
7
Data Bus
Carries data
Remember that there is no difference between “data” and
“instruction” at this level
Width is a key determinant of performance
8, 16, 32, 64 bit
8
Address bus
Identify the source or destination of data
e.g. CPU needs to read an instruction (data) from a given
location in memory
Bus width determines maximum memory capacity of system
e.g. 8080 has 16 bit address bus giving 64k address space
9
The Control Unit
• Control Unit State Machine has very simple
structure:
• 1) Fetch: Ask the RAM for the
instruction
whose address is stored in IP.
• 2) Execute: There are only a small number
of possible instructions.
Depending on which it is, do
what is necessary to execute it.
• 3) Repeat: Add 1 to the address stored in
IP, and go back to Step 1 !
The Control Unit
• It all comes down to the Control Unit.
• This is just a State Machine.
Bus Interconnection Scheme
Every device is attached to the bus:
its use needs to be coordinated
12
Inside the CPU
• The CPU is the brain of the computer.
• It is the part that actually executes
the instructions.
• Let’s take a look inside.
Inside the CPU (cont.)
Memory Registers Temporary Memory.
Computer “Loads” data
Register 0
from RAM to registers,
Register 1 performs operations on
data in registers, and
Register 2 “stores” results from
registers back to RAM
Register 3
Remember our initial example: “read value of A from memory; read
value of B from memory; add values of A and B; put result in memory in
variable C.” The reads are done to registers, the addition is done in
registers, and the result is written to memory from a register.
Inside the CPU (cont.)
Memory Registers
Register 0 Arithmetic
Register 1 / Logic
Unit
Register 2
Register 3
For doing basic
Arithmetic / Logic
Operations on Values stored
in the Registers
Inside the CPU (cont.)
Memory Registers
Register 0 Arithmetic
Register 1 / Logic
Unit
Register 2
Register 3
To hold the current
instruction
Instruction Register
A Simple Program
Want to add values of variables a and b (assumed to be in memory),
and put the result in variable c in memory, I.e. c a+b
Instructions in program
Load a into register r1
Load b into register r3
r2 r1 + r3
Store r2 in c
Programs and Instructions
• Programs are made up of instructions
• CPU executes one instruction every clock cycle
• Modern CPUS do more, but we ignore that
• Specifying a program and its instructions:
• Lowest level: Machine language
• Intermediate level: Assembly language
• Typically today: High-level programming
language