- The Instruction Fetch step will
fetch the instruction located at the
address given in the PC register
(which is the instruction at
memory location 44)
and store it in the
IR register.
The following
diagrams show
what happens inside the computer system
when it performs the
Instruction Fetch step:
The CPU first sends out
the value of PC on the
address bus and
the READ signal on
the control bus to the
memory:
The signals on the
address and control buses represents
the "send back the data in memory location 44"
command to the memory
In response to this
command, the
memory will
send out the
content in its
memory location 44 on
the data bus (wires):
The CPU will then
copy the
data on the data bus into
its IR register
(because the CPU is
fetching an instruction,
it will store the data
in its proper place - which is
the IR register):
Finally,
the CPU updates
its PC register to
the address of
the subsequent instruction
(which is 44+4 = 48):
This completes the Instruction Fetch step.
You can see in the diagram that:
- The instruction has been fetched and
stored in the IR register
- The PC register now contains
the address (location) of
a new
next instruction - so
if the CPU repeats the
steps, the CPU will fetch a
different instruction !!!
|
The CPU will continue with
the other steps of
the Instruction Execution Cycle to execute
(= perform the calculation) specified by
the fetched instruction
- During the Instruction Decode step,
the CPU will
determine
what the instruction
inside the IR register
tells it to do.
In this example, we
used the
instruction
"add R2,R0,R1"
In a, the IR register contains
a binary number and
the CPU has to
find out what the
binary number represent.
The details of this step will be explained in
CS355,
For CS255, we just assume
that the CPU has
discovered that the
instruction in the IR register tells the CPU to
add the values in register R0 and R1 and
store the sum in register R2.
- After the CPU has determined what the instruction tells it to do,
the CPU will fetch the
operands first.
During the Operand Fetch step,
the CPU sends out
control (electrical) signals to the
appropriate registers to
tell these registers to
send their values to
the input of the ALU circuit:
- The IR register will
emit control signals to
tell the
ALU circuit to
perform an
addition on the
input values
The sum is then
transmitted to
the registers
The IR register will
send control signals to
register R2 to
store the
sum:
The result is:
- Register R2 will contains
the sum (12) of the values in
registers R0 (5) and R1 (7)
|
The Instruction Exection Cycle is now
completed and
the CPU will
repeat the
cycle all over again...