Fundamentals of computer organisation and architecture

Table of Contents

Author: Mrs Ellis

1 Internal hardware components of a computer

Learn It - Internal hardware components of a computer

Objective: Have an understanding and knowledge of the basic internal components of a computer system.

Internal components

The internal components of a computer normally include CPU, components within a CPU, main memory, buses and I/O controllers. The following block diagram shows how different components of a computer working together as a functional system. Computer-Components.png

Processor, ALU, Control Unit,Registers, Memory

Objective: understand the role of the following components and how they relate to each other:

  • Processor

    The processor is made up by the control unit, the arithemetic logic unit(ALU) and several registers.

  • The control unit
    • The control unit controls and coordinates all operations.
    • It works through a cycle of fetch, decode, and execution.
      • fetch operation fetches the next instruction from the main memeory
      • decode operation outputs what the ALU needs to perform on the data
      • execution operation causes the instruction to be carried out
    • The role of control unit can be summarised as below:
      • To fetch / decode / execute instructions;
      • To synchronise operation of processor;
      • To marshal/control operation of fetch-execute cycle;
      • To send control signals/commands to other components of fetch-execute cycle;
  • Registers
    • Registers are small but very fast memory to hold data before and after being processed by the CPU.
    • All ALU operations are accomplished within registers.
  • ALU

    ALU performs addition, subtraction, multiplication, division, comparison(logical ops), and bitwise operations (more later).

  • Memory
    • Memory is used to hold temporary instructions and data for manipulation while the system is running.
    • When a block of code or data that is held in memory, it is directly accessible to the CPU for manipulation.
    • Memory is organised in units called words. A word is the maximum number of bits a CPU can process in a single instruction. Typical word size are 8, 16, 32, or 64 bits.
    • Each word has its own address in the memory.

Buses - data bus, control bus and address bus

Objectives: Understand the need for, and means of, communication between components. In particular, understand the concept of a bus and how address, data and control buses are used.

Components communicate with each other using buses. A bus is a set of parallel wires connecting different coomponents. The processor is connected to the main memory by three separate buses. The three types of buses:

  • Address bus
    • Address bus is a pathway or a set of parallel wires that carries the location of the data to be read from or written to. An address bus is one directional only - from the processor to the memory or an I/O controller.
    • The number of lines for the address bus determines the maximum number of bits it can carry, and in turn determines the maximum possible memory capacity of the computer. To understand this, think if the postal office only allows 3 digits for house numbers, then the maximum addressable houses will be 999. So, if the computer has a 32-bit bus, the maximum addressable memory locations will be 232, which is 4GB, assuming each memory location stores on byte of data.
  • Data bus
    • Data bus is a bi-directional pathway or wires that carries data or instructions between computer components.
    • The width of data bus is a key factor in determining the overall computer performance. Typical data bus is 8, 16, 32 or 64 bits wide. If a computer has a word size of 32 but with a 16-bit data bus, then the data bus has to fetch the word twice from the main memory.
  • Control bus
    • Control bus is a bi-directional pathway that carries command, timing and specific status information among components. The following are some of the control information a control bus may carry:
      • write to mempry
      • read from memory
      • write to I/O port
      • read from I/O port
      • request for data bus
      • grant for data bus
      • sync clock
      • reset all components
  • I/O controllers
    • An I/O conyroller is a device (an electronic circuit board) that manages the communication between the processor and the I/O device.
    • Each I/O device has a separate controller which connects to the control bus.
    • I/O controllers receive input and output requests from the pocessor, then send device specific control signals to the device.
    • I/O controllers manage the data flow from and to the device.

The von Neumann and Harvard architectures

