Documente Academic
Documente Profesional
Documente Cultură
Computer organization
Describes how the system components are organized
internally and interconnected to realize the computers
architecture.
Includes all physical aspects of computer systems.
Organization is how features are implemented.
For example: control signals, memory technology,
interfaces.
For example: Is multiplication done by a hardware
multiply unit or is it done by repeated addition?
How does a computer work?
Computer architecture
Functional view
Data movement
e.g. keyboard to monitor
Operating Environment:
Source & destination of data
Processing
Data
Processing
Facility
Data
Movement
Apparatus
Movement
Control
Mechanism
Control
Storage
Data
Storage
Facility
Storage
Movement
Processing
Control
Movement
Storage
Storage
Processing
Control
Storage
10
von Neumann/Turing
Movement
Control
11
12
13
14
Levels of Machines
A computer system can also be abstracted as
having a number of levels in a computer, from
the user level down to the transistor level.
Progressing from the top level downward, the
levels become less abstract as more of the
internal structure of the computer becomes
visible.
15
Levels of Machines
16
Levels of Machines
17
18
CPU Connection
Processor (CPU)
Memory
Input-Output
Control Unit
ALU
Microprocessor-initiated operations
Internal data operations
Peripheral (externally initiated) operations
Communicate with
"outside world", e.g.
Screen
Keyboard
Storage devices
...
19
CPU Connection
CPU Connection
21
Store data.
Perform arithmetic and logic operations.
Test for conditions.
Sequence the execution of instructions.
CPU Connection
CPU Connection
23
20
22
24
Buses
What is a Bus?
A data pathway that links parts of the CPU
together and components to the CPU.
Usually broadcast.
Often grouped
Buses
26
Propagation delays
Long data paths mean that co-ordination of
bus use can adversely affect performance
If aggregate data transfer approaches bus
capacity
27
Address bus
Data Bus
28
29
30
Control Bus
Bus Interconnection
32
Bus Interconnection
Memory
Receives and sends data
Receives addresses (of memory locations)
Receives control signals
Read
Write
Timing
33
34
Memory
Memory
She is 107.
I am staying at 107.
It costs 107.
There is 107.
My office is 107.
Program
Data (variables)
My house is 107.
35
36
Memory
Need to distinguish
between the address of a
memory cell and the
content of a memory cell.
Memory width (W):
How many bits is each
memory cell, typically
one byte (=8 bits)
Memory
Address width (N):
N
0000000000000001
1 bit
0
1
2
2N
...
2N-1
N
0000000000000001
1
2
2N
...
2N-1
W
ELE 107 Dr. Derya Altunay
W
37
2GB 8GB
Memory sizes:
Kilobyte (KB)= 210 = 1,024 bytes ~ 1 thousand
Megabyte (MB) = 220 = 1,048,576 bytes ~ 1 million
Gigabyte (GB) = 230 = 1,073,741,824 bytes ~1 billion
RAM is
38
40
Memory Examples
Memory
Total bits
1K4
4,096
# of
# of address
addresses
lines
1,024
# of data
lines
10
1M8
8,388,608 1,048,576
20
2M4
8,388,608 2,097,152
21
4M1
4,194,304 4,194,304
22
2M32
1 bit
16K64
8M8
41
42
Operations on Memory
Fetch (address):
Fetch (address)
Memory
decoder
circuit
Fetch/Store
controller
...
44
Cache
Input/Output
MDR
F/S
MAR
Input
Control Unit
ALU
45
46
Input/Output
Input/Output
Handles devices that allow the computer system to:
47
48
I/O Controllers
Speed of I/O devices is slow compared to RAM
Data
from/to
memory
RAM
~ 50 ns
Hard-Drive ~ 10 ms = (10,000,000 ns)
I/O controller
Solution:
I/O Buffer
Control/Logic
I/O device
ALU
The ALU (Arithmetic/Logic Unit) performs
Registers:
Rn
ALU circuitry
Bus:
Data path interconnecting the
registers to the ALU circuitry.
51
GT EQ LT
52
R0
R1
R2
ALU circuitry:
50
54
Machine Instructions
Notation:
Arithmetic/Logic
STORE X
Compare
R CON(X)
COMPARE X, Y
Compare the contents of memory cell X to the contents
of memory cell Y and set the condition codes (CCR)
accordingly.
CON(X) R
MOVE X, Y Copy the contents of location Y to loc. X
CON(X) CON(Y)
ADD X, Y, Z
CON(X) CON(Y) + CON(Z)
ADD X, Y
CON(X) CON(X) + CON(Y)
ADD X
R CON(X) + R
similar instructions for other operators, SUBTR,OR,etc
Example
Machine Instructions
Branch
JUMP X
Pseudo-code: Set A to B + C
Assuming variable:
JUMPGT X
Load next instruction from memory location X only
if GT flag in CCR is set, otherwise load statement
from next sequence location as usual.
Control
HALT
56
57
58
59
60
IR (Instruction Register):
stores the instruction fetched from memory
Instruction Decoder:
Decodes instruction and activates necessary circuitry
PC
+1
IR
Instruction
Decoder
10
Program Execution
Fetch phase
Program Execution:
Fetch
Decode
Execute
Store
Decode Phase
Instruction decoder IR (decode instruction in IR)
Instruction decoder will then generate the signals to
activate the circuitry to carry out the instruction.
End of loop
61
62
Program Execution
Program Execution
START
0000
0001
0010
0011
0100
0101
0110
Execute Cycle
HALT
memory address:
212 = 4,096 memory locations
can be addressed
65
64
Operation
Meaning
LOAD X
STORE X
CLEAR X
ADD X
INCREMENT X
SUBTRACT X
DECREMENT X
COMPARE X
R CON(X)
CON(X) R
CON(X) 0
R R + CON(X)
CON(X) CON(X) + 1
R R - CON(X)
CON(X) CON(X) 1
If CON(X) > R then GT = 1 else 0
If CON(X) = R then EQ = 1 else 0
If CON(X) < R then LT = 1 else 0
Get next instruction from memory cell X
Get next instruction from memory cell X if GT=1
Get next instruction from memory cell X if LT=1
Get next instruction from memory cell X if EQ=1
Get next instruction from memory cell X if EQ=0
Input an integer value and store in X
Output, in decimal notation, contents of mem. cell X
66
Stop program execution
0111
12 bits
Fetch Cycle
Opcode
Program Execution
memory
4 bits
cell
operation code:
24 = 16 possible
codes
Execute + Store
Instruction Cycle
63
Fetch + Decode
1000
1001
1010
1011
1100
1101
1110
ELE
107
1111
JUMP X
JUMPGT X
JUMPLT X
JUMPEQ X
JUMPNEQ X
IN X
OUT X
Dr.HALT
Derya Altunay
11
Program Execution
Example
Example:
LOAD X (load value in address X into register)
MAR IR_address
Fetch signal
R MDR
100
101
102
103
104
(Nxt) 105
.....
500
501
502
503
CLEAR X
ADD X
SUBTRACT X
67
LOAD X
ADD
Y
STORE Z
JUMP Nxt
SUBTRACT X
CLEAR X
.....
16
75
0
0
68
address
Bus
contents
100
101
102
103
104
(Nxt) 105
LOAD X
ADD
Y
STORE Z
JUMP Nxt
SUBTRACT X
CLEAR X
address
Control Unit
instructions
contents
100
101
102
103
104
(Nxt) 105
PC
IR
LOAD X
ADD
Y
STORE Z
JUMP Nxt
SUBTRACT X
CLEAR X
Control Unit
instructions
100 101 PC
LOAD X IR
...........
...........
CCR
(X) 500
(Y) 501
(Z) 502
503
16
75
0
0
Memory
CCR
(X) 500
(Y) 501
(Z) 502
503
data
Arithmetic-Logic Unit
CPU
69
16
75
0
0
Memory
data
Arithmetic-Logic Unit
CPU
70
address
Bus
contents
100
101
102
103
104
(Nxt) 105
LOAD X
ADD
Y
STORE Z
JUMP Nxt
SUBTRACT X
CLEAR X
address
Control Unit
instructions
101
100
101
102
103
104
(Nxt) 105
PC
LOAD X IR
16
contents
LOAD X
ADD
Y
STORE Z
JUMP Nxt
SUBTRACT X
CLEAR X
Control Unit
instructions
101 102 PC
ADD Y IR
16
...........
CCR
(X) 500
(Y) 501
(Z) 502
503
16
75
0
0
Memory
...........
CCR
(X) 500
(Y) 501
(Z) 502
503
data
Arithmetic-Logic Unit
CPU
71
16
75
0
0
Memory
data
Arithmetic-Logic Unit
CPU
72
12
Example
Bus
address
Pseudo-code:
Set Balance to Balance - Withdrawal
Assuming variables Balance stored in memory
contents
100
101
102
103
104
(Nxt) 105
LOAD X
ADD
Y
STORE Z
JUMP Nxt
SUBTRACT X
CLEAR X
Control Unit
instructions
102
PC
ADD Y IR
16 91
...........
AB0
AB1
AB2
.....
FF0
FF1
R
CCR
(X) 500
(Y) 501
(Z) 502
503
16
75
0
0
Memory
data
Arithmetic-Logic Unit
CPU
73
LOAD FF0
Using the given instruction
SUBTRACT FF1 set table, show at each step,
STORE FF0
the contents of registers PC,
.....
IR, R, and relevant memory
009E
locations in hex.
0014
Example
Memory
Example
CPU registers
Memory
AB0 0FF0
AB0 PC
AB0 0FF0
AB1 5FF1
IR
AB1 5FF1
AB2 1FF0
AB2 1FF0
...
...
...
FF0 009E
FF1 0014
FF1 0014
75
0FF0 IR
009E R
...
...
FF0 009E
FF1 0014
76
AB1 PC
AB2 1FF0
Examples
CPU registers
AB1 5FF1
AB1 PC
0FF0 IR
Example
AB0 0FF0
CPU registers
...
FF0 009E
Memory
74
Set sum to 0
While (N > 0)
Update sum by sum + N
Decrement N by one
End.
77
78
13
Interrupts
Interrupts
There are two types of interrupts:
Interrupts
Class of interrupts:
Program: Generated by some condition that occurs as a result
of an instruction execution such as arithmetic overflow division
by zero, attempt to execute an illegal machine instruction, and
reference outside a users allowed memory space.
Timer: Generated by a timer within the processor. This allows
the operating system to perform certain functions on a regular
basis. Used in pre-emptive multi-tasking.
I/O: Generated by an I/O controller, to signal normal
completion of an operation or to signal a variety of error
conditions.
Hardware failure: Generated by a failure such as power
failure or memory parity error.
81
References
1) Technology In Action, Complete, 10/E, Evans, Martin and
Poatsy, Pearson.
Interrupts disabled
Interrupts enabled
Fetch and
Decode
Execute and
Store
Check and
process
interrupt
Interrupt Cycle
HALT
82
START
80
83
84
14