modify the above CPU steps:
1. fetch the instruction at the address given by the PC
added step. modify the PC such that it contains the address of
the next instruction to execute
2-5. the same as above
The added step could come at any time after step 1. It is convenient
to think of it as step 2.
This set of steps works fine for all instructions EXCEPT
control instructions.
Control Instructions example
beq x, y, label
1. fetch instruction -- address given by PC
2. update PC
3. decode
(its a BEQ instruction, and there are 3 operands)
4. fetch operands (x and y)
5. compare operands (for equality)
6. if equal, overwrite PC with address implied by 3rd operand (label)
The processor steps involved:
1. fetch the instruction
2. update PC
3. decode
4. load operand(s)
5. do the operation specified by the instruction
6. store result(s) (if any)
notice that this series of steps gets repeated constantly --
to make the computer useful, all that is needed is a way
to give the PC an initial value (the first instruction of a program),
and to have a way of knowing when the program is done, so the
PC can be given the starting address of another program.
the cycle of steps is very important -- it forms the basis for
understanding how a computer operates. The cycle of steps
is termed the INSTRUCTION FETCH and EXECUTE CYCLE.Thursday, May 5, 2011
The processor steps involved: 1. fetch the instruction 2. update PC 3. decode 4. load operand(s) 5. do the operation specified by the instruction 6. store result(s
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment