5 Processor Fundamentals



  • Overview of the chapter

    This chapter is the further extension of "Computer Architecture" in IGCSE.

    This is a small chapter. Mr. Luke finished all of it in just one double-period!

    5.1 Von Neumann Architecture

    • 5.1.1 Structure Overview
    • 5.1.2 CPU Architecture
      • Control Unit
      • ALU
      • Registors
    • 5.1.3 Busses
      • Control Bus
      • Data Bus
      • Address bus
      • USB

    5.2 Fetch-execute cycle
    5.3 Interrupt Handling


    5.1 Von Neumann Architecture

    The Architecture requires the following characteristics:

    • Processor
      • Has a center processing unit
      • Has direct access to memory
      • Executes instructions in sequence
    • Memory
      • Stores stored programs and data required. They are stored in same memory and treated the same.

    5.1.2 Processor Structure

    The processor consists of two sections:

    • CPU (purple) and

    • Registers (red).

    Structure of a CPU, from Computer Science Textbook

    Central Processing Unit

    Consists of two components: Control Unit and ALU.

    Control Unit ALU
    Functions 1. Control flow of data through processor -- and whole computer. 1. Handles any Arithmetic / Logic processing operation.
    2. Synchronize actions of the processor.<br /><br />Consists of two clocks to synchronize processes. <br/>- The internal clock controls cycle of activities within processor <br/>- The system clock controls activities outside the processor<br /><br />The clocks have defined frequency called clock speed. It defines the minimum period of time that separates successive activities in the system. <br/>(For example, for a 1MHz CPU, there can be only max. 1 million operations per second.)
    3. Decodes instructions for execution.

    Registers

    Main article:
    5.2 Fetch-decode-execute cycle (-> Page 4)

    Registers are storage components. Their proximity to ALU provides fast access speed.

    There are two types of register: General-purpose and Special-Purpose.

    The accumulator is the only type of general-purpose register.

    5.1.3 Busses

    Parallel, synchronized transmission device. It allows data transmission in CPU, with I/O and memory.

    The number of bytes handled as a unit is called a word. Ideally the bus width should be same as word length -- during the transmission each wire in the bus carries a bit for parallel transmission.

    Address Bus Data Bus Control Bus
    Direction Unidirectional<br/>CPU --> Memory BidirectionalI/O <-> CPU <-> Memory<br />(For some systems data from I/O can be written into memory directly) Bidirectional<br/>I/O <-> CPU <-> Memory
    Carries An address Data: instruction, address or value Control signals<br/>Timing signals for sync.

    USB: Universal Serial Bus

    Serial, not synced, bi-directional data transmission.

    • Shows the plug-and-play concept
    • A hierarchy of connection is supported, max. 127 devices.
    • Device can be attached / detached while device is on.
      • Drivers can be automatically installed for use
    • Current standard USB 3.0

    5.2 Fetch-decode-execute cycle

    This diagram describes how the cycle works.

    The fetch-decode-execute cycle does normal operation.

    After each cycle it checks for any interrupts. If there is any, the system will handle it.

    This is a summary of the registers used in the cycle. We will look at them one by one in detail.

    Summary of Some special-purpose registers.


    5.2.1 Fetch Cycle

    Register Abbreviation Function
    1. Program Counter PC Stores the address of next instruction
    2. Index Register IX Stores the amount PC will increment after the cycle — for the next data address.
    3. Memory Address Register MAR Stores the address of a memory that is going to be read / write from
    4. Memory Data Register MDR Stores the data of a memory that<br/>Is going to be written into memory or<br/>Has just been read from the memory

    Trace Table

    Here is a trace table of fetching the information from address 101. The information stored in address 101 is a command "LDA 111".

    Step Pseudocode PC data IX data MDR data MAR data CIR data
    0: PC stores address of next instruction 101 14
    1: Address is transferred to MDR MDR ← [PC] 101 14 101
    2: The control unit sends command to RAM for reading data through control bus. The address stored in MDR is sent to RAM through data bus 101 14 101
    3: The RAM sends data stored in that memory address to MAR. MDR <-[[MAR]] ⚠️Note the double brackets! 101 14 LDA 111 101
    4: [For commands only] The command is sent from MDR to CIR. CIR ← [MDR] 115 14 LDA 111 111 LDA 111
    5: The PC is incremented for next instruction PC <- [PC] + [IX] #IX usually 1 129 14 LDA 111` 101
    Steps 6 and 7 are for commands only.
    6. The instruction is decoded in CIR.
    7. The instruction is executed.

    [a] means "data stored in a". Use it in the exam!
    Steps arranged according to mark scheme of s15_11, Q8.


    5.2.2 Decode cycle

    If the data fetched is a commend, then it is sent and stored in CIR.

    The control unit then decodes it. The ALU will be activated for any arithmetic / logic calculations.

    Registers Abbreviation Function
    Current Instruction Register CIR Stores current instruction for decoding and execution.

    5.2.3 Execute cycle

    Main article: Chapter 6, Assembly language programing_

    If the data requires calculation, then it is executed in the ALU unit.

    Registors Abbreviation Function
    Accumulator <br/>(The only General-purpose register) ACC Stores the value before and after ALU operation.

    5.2.4 Other registers

    Registers Abbreviation Function
    Status Register SR Contains a combination of bits to indicate results, e.g. <br/>a) Overflow <br/>b) Carry bit <br/>c) Interrupt received

    5.3 Interrupts

    A signal sent to the processor, seeking for its attention.

    Different interrupts have different priorities. Interrupt is only detected at the end of fetch-execute cycle by checking status register.

    After detection of interrupt the interrupt service routine (ISR) is initiated. Its start address is loaded into PC, and a fetch-decode-execute cycle for the ISR will be started.

    After handling all interrupts the original program is reloaded into the registers, and the original program is resumed.

    Examples of interrupts

    Software

    • Fatal Error
    • User interrupt (Ctrl + Alt + Del)
    • Timer signal

    Hardware fault

    • Request of I/O to begin
    • Paper jam

Log in to reply