Main Memory |
Address | Contents |
0000 | 00101011 |
0001 |
11101111 |
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 | 11101111 |
Instruction Decoder |
|
|
Adder |
Multiplier |
Compare to Zero |
Test Equality |
etc... |
|
|
Note that the Program Counter now contains the address 0010 (green) and
the Instruction Register now contains 11101111 (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, for example, if
the instruction in this example (11101111) means to add the
contents of memory location 1101 (the contents are 01000111 - light yellow)
to the contents of memory location
1110 (the contents are 00001100 -- light yellow), the result is that memory
location 1110 will contain 01010011.
Click here to see the results.
|