How (all) machines work...
All machines that have been
invented by humans
operates on this
common property:
- A machine will
always
repeat
the same steps
over and over again
|
Example: the
combustion engine
(= machine !!!)
used in automobiles
The steps in the
combustion engine "machine"
- Intake step:
- The
engine
suck in
a mixture of
gasoline and air
|
- Compression step:
- The
engine
compress
a mixture of
gasoline and air
(higher pressure is
needed for
combustion)
|
- Combustion step (see the spark !):
- The spark plug ignites
the compressed fuel mixture
(and the explosion will
generate
energy)
|
- Expell step:
- The burned gas is
expelled
|
|
After step 4,
the
engine is
back to its
original (= starting) state and
the
engine
is ready to
repeat the
steps
Observe that the 4 steps
in the combustion engine
repeat
continuously
Underlying Principle:
the
last step
in a
machine cycle will
always
ends in the
initial machine state
The Instruction Execution cycle of the CPU -
Introduction
- The
CPU is
an
(electronic) machine !!!
- The
task
performed by a
CPU (machine):
- Fetch and (then)
execute a
computer instruction
|
-
CPU is
machine:
- A CPU (machine) will
repeat
a (fixed) number of "steps"
(or phases)
- The steps/phases that
a CPU (machine) go through will
fetch and
execute
the next instruction
in the computer program !!
|
- The
Instruction Execution Cycle
of the CPU:
- The
steps/phases that
the CPU goes through
to
fetch and
execute the
next instruction
is called:
- The
Instruction Execution Cycle (of the
CPU)
|
|
|
The 4 steps in the
CPU's
Instruction Execution Cycle
The
steps/phases
of the
instruction execution cycle are:
- The
instruction fetch step/phase
- The CPU will
fetch the
next instruction from
memory and
store it in the
Instruction Register (IR)
|
- The
instruction decode step/phase
- The
CPU
finds out
what the
instruction is.
|
- The
operand fetch step/phase
- The
CPU fetches
the operands to
perform the
instruction
|
- The
instruction execute step/phase
- The
CPU performs the
arithmetic/logic operation
|
|
Next:
example of
Instruction Execution Cycles for
normal and
out-of-order
program flow
❮
❯