Preview

07 - Fetch Decode Execute cycle #2

 1. When a program is being executed, the CPU implements the fetch – decode – execute cycle, which recurs over and over again until arriving at the STOP instruction. Read the excerpt below - what happens in step 4?
1-------------------	
The PC contains the address of the memory location that has the next instruction which has 
    to be fetched	

2--------------------
This address is then copied from the PC to the MAR via the address bus

3--------------------	
The contents (instruction) at the memory location (address) contained in MAR are then 
    copied into the MDR

4--------------------	
____________________________________________________________________________?	
    

5--------------------	
The value in the PC is then incremented by 1 so that it now points to the next instruction 
     which has to be fetched. 

6--------------------	
The instruction is finally decoded and then executed by sending out signals (via control bus) to the various components of the computer	The instruction is decoded and then executed

7--------------------	
Repeat

  The contents (instruction) in the MDR is then copied and placed into the CIR

  The contents (instruction) in the CIR is then copied and placed into the MDR

  The contents (instruction) in the CPU is then copied and placed into the Program Counter

  The contents (instruction) in the MAR is then copied and placed into the ALU

 2. The program counter .....

  contains the data that needs to be next executed

  contains the bits and bytes to be programmed

  contains the address of the next instruction

  contains the program itself

 3. Why does point #5 have to be done?
1-------------------	
The PC contains the address of the memory location that has the next instruction which has 
    to be fetched	

2--------------------
This address is then copied from the PC to the MAR via the address bus

3--------------------	
The contents (instruction) at the memory location (address) contained in MAR are then 
    copied into the MDR

4--------------------	
____________________________________________________________________________?	
    

5--------------------	
The value in the PC is then incremented by 1

6--------------------	
The instruction is finally decoded and then executed by sending out signals (via control bus)
to the various components of the computer	The instruction is decoded and then executed

7--------------------	
Repeat

  so that +1 is added to tell the ALU what to do

  so that it points to the first instruction again

  so that it keeps up with the CPU clock

  so that it points to the next instruction which has to be fetched.

 4. Read the excerpt and fill in the blanks. (The same word fills in the blank throughout this simple description of the FDE cycle)
If the first instruction to be carried out in a program in RAM was in memory 
location 2435 (see the diagram above), the operating system puts 2435 into the ______________.


When the CPU is ready to run the program, it looks in the_________________ sees 2435 
and fetches whatever is at that location. 

Automatically, once 2435 has been fetched, the _____________________increases by one, 
to 2436. 

When the CPU has finished fetching, decoding 
and executing the instruction, it simply goes back to the __________________, looks at the 
address in there and repeats the above process, increasing the ________________ by one 
every time an instruction has been fetched. This is a very simple but effective way for 
the CPU to know what to do next. 

Note that the CPU can do all of this really quickly - literally billions of times a second!

  program counter

  RAM

  accumulator

  ALU

 5. Analyse the diagram of the Fetch Decode execute cycle below. You may want to draw it out yourself. The decoding in this cycle is done by:
800px-Comp_fetch_execute_cycle.png

  The CPU's ALU

  The CPU's Accumulator

  The CPU's Control Unit (CU)

  The CPU's RAM