4.2 Computer Architecture

Nov 10, 2019

The basic concepts of Computer Architecture


OVERVIEW

  • Interrupt
  • Buffer
  • Von Neumann Architecture
    • Components Involved
    • Buses
    • Fetch-decode-execute Cycle
  • Addressing

Interrupt

  • Interrupt is a signal sent from either a software or the device directly
  • When the processor receives an interrupt signal, it’s going to stop its current task (what it’s doing now) temporarily and service the sender of this interrupt signal after saving the status of current task.
  • After interrupt’s fully serviced, the current task would be reinstated or continued. This process is controlled by INTERRUPT HANDLER
  • When might an interrupt be sent:
    • a disk drive saying it’s ready, to receive more data
    • an error occurs, like a paper jam in printers
    • the user interrupted the process by pressing a key, example: CTRL+ALT+BREAK

Buffer

  • Temporary memory area
  • Hardware devices operate much slower than processor, if no buffer processor would be idle most of the time
  • Used when there’s a difference between the rate data’s received and the rate it’s processed
  • Depth study: Buffer adjust timing with a queue algorithmsimultaneously writing data into the queue at one rate and reading it at another rate

HERE IS A MORE VIVID AND SIMPLE ILLUSTRATION:

P0LaXc.jpg

EXAMPLE OF HOW BUFFERS AND INTERRUPT ARE USED TOGETHER:

P0LhRg.md.jpg

Von Neumann Architecture

Components involved:

  • Memory Unit: storing place for computer
    • IAS – Immediate Access Store: stores data and instruction(programming statement) in one place
  • Bus: wire or conduction track on a printed circuit board
    • Data Bus
    • Address Bus
    • Control Bus
  • Registers: temporary, high-speed storage inside CPU
    • Special-purpose Register:
      • PC – Program Counter: contains the address of next instruction to be fetch and executed
      • MAR – Memory Address Register: stores the address PC is pointing at
      • MDR – Memory Data Register: stores the content of the address stored in MAR
      • CIR – Current Instruction Register: stores the instruction that’s processed currently
    • General-purposed Register:
      • Accumulator: Stores the result data or input data of ALU
  • Processor: a circuit that processes the data
    • ALU – Arithmetic and Logic Unit:
      • processor, not a register
      • It performs:

History

  • In early days, data was fed to computers when they’re running and computers can neither store programs nor run without human intervention
  • Basically, Human fetches, computer executes
  • 1945, John von Neumann brought in a brand new concept of storing programs in the computer
  • His idea was: to hold programs and data in a memory (program and data stored in the same place) and data would move, between the memory unit and the processor
  • The entire structure of von Neumann architecture is actually the structure of CPU (Central Processing Unit) in your computer, although it’s in a premature form that’s simpler.

Buses

(单向) UNIDIRECTIONAL MEANS GOING IN ONE DIRECTION

(双向) BI-DIRECTIONAL MEANS GOING IN TWO DIRECTIONS SIMULTANEOUSLY

Buses are connections between the three main parts of the von Neumann architecture
There are three buses:

  • Data Bus
  • Address Bus
  • Control Bus

THE DIAGRAM IN COURSE BOOK IS CONFUSING SO I MADE NEW ONES INSTEAD

P0LxDT.jpg

P0LAGj.jpg

P0LYTo.jpg

P0Lfom.jpg

A more detailed diagram showing address/control bus

P0LjVA.jpg

The fetch-execute cycle

  1. PC contains the address of next instruction
  2. The value in the PC is then incremented by 1 so that it now points to the next instructionwhich has to be fetched
  3. The address PC points to is copied to MAR
  4. The content of the address MAR contains, is copied to MDR
  5. The content of MDR is copied to CIR
  6. The instruction is finally decoded by control unit and then executed by sending out signals(via control bus) to the various components of the computer
  7. Repeat

This alternative version is from https://teachcomputerscience.com/fetch-execute-cycle/

Here’s a summary of the fetch – decode – execute cycle:

  • The processor reviews the program counter to see which command to execute next.
  • The program counter gives an address value in the memory of where the next command is.
  • The processor fetches the command value from the memory location.
  • Once the command has been fetched, it needs to be decoded and executed. For example, this could include taking one value, putting it into the Arithmetic Logic Unit (ALU), then taking a different value from a register and adding the two together.
  • Once this has been completed, the processor returns to the program counter to find the next command.
  • This cycle is replicated until the program stops.

The Execute Cycle is the only step useful to the user, everything else is required to make the execute cycle happen, as it performs the function of the command. The ALU is utilised if the command involves arithmetic or logical operations.


Addressing

You are not required to know this, but you should try to remember the names of these three types of addresses

  • Storing
  • Addressing
    • Direct Addressing
    • Indirect Addressing
    • Indexed Addressing
    • Immediate Addressing

Storing contents inside the computer

Pnt0Xc.jpg

Forgive me for my poor handwriting and my horrifying artworks

As you can see, although HLL and LLL are so different, they actually work in the same way:

  • Variables are stored in small spaces in the computer’s memory
  • The small spaces have their unique “box labels” or you can call them as addresses
  • 04 is the label of the box containing 1’s ascii value
    04 is the address of the content 1’s ascii value

Addressing – How do we load the things we stored

Here is a table that illustrates the four types of addressing, the format column is written in simplified assembly language:

TypeFormatWhat does it do
Direct AddressingLDD <address1>Load the content of address1 to the accumulator
Indirect AddressingLDI <address1>Load the content1 of address1 and see the content1 as address2, load the content of address2 to the accumulator.
Indexed AddressingLDX
<address1>
There is an index register in the computer. First the content of index register is added to address1 (address1 = address1 + index) then the content of address1 is loaded to the accumulator
Immediate AddressingLDM#nLoad the number n to the accumulator

reference:
https://teachcomputerscience.com/fetch-execute-cycle/
https://www.computerscience.gcse.guru/theory/fetch-execute-cycle/
my own knowledge

Edited by @alanjin at Nov. 30, 2019

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.