CPU Fetch-Execute Cycle and Computer Architecture, Slides of Information Systems

The fetch-execute cycle of a CPU, the role of memory and registers, and the architecture of a computer system, including input/output devices and buses. It also covers the use of virtual memory and the importance of ergonomics in human-computer interaction.

Typology: Slides

2019/2020

Uploaded on 11/08/2020

nnniii8
nnniii8 🇸🇦

5 documents

1 / 59

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Kingdom of Saudi Arabia
Ministry of Higher Education
Al-Imam Muhammad Ibn Saud Islamic University
College of Computer and Information Sciences
Chapter 2
Notes
Ch2: Computer Hardware
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b

Partial preview of the text

Download CPU Fetch-Execute Cycle and Computer Architecture and more Slides Information Systems in PDF only on Docsity!

Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter 2 Notes

Ch2: Computer Hardware

Computer Organization

  • (^) The structure of the components in the computer
  • (^) The function of those components
    • (^) How the CPU works
    • (^) The role of memory
    • (^) The role of I/O devices
  • (^) How to assemble a computer

The Structure of the Computer

The System Bus

The Bus continued

  • (^) Data bus:
    • (^) Used to send data and program instructions
      • (^) from memory to the CPU
      • (^) from the CPU to memory
      • (^) between I/O device and the CPU
      • (^) between I/O device and memory
    • (^) Size of data bus is often size of computer’s word

Memory Read

Fetch-Execute Cycle

  • (^) To execute a program, the CPU performs the fetch-

execute cycle

  • (^) Fetch next instruction from memory
  • (^) Decode the instruction
  • (^) Execute the instruction
  • (^) Store the result

Example: A Program

  • (^) We use the following C program to better understand the

fetch-execute cycle

#include <stdio.h> // input/output library

void main( ) // start of the program

int a, b, c; // use 3 integer variables

scanf(“%d”, &a); // input a

scanf(“%d”, &b); // input b

if(a < b) // compare a to b, if a is less then b

c=a + b; // then set c to be their sum

else c=a-b; // otherwise set c to be their difference

printf(“%d”, c); // output the result, c

Program in Machine Language

  • (^) Assembly language version of our C program is stored in

the computer in machine language

  • (^) The first four instructions might look like this:
1000100 0000000000000000000100001 – input (from keyboard)
1000111 0010011000100101101010001 – store the datum in a
1000100 0000000000000000000100001 – input (from keyboard)
1000111 0010011000100101101010010 – store the datum in b
op code operand (datum)

Fetch-Execute Cycle

Registers Continued

  • (^) IR – instruction register
    • (^) Current instruction
    • (^) Used during decoding
  • (^) Status flags
    • (^) To store information about the result of the previous ALU operation
      • (^) positive, negative, zero
      • (^) even or odd parity
      • (^) carry
      • (^) overflow
      • (^) interrupt

Fetch-Execute Cycle: Details

  • (^) Fetch:
    • (^) PC stores address of next instruction
    • (^) Fetch instruction at PC location
    • (^) Increment PC
    • (^) Instruction sent over data bus
    • (^) Store instruction in IR
  • (^) Decode:
    • (^) Decode opcode portion in IR
    • (^) Determine operand(s) from instruction in IR Input 33 Store a Input 33 Store b Load a Subt b Jge else Load a Add b Store c Jump next else: Load a Subt b Store c next: Load c Output 2049 Halt

Fetch-Execute Cycle: Example

  • (^) Assume our program starts at location 5,000,
    • (^) PC: 5,000,
    • (^) IR: -------
  • (^) Fetch instruction
    • (^) PC: 5,000,
    • (^) IR: 1000100 0000000000000000000100001
    • (^) Increment PC to 5,000,
  • (^) Decode instruction
    • (^) Input operation (obtain input from keyboard)
  • (^) Execute:
    • (^) Take input value from keyboard
    • (^) Move to AC

Continued

  • (^) Fetch instruction
    • (^) PC: 5,000,
    • (^) IR: 1000111 0010011000100101101010001
    • (^) Increment PC to 5,000,
  • (^) Decode instruction
    • (^) Store datum to memory location 0010011000100101101010001
(memory location storing variable a)