Computer Architecture I Lecture Notes: Dr. Ali Muhtaroğlu Fall 2009 METU Northern Cyprus Campus
Computer Architecture I Lecture Notes: Dr. Ali Muhtaroğlu Fall 2009 METU Northern Cyprus Campus
Computer Architecture I Lecture Notes: Dr. Ali Muhtaroğlu Fall 2009 METU Northern Cyprus Campus
Lecture Notes
References:
Patterson&Hennessy, “Computer Organization and Design” (3rd Ed.), Kaufmann, 2007.
Stallings, “Computer Organization & Architecture” (7th Ed.), Pearson, 2006.
Mano & Kime, “Logic and Computer Design Fundamentals”, 4th Ed., Prentice Hall, 2008.
Brown & Vranesic, “Fund. Of Dig. Logic with VHDL Design” (2nd Ed.), McGraw Hill, 2005.
Dr. Patterson’s and Dr. Mary Jane Irwin’s (Penn State) Lecture notes
The Computer Components and
Program Concept
Lecture 3
Ali Muhtaroğlu 2
Some Terminology:
Structure and Function
Ali Muhtaroğlu 3
Functional View
4 computer functions:
1. Data processing
– The main purpose of a computer
2. Data storage
– Short or long term memory
3. Data movement
– Input/Output (I/O): Direct connection
– Data communications: Remote
4. Control
− Orchestrates the operation of
functional parts
Ali Muhtaroğlu 4
Functional View:
Basic Computer Operations
Ali Muhtaroğlu 5
Structural View : Top Level
Peripherals Computer
Central Main
Processing Memory
Unit
Computer
Systems
Interconnection
Input
Output
Communication
lines
Ali Muhtaroğlu 6
Structural View : Central Processing Unit
Control Unit: Controls the operation of the CPU and hence the computer
Arithmetic and Logic Unit (ALU): Performs the computer’s data processing functions
CPU
Computer Arithmetic
Registers and
I/O
Logic Unit
System CPU
Bus Internal CPU
Memory Interconnection
Control
Unit
Ali Muhtaroğlu 7
Structural View : Control Unit
Control Unit
CPU Sequencing
ALU Logic
Control
Internal
Unit
Bus Control Unit
Registers Registers and
Decoders
Control
Memory
Ali Muhtaroğlu 8
Hardwired Program Example
Logic: Timing Diagram:
IN1 IN2
clk
clk R1 R2
IN1 B
IN2 C
x y
IN3 D
x+y IN3
IN4 A
R3
R1 B
x y
R2 C
IN4 x-y
R3 D
R4 R4 A
x y R5 OUT
x-y A-((B+C)-D)
clk R1 R2
0 1 0 1
SEL1 SEL2
x y
ADD:x+y A(0)/S(1)
SUB:x-y
R3
OUT
• In this particular design, control signals (SEL1, SEL2, A/S) can be sequenced to
solve a variety of problems involving addition and subtraction.
• An instruction set can be defined to allow software sequencing of the control
signals. e.g. ADDR1R2 : R3 R1+R2 ; SUBR1R3 : R3 R1-R3 … etc.
• Need hardware to interpret each instruction and generate the correct control
signals i.e. Control Unit. Also need storage for instructions, and perhaps data i.e.
Memory.
Ali Muhtaroğlu 10
A more Generalized Solution
Logic:
IN1 IN2
clk R1 R2
How do we do the same
SEL1 0 1
SEL2 0 1 operation with this
hardware?
x y
ADD:x+y A(0)/S(1)
SUB:x-y A-((B+C)-D)
R3
OUT
• In this particular design, control signals (SEL1, SEL2, A/S) can be sequenced to
solve a variety of problems involving addition and subtraction.
• An instruction set can be defined to allow software sequencing of the control
signals. e.g. ADDR1R2 : R3 R1+R2 ; SUBR1R3 : R3 R1-R3 … etc.
• Need hardware to interpret each instruction and generate the correct control
signals i.e. Control Unit. Also need storage for instructions, and perhaps data i.e.
Memory.
Ali Muhtaroğlu 11
A more Generalized Solution
Logic: Timing Diagram:
IN1 IN2 clk
clk R1 R2 IN1 B A
IN2 C D
0 1 0 1
SEL1 SEL2 SEL1
SEL2
x y
ADD:x+y A/S
A(0)/S(1)
SUB:x-y
R1 B A
R3 R2 C D
• In this particular design, control signals (SEL1, SEL2, A/S) can be sequenced to
solve a variety of problems involving addition and subtraction.
• An instruction set can be defined to allow software sequencing of the control
signals. e.g. ADDR1R2 : R3 R1+R2 ; SUBR1R3 : R3 R1-R3 … etc.
• Need hardware to interpret each instruction and generate the correct control
signals i.e. Control Unit. Also need storage for instructions, and perhaps data i.e.
Memory.
Ali Muhtaroğlu 12
A more Generalized Solution
Logic: Timing Diagram:
IN1 IN2 clk
clk R1 R2 IN1 B A
IN2 C D
0 1 0 1
SEL1 SEL2 SEL1
SEL2
x y
ADD:x+y A/S
A(0)/S(1)
SUB:x-y
R1 B A
R3 R2 C D
• In this particular design, control signals (SEL1, SEL2, A/S) can be sequenced to
solve a variety of problems involving addition and subtraction.
• An instruction set can be defined to allow software sequencing of the control
signals. e.g. ADDR1R2 : R3 R1+R2 ; SUBR1R3 : R3 R1-R3 … etc.
• Need hardware to interpret each instruction and generate the correct control
signals i.e. Control Unit. Also need storage for instructions, and perhaps data i.e.
Memory.
Ali•Muhtaroğlu
What are the advantages and disadvantages of this solution? 13
Program Concept
Programming in Hardware:
Sequence of
Data arithmetic and Results
• Inflexible logic functions
Programming in software:
Instruction Instruction
codes Interpreter
• General purpose hardware can
do different tasks, given correct
control of signals.
General-purpose
• Instead of rewiring, supply a
Data arithmetic and Results
new set of control signals logic functions
Ali Muhtaroğlu 14
What is a program?
• A sequence of steps
• For each step, an arithmetic or logical (or simple movement)
operation is done
• For each operation, a different set of control signals is needed
Ali Muhtaroğlu 15
What is a program?
• A sequence of steps
• For each step, an arithmetic or logical (or simple movement)
operation is done
• For each operation, a different set of control signals is needed
Ali Muhtaroğlu 16
Computer Components
• The Control Unit and the Arithmetic and Logic Unit
constitute the Central Processing Unit
Ali Muhtaroğlu 17
Computer Components: Top Level View
Execute Cycle
• Processor-memory
– data transfer between CPU and main memory
• Processor I/O
– Data transfer between CPU and I/O module
• Data processing
– Some arithmetic or logical operation on data
• Control
– Alteration of sequence of operations e.g. jump
• Combination of above
Ali Muhtaroğlu 20
Example: Hypothetical Machine
Instruction Format:
0 3 4 15
Opcode Address
Integer Format:
0 15
Magnitude
Ali Muhtaroğlu 21
Example: Hypothetical Machine
Instruction Format:
0 3 4 15
Opcode Address
Integer Format:
0 15
Magnitude
Ali Muhtaroğlu 22
Example: Hypothetical Machine
Instruction Format:
0 3 4 15
Opcode Address
Integer Format:
0 15
Magnitude
Ali Muhtaroğlu 23
Example: Hypothetical Machine
Instruction Format:
0 3 4 15
Opcode Address
Integer Format:
0 15
Magnitude
Opcode List:
0001 = Load AC from
memory
0010 = Store AC to
memory
0101 = Add to AC from
memory
Opcode List:
0001 = Load AC from
memory
0010 = Store AC to
memory
0101 = Add to AC from
memory
Opcode List:
0001 = Load AC from
memory
0010 = Store AC to
memory
0101 = Add to AC from
memory
Opcode List:
0001 = Load AC from
memory
0010 = Store AC to
memory
0101 = Add to AC from
memory
Opcode List:
0001 = Load AC from
memory
0010 = Store AC to
memory
0101 = Add to AC from
memory
Opcode List:
0001 = Load AC from
memory
0010 = Store AC to
memory
0101 = Add to AC from
memory
Processor and
Memory or I/O
Data exchange
Internal
Processor
Operations
This diagram incorporates the most flexible machine type where there may be
multiple operands in a single instructoin referencing the memory for multiple
data reads or writes.
Ali Muhtaroğlu 31