CPU & Memory Interaction |
In order to illustrate how the three main components of the Central
Processing Unit interact i.e.; the Control Unit, the ALU and Memory, we will now look at
how a CPU;
|
|
(1). First Instruction |
+CPU---------Input-----------------------------------+
| +---------+ v |----------Primary Storage--------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 |8 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| | |-----------|--------|------|-----||
|| | |5 End |6 |10 |11 ||
|+------------+ | | | | ||
| | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 |8 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| | |-----------|--------|------|-----||
|| | |5 End |6 |10 |11 ||
|+------------+ | | | | ||
| | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU------------Input--------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| | |-----------|--------|------|-----||
|| | |5 End |6 |10 |11 ||
|+------------+ | | | | ||
| | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| | |-----------|--------|------|-----||
|| | |5 End |6 |10 |11 ||
|+------------+ | | | | ||
| | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| | |-----------|--------|------|-----||
|| | |5 End |6 |10 |11 ||
|+------------+ | | | | ||
| | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| | |-----------|--------|------|-----||
|| | |5 End |6 |10 |11 ||
|+------------+ | | | | ||
| | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| 25 | |-----------|--------|------|-----||
|| 40 x | |5 End |6 |10 |11 ||
|| | | | | | ||
|+------------+ | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 |10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| 25 | |-----------|--------|------|-----||
|| 40 x | |5 End |6 |10 |11 ||
|| 1000 | | | | | ||
|+------------+ | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 1000|10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| 25 | |-----------|--------|------|-----||
|| 40 x | |5 End |6 |10 |11 ||
|| 1000 | | | | | ||
|+------------+ | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 1000|10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| 25 | |-----------|--------|------|-----||
|| 40 x | |5 End |6 |10 |11 ||
|| 1000 | | | | | ||
|+------------+ | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 1000|10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| 25 | |-----------|--------|------|-----||
|| 40 x | |5 End |6 |10 |11 ||
|| 1000 | | | | | ||
|+------------+ | +---------------------------------+|
+------------Output----------------------------------+
v
+CPU---------Input-----------------------------------+
| +---------+ v |-----------Primary Storage-------||
| | Control | | Programs | Data ||
| | Unit | <-> |--------------------|------------||
| +---------+ |1 Enter |2 Enter |7 25 |8 40 ||
| ^ | First | Second| | ||
| v | Number | Number| | ||
|+------------+ |-----------|--------|------|-----||
|| Arithmetic | |3 Multiply |4 Print |9 1000|10 ||
|| Logic Unit |<->| 1st & 2nd| Result| | ||
||------------| | Numbers | | | ||
|| 25 | |-----------|--------|------|-----||
|| 40 x | |5 End |6 |10 |11 ||
|| 1000 | | | | | ||
|+------------+ | +---------------------------------+|
+------------Output----------------------------------+
v
![[Printer]](../../v2gr/v2gr_hw/hwprndm.gif)
Advanced (using Intel 80386) |
![[80386 CPU internals]](../../v2gr/v2gr_hw/80386.gif)
(Components explained below)
[Ref 79,80]
Step 1 |
1. The prefetch unit asks the Bus Interface Unit to
retrieve the instruction to add two numbers. 1.1. At the same time the segment and paging units convert the instruction's location from a virtual address to physical address, for the Bus Interface unit. |
Step 2 |
The Bus Interface Unit gets the instruction from RAM and sends it to the prefetch unit. |
Step 3 |
The Prefetch Unit forwards the instruction to the Decode Unit which forwards it to the Execution Unit. |
Step 4 |
The Control Unit sends a virtual address of the first number to be added (stored in RAM) to the Protection Test Unit. |
Step 5 |
The Protection Test Unit verifies that the control unit can access the first number and forwards it to the segment and paging units, where the virtual address is translated into a physical address for the bus interface unit. |
Step 6 |
The Bus Interface unit retrieves the number stored at that address in RAM. This number then travels through the Protection Test Unit to the Execution Unit and is stored in one of the chip's internal registers. |
Step 7 |
The second number undergoes a similar process. |
Step 8 |
The Arithmetic Unit adds the second number retrieved from RAM and the first from the internal register. |
Step 9 |
The Control unit tells the Bus interface unit to store the number in RAM. The Memory Management Unit translates the virtual address to a physical RAM address, completing the instruction. |
[Rev: 25/1/98] 16/10/97 © 1997-98 V/2-Com (Verhaart), P O Box 8415, Havelock North, New Zealand.