02+-+CPU Memory Program Execution
02+-+CPU Memory Program Execution
Slide #3 of 35
Lecture Objectives
Slide #4 of 35
Lecture Outline
Slide #5 of 35
Before we start …
What is a computer?
Slide #9 of 35
Anatomy of a Computer System
Slide #10 of 35
1) Memory
◆ Finite Capacity
➢ Memory locations have a finite capacity (limited size),
➢ Data may not “fit” in the memory location
Slide #12 of 35
Random Access Memory (RAM)
Slide #13 of 35
2) Control Unit
Slide #14 of 35
Illustration of a Single Instruction
Slide #15 of 35
##/## Join at: vevox.app ID: XXX-XXX-XXX Question slide
Which of the following is/are the correct machine instruction for the code
at line 7?
Memory locations/addresses:
total => 1000,
num1 => 2000,
num2 => 3000
TOTAL 1000, 2000, 3000
##.##%
ADD 1000, 3000, 2000
##.##%
ADD 2000, 3000, 1000
##.##%
ADD 1000, 2000, 3000
##.##%
TOTAL 2000, 3000, 1000
##.##%
Slide #16 of 35
##/## Join at: vevox.app ID: XXX-XXX-XXX Results slide
Which of the following is/are the correct machine instruction for the code
at line 7?
Memory locations/addresses:
total => 1000,
num1 => 2000,
num2 => 3000
Slide #17 of 35
3) Arithmetic/Logic Unit (ALU)
Slide #18 of 35
4 & 5) Input / Output Units
Slide #19 of 35
The Peripherals
Slide #20 of 35
Slide #21 of 35
Anatomy of a Computer System – Recap!
Slide #22 of 35
How Computers Execute Programs?
Slide #23 of 35
Executing Programmes
Slide #24 of 35
ADD 800, 428, 884
Slide #25 of 35
Instruction Fetch (IF)
◆ Execution begins by
moving the instruction at
the address given by the
PC (2200) from memory to
the control unit.
◆ Bits of instruction are
placed into the decoder
circuit of the Control Unit.
◆ Once instruction is
fetched, the PC can be
readied for fetching the
next instruction.
Slide #26 of 35
Instruction Decode (ID)
Slide #27 of 35
Instruction Decode (ID)
Slide #28 of 35
Data Fetch (DF)
Slide #29 of 35
Instruction Execution (EX)
Slide #30 of 35
Many Simple Operations
◆ Computers “know” very few instructions.
◆ The decoder hardware in the controller recognises, and the
ALU performs, only about 100 or so different instructions
(with a lot of duplication).
◆ Everything that computers do must be reduced to some
combination of these primitive, hardwired instructions.
◆ ADD is representative of the complexity of computer
instructions…some are slightly simpler, some slightly
more complex.
◆ Computers achieve success at what they can do with
speed i.e. millions/billions of instructions per second
(Clock Speed in MHz/GHz) .
Slide #31 of 35
Result Return (RR)
Slide #32 of 35
Computer’s View of Software
◆ A computer “sees” software as a long sequence of 4-byte
/8-byte (32-bit/64-bit) groups of bits (0's and 1's)
Slide #33 of 35
Summary
◆All computers, regardless of their implementing technology,
have five basic parts or subsystems:
➢ The memory, a very long sequence of bytes, each with an address,
stores the program and data while the program is running.
➢ The ALU does the actual computing.
➢ The Control Unit controls the activity of all other units in the
computer system, giving them directions.
➢ The input and output units are the interfaces for the peripheral
devices connected to the computer.
◆A program is executed according to the Fetch/Execute
Cycle:
➢ The repeating process fetches each instruction (indicated by the PC),
decodes the operation, retrieves the data, performs the operation,
and stores the result back into the memory.
Slide #34 of 35
Feedback Form
Slide #35 of 35