Main Memory |
Address | Contents |
0000 | 00101011 |
0001 |
10001110 |
0010 | 10101001 |
0011 | 00000000 |
0100 | 10001011 |
0101 | 00011000 |
0110 | 11111111 |
0111 | 01100010 |
1000 | 00101000 |
1001 | 11110000 |
1010 | 10101011 |
1011 | 10111100 |
1100 | 11010000 |
1101 |
01000111 |
1110 |
00001100 |
1111 | 10001001 |
|
CPU |
|
|
Program Counter |
0010 |
Instruction Register | 10001110 |
Accumulator | 00001110 |
Instruction Decoder |
|
|
Add Circuit |
Subtract Circuit |
Compare to Zero Circuit |
etc... |
|
|
Note that the Program Counter now contains the address 0010 (green) and
the Instruction Register now contains 10001110 (light blue). The Fetch-Execute
cycle continues with step 2.
Step 2: The instruction is decoded; that is, the Control Unit
"figures out" what the instruction is (is it an add instruction?
a multipliy?). This is done by the Instruction Decoder. Basically
the 0s and 1s of the instruction go into the decoder (imagine 8 wires going
into the decoder, one for each of the 0s or 1s in the instruction ... a 0
means there is no voltage on the wire (OFF); a 1 means there
is voltage (ON)). The decoder then has wires coming out; the current
on those wires indicates what the instruction is.
Step 3: The Control Unit signals the appropriate unit (the ALU,
for example) to execute the instruction. These signals are basically
carried on the wires coming out of the decoder.
At this point the instruction is executed. So, in our
simple computer
the instruction in this example (10001110) means to subtract the
contents of memory location 1110 (the contents are 00001100 - pink)
from the contents of the accumulator
(the contents are 00001110 -- pink), the result
00000010 will be stored in the accumulator.
Click here to see the results.
|