Objectives: Be able to explain the difference between von Neumann and Harvard architectures and describe where each is typically used.

  • von Neumann architecture and the stored program concept

    Computer pioneer John von Neumann invented a machine that would hold the instruction and the data to be processed in one single store, the main memory. All computers since then have been built on the same principle.

    vonNeumann.gif

    • In this architecture, the CPU performs the basic computing operations (add, subtract, etc.).
    • The CPU gets its data from an external memory, and writes back the results to the memory.
    • The memory is also used to hold the program instructions, which control the processing unit and tell it how to manipulate the data.
    • The idea of keeping both the data and the instructions in the memory is the essence of the stored-program architecture.
    • von Neumann architecture used for general purpose computers.
  • Harvard architecture - physical separation of data and instructions
    • In this architecture of computers, the data and instructions are stored at two physically different memories. This separation allows some systems to have a read only instruction memory and read-write for data memory. If a system has more instructions than data, then wider address bus can be used for the instruction memory and less wide bus for the data memory.
    • Harvard architecture can be faster than von Neumann architecture because data and instructions can be fetched simultaneously.
    • Embedded systems such as digital signal processing (DSP) systems use Harvard architecture processors extensively.
    • In embedded systems, instructions may be held in read-only memory while data are held in read-write memory.
    Harvard architecture" by Nessa los - Own work. Licensed under CC BY-SA 3.0 via Commons

Understand the concept of addressable memory.

2 The stored program concept

Learn It - describe the stored program concept

The stored program concept has the following properties:

  1. A machine has the instructions and data being held in the same memory.
  2. Machine code instructions stored in main memory are fetched, decoded and executed by a processor one at a time.

3 Structure and role of the processor and its components

Learn It - The processor and its components

Objective: Explain the role and operation of a processor and its major components:

  • arithmetic logic unit: A circuit inside a CPU performs the following functions:
    • ADD, SUBTRACT, MULTIPLY, DIVIDE
    • Arithmetic(signed bit patterns) and logic shift(unsigned bit patterns) on instructions within a register
    • Performs logical operations such as AND, XOR, OR, NOT.
  • control unit:
    • It controls and coordinates the activities within the CPU and control the flow of data in and out of CPU.
    • It takes an instruction and decodes it into opcode and operands.
    • It manages the execution of the decoded instrcutions, fetches data from location and stores the resultst in memory or registers.
  • clock:
    • The system clock is used to synchronise CPU operations.
    • It generates series of signals of alternating 0 and 1.
    • The CPU takes at least one cycle of time (from 0 to 1 or from 1 to 0) to perform one instruction.
  • general-purpose registers:
    • Registers are very fast and small memory inside CPU to hold data before, during and after being processed by the CPU
    • Typically, a CPU can have up to 16 registers
    • Some CPUs only have one general purpose register, called accumulator.
  • dedicated registers, including:
    • program counter(PC): a special purpose register that holds the address of the next instruction.
    • current instruction register(CIR or IR): holds the currently being executed instruction.
    • memory address register(MAR): holds the memory address of an instruction to be fetched or written to.
    • memory buffer register(MBR): a.k.a. memory data register(MDR), holds the data fetched from or written to memory.
    • status register(SR): holds the bits to indicate the results of the execution of an instruction, such as oervflow, negative, zero or carry over.

processor.jpg

Learn It - The Fetch-Execute cycle and the role of registers within it

Objective: Explain how the Fetch-Execute cycle is used to execute machine code programs, including the stages in the cycle (fetch, decode, execute) and details of registers used.

When each instruction of a program is being processed by the CPU, it goes through the cycle of three stages:

  1. fetching: retrieves a program instruction from its memory
  2. decoding: determines what actions the instruction requires
  3. executing: carries out the decoded actions

Registers' roles in the fetch-decode-execution cycle can be illustrated in the following flowchart.(You should get familar with the flowchart).

Fetch:

  • contents of PC transferred to MAR
  • address bus used to transfer this address to main memory
  • contents of addressed memory location moved into the MBR by the data bus increment PC

Decode:

  • decode instruction held by the CIR by the control unit
  • instruction split into opcode and operand

Execute:

  • if necessary,data is fetched
  • the opcode identifies the instruction to execute
  • execute instruction by relevant part of processor
  • result stored in accumulator

Learn It - The processor instruction set

Understand the term ‘processor instruction set’ and know that an instruction set is processor specific.

  • Processor instruction set means “all the instructions supported by its hardware”
  • different processors have different instruction sets
  • typical instruction set includes the following common operations:
    • LOAD, STORE - data handling and memory operations
    • ADD, SUBTRACT, DIVID, MULTIPLY etc - arithmetic operations
    • >, <, = etc - comparison operations
    • AND, OR, XOR, NOR, NOT etc - logical operations
    • Control flow operations - conditional or unconditional
    • Logical shifts
    • Halt

Know that instructions consist of an opcode and one or more operands (value, memory address or register).

  • machine instruction is made of two parts:
    • opcode: the operation to be performed, and a 2-bit code indicate addressing mode used for the operation
    • operands: the value, memory address or register to be operated on

Learn It - Addressing modes

Understand and apply immediate and direct addressing modes.

  • machine instruction is made of two parts:
    • opcode: the operation to be performed
    • a 2-bit code indicate addressing mode used for the operation
  • addressing modes
    • immediate addressing: the operand is the actual value to be operated on.
    • direct addressing: the operand holds the memory address of the value to be operated on.
Suppose that the opcode 010 means LOAD and the addressing mode 1 indicates direct addressing.
Describe the operation that will be performed by the following machine code instruction:
0101 1100

The above instruction means: LOAD the value from the memory location at 12.

Learn It - Machine-code/assembly language operations

  • Understand and apply the basic machine-code operations of:
    • load
    • add
    • subtract
    • store
    • branching (conditional and unconditional)
    • compare
    • logical bitwise operators (AND, OR, NOT, XOR)
    • logical
      • shift right
      • shift left
    • halt.

    Use the basic machine-code operations above when machine-code instructions are expressed in mnemonic form- assembly language, using immediate and direct addressing.

    • First generation languages: machine code-machine dependant and made of 0s and 1s. Machine code is very difficult to read and debug.
    • Second generation languages: assembly code / assembly language- machine dependant.
      • Assembly code uses mnemonics to represent the operation codes and addresses.
      • Assembler translates assembly code into machine code.
      • mnemonics examples: LDR, STR, ADD, SUB, MOV, CMP
    • 3rd generation languages: high level programming languages, such as Python, Java, C family etc, which have the following characteristics:
      • high level of separation from hardware (less dependant on the types of hardware)
      • easier for programmers to solve problems and debug
      • closer to human language
  • Assembly Language Operations

    The following are some examples of using assembly code. For the list of operations used, please see this page.

    1. Add 12 to the number stored in memory location 52 and save the result in memory location 53.
      LDR R0, 52          ; load the contents of location 52 into register 0
      ADD R1, R0, #12     ; add 12 to register 0 and store result in register 1
      STR R0, 53          ; store the result in memory location 53
      
    2. Branching operation 1:
            CMP R1, 40   ; Compare value in memory location 40 with value in R1
            BGT .next    ; if R1 value is greater, go to label .next 
      
      .next      HALT    ; label .next which just halts
      
    3. Branching operation 2:
      CMP R1, #100   ; Compare number 100 with value in R1
      BNE .loop1    ; if they are not equal, go to label .loop1
      
    4. Write assembly code for the following pseudo-code:
      pseudo-code:
          X <—- 0
          repeat
           X<—-X + 1
          until X = 99
      
            CMP R1, #100   ; Compare number 100 with value in R1
            BNE .loop1    ; if they are not equal, go to label .loop1
      

Learn It - Factors affecting processor performance

Objective: Explain the effect on processor performance of:

  • multiple cores
  • cache memory
  • clock speed
  • word length
  • address bus width
  • data bus width

4 External hardware devices

Learn It - Input and output devices

Know the main characteristics, purposes and suitability of the devices and understand their principles of operation.

barcode reader

  • what is barcode?
    • you have seen barcodes appear on all products you buy, and you have seen barcodes being scanned at grocery checking out point. Barcodes have been used to keep track of anything accurately since 1970s. There are two types of barcodes:
      • linear barcode (1D): the ones with vertical stripes of various thickness.
      • 2D barcode: the quick response (QR) code can hold more information than a linear barcode. You normally seen those on train tickets, flight tickets, and concert tickets. Smartphones have apps to allow users to scan QR code to take them to a website or other informations.
  • barcode reader
    • There are four types of barcode readers:
      1. laser scanners
        • Often seen in supermarket checkout counters. They use laser beams as the light source to digitise the code. The intensity of the light reflected back from the light source and generates a waveform that is used to measure the widths of the bars and spaces in the barcode. Dark bars in the barcode absorb light and white spaces reflect light so that the voltage waveform generated is an exact duplicate of the bar and space pattern in the barcode. This waveform is decoded by the scanner in a manner similar to the way Morse code dots and dashes are decoded.

          barcodAN.gif

      2. Camera-based readers
        • Camera based readers that use a small video camera to capture an image of a barcode. The reader then uses sophisticated digital image processing techniques to decode the barcode.
      3. Charge-couple Devices(CCD) readers
        • CCD (Charge Coupled Device) readers use an array of hundreds of tiny light sensors lined up in a row in the head of the reader. Each sensor measures the intensity of the light immediately in front of it. The important difference between a CCD reader and a pen or laser scanner is that the CCD reader is measuring emitted ambient light from the barcode whereas pen or laser scanners are measuring reflected light of a specific frequency originating from the scanner itself.– from http://www.taltech.com/
      4. Pen-type readers
        • Pen type readers consist of a light source and a photo diode that are placed next to each other in the tip of a pen or wand. To read a barcode, you drag the tip of the pen across all the bars in a steady even motion. The photo diode measures the intensity of the light reflected back from the light source and generates a waveform that is used to measure the widths of the bars and spaces in the barcode. pen-type-reader.jpg

digital camera

  • digital cameras use a grid of tiny light sensors to measure the amount of light passing through the lens when the shutters are open.
  • each sensor measures the colour and brightness of the each pixel.
  • each sensor turnes the light into electricity and the amount of charge is stored as binary data.
  • the binary data are then recorded onto the camera's memory card.
  • images then can be produced using appropriate image software.

laser printer

  • A laser printer uses powdered ink, called toner.
  • A computer sends data to be printed to a laser printer and the laser printer's onboard circuit works out how to print the data.
  • The printer generates a bitmap of the data.
  • A photoreceptor drum is given a positive charge spread uniformly across its surface.
  • the circuit activates the laser to make it draw the image of the page onto the drum. The laser beam doesn't actually move: it bounces off a moving mirror that scans it over the drum. Where the laser beam hits the drum, it erases the positive charge that was there and creates an area of negative charge instead. Gradually, an image of the entire page builds up on the drum: where the page should be white, there are areas with a positive charge; where the page should be black, there are areas of negative charge.
  • An ink roller touching the photoreceptor drum coats it with tiny particles of powdered ink (toner). The toner has been given a positive electrical charge, so it sticks to the parts of the photoreceptor drum that have a negative charge.
  • A sheet of paper from a hopper on the other side of the printer feeds up toward the drum. As it moves along, the paper is given a strong positive electrical charge.
  • When the paper moves near the drum, its positive charge attracts the negatively charged toner particles away from the drum. The image is transferred from the drum onto the paper but, for the moment, the toner particles are just resting lightly on the paper's surface.
  • The inked paper passes through two hot rollers (the fuser unit). The heat and pressure from the rollers fuse the toner particles permanently into the fibers of the paper.
  • Laser printer is best suited for text printing and for photo-realistic printing, it is best to use inkjet printers.

RFID

  • RFID - Radio Frequency Identification.
  • Used for tracking animals, bank cards, passports and other products.
  • It can be read remotely, up to 300 metres away.
  • RFID contains a tiny microchip transponder and an antena.
  • Very small in size, therefore can be implanted in animals.

Learn It - Secondary storage devices

Explain the need for secondary storage within a computer system.

Know the main characteristics, purposes, suitability and understand the principles of operation of the following devices:

  • hard disk
  • optical disk
  • solid-state disk (SSD) SSD = NAND flash memory + a controller that manages pages, and blocks and complexities of writing. Based on floating gate transistors that trap and store charge. A block, made up of many pages, cannot overwrite pages, page has to be erased before it can be written to but technology requires the whole block to be erased. Lower latency and faster transfer speeds than a magnetic disk drive.

Compare the capacity and speed of access of various media and make a judgement about their suitability for different applications.

5 Past exam questions

Question 1: Jun 2013

State the full names of two of the special purpose registers that are used in the fetch part of the fetch-execute cycle.

Question 2: Jun 2013

Figure 1 below is an incomplete diagram of the fetch-execute cycle. Describe the missing steps 1, 2b and 4 using either register transfer notation or a written description. Steps 2a and 2b occur at the same time. 3-7-figure-1.png

Question 3: Jan 2012

Provide the full names for the components numbered 1 to 3 in Figure 4. 3-7-figure-4.png

Question 4: Jan 2012

  1. What is the role of the Control Unit?
  2. State the full name of the processor component that would perform subtraction and comparison operations.
  3. What is meant by the term register?
  4. State one example of when the status register might have a bit set