Computer Architecture and Data Manipulation: - A Central Processing Unit (CPU)
Computer Architecture and Data Manipulation: - A Central Processing Unit (CPU)
1
9/10/2009
2
9/10/2009
Terminology
• Machine instruction: An instruction (or
command) encoded as a bit pattern
recognizable by the CPU
• Machine language: The set of all instructions
recognized by a machine
3
9/10/2009
4
9/10/2009
Program Execution
• Controlled by two special-purpose registers
– Program Counter: address of next instruction
– Instruction Register: current instruction
• Machine Cycle
– Fetch
– Decode
– Execute
5
9/10/2009
Program Execution
• Controlled by two special-purpose registers
– Program counter: address of next instruction
– Instruction register: current instruction
• Machine Cycle
– Fetch
– Decode
– Execute
6
9/10/2009
7
9/10/2009
8
9/10/2009
9
9/10/2009
10
9/10/2009
Exercise
• PC = 0
• Write a program that subtracts 1 from the
value in memory address FF
11
9/10/2009
Exercise
• Write a program that computes the opposite
of the value in memory address FF
– E.g. if the value is +5 then it becomes -5
12
9/10/2009
13
9/10/2009
14
9/10/2009
Increasing Performance
• Technologies to increase throughput:
– Faster clock speed
– Bigger word size
– Larger cache memory
– Pipelining: Overlap steps of the machine cycle
15
9/10/2009
Pipelining
• Why not start fetching the next instruction while we’re
decoding the current instruction?
• Why not decode the next instruction while we’re executing
the current instruction?
Time
0 1 2 3 4 5 6 7 8 9 10 11 12
Instruction 1 FFFDDDEEE
Instruction 2 FFFDDDEEE
Instruction 3 FFFDDDEEE
Increasing Performance
– Parallel Processing: Use multiple processors
simultaneously
• SISD: No parallel processing
• MIMD: Different programs, different data
– Dual core, quad core
• SIMD: Same program, different data
– SSE, MMX
16