Computer Architecture Fundamentals
ntroduction to Computer Architecture
Role and CompoInents
Overview of computer architecture. The main topics include the role and components of a computer, computer memories, principles of instruction execution, and the interruption mechanism.
The Different Levels of a Computer Machine
Hardware: The physical machine, including the processor, central memory, and peripherals, all communicating via a bus.
Operating System (OS) Software: Acts as an interface between the hardware and application software, allowing applications to use hardware resources. Examples of OSs include but not limited to Windows, Linux, and macOS.
User Software: Programs that allow users to perform tasks on the machine.
The Role of a Computer
Execute data processing programs to solve problems.
Requires:
The problem and its solution to be expressed in a computer-understandable language.
A structure made up of elements for storage, processing, and reading/writing of data.
Example: Calculating the Perimeter of a Rectangle
Problem: Calculate the perimeter of a rectangle given its length and width .
Algorithm:
Perimeter := 2a + 2bCode (using a programming language):
function perimeter (a, b : integer) return integer is begin Perimeter := (2 * a) + (2 * b); end;
The high-level language program is translated by a compiler and interacts with the operating system to manage hardware resources.
The program is translated into machine instructions and binary values for execution by the physical hardware.
Components of the Computer
Transistors
Arithmetic and Logical Unit (ALU)
Registers
Operation Watch
Sequencer
Decoder
Logical or integral circuits
Functions and Components
The computer allows users to:
Perform calculations.
Store data.
Communicate.
Physical components:
Peripherals: Allow communication between the computer and humans.
Processor (CPU): Executes program instructions.
Computer Memories: Store data.
Computer Buses: Enable communication between different components (peripherals, processor, memory).
The Computer Motherboard
The motherboard is the base for connecting all essential elements.
Includes:
Power supply connector
RAM slots
Processor socket
USB ports, sound connectors, network connectors
Disk connectors
The Processor
The processor (CPU - Central Processing Unit) is the brain of the computer.
Handles data and instructions coded in binary form.
An electronic circuit clocked to the rhythm of an internal clock which sends impulses, called "top".
The clock frequency is measured in hertz (Hz), corresponding to the number of pulses per second.
Made up of millions of transistors in a case (integrated circuit or chip) surmounted by a cooler.
Example: Computing at 200 MHz means the clock sends 200,000,000 beats per second.
Computer Peripherals
Devices connected to a computer through input-output interfaces (HDMI, USB, etc.).
The interface is controlled by a driver.
Peripheral categories:
Output devices: Emit information (screen, printer).
Storage devices: Store information permanently (hard drive, flash key).
Input devices: Send information to the computer (mouse, keyboard).
Input-Output peripherals: Both input and output (hard drive).
Computer Memories
Memory is an electronic component capable of temporarily storing information.
Characterized by:
Capacity: The overall volume of information it can store.
Access Time: The time interval between the read/write request and data availability.
The computer contains different levels of memory, organized according to a memory hierarchy.
Memory Units: The Bit and Byte
The basic data unit is the bit (Binary Digit), which has two values: 0 and 1.
combinations can be represented with bits.
0 and 1 correspond to voltage levels (0-1 and 2-5 volts) for electrical signals of transistors.
Memory Prefixes
Kilo (KB): 1,024 Bytes
Mega (MB): 1,024 Kilobytes
Giga (GB): 1,024 Megabytes
Tera (TB): 1,024 Gigabytes
Peta (PB): 1,024 Terabytes
Memory Categories
Volatile Memory: Content exists only with an electrical supply (RAM, central memory).
Permanent Memory: Mass memory that retains content without power (hard drive, USB key, CD, DVD).
The Hierarchy of Computer Memories
Live Memories (Volatile)
Mass Memories (Permanent)
Memory Type | Size | Access Time |
|---|---|---|
Registers | n bits (32,64) | 1 nanosecond |
Cache Memories | Kilo Bytes | 5 nanoseconds |
Central Memories | Giga Bytes | 10 nanoseconds |
Mass Memories | Tera Bytes | 5 milliseconds |
Memory Types: Live Memories
Live Memories or RAM (Random Access Memory)
Accessible in reading and writing.
Internal volatile memory.
Composes the central memory and the covers.
Two structures:
DRAM - Dynamic RAM (Access time: 60 nano seconds)
SRAM - Static RAM (Access time: 5 nano seconds)
DRAM (Dynamic Random Access Memory)
Composes central memory.
DIMM bar (Dual Inline Memory Module).
Access time: 60 nano seconds.
Operation: One memory cell memorizes a bit and is made up of a transistor and a capacitor.
The capacitor discharges over time, requiring periodic recharging (refreshment of memory).
SRAM (Static Random Access Memory)
Composes the covers (CPU and MMU cache).
Access time: 10 nano seconds, more expensive and bulky than DRAM.
Operation: One memory cell memorizes a bit and is made up of 4 to 6 transistors.
Dead Memory : ROM (Read Only Memory)
Reading accessible memory (150 ns)
Internal non -volatile memory.
Once the information has been recorded, it cannot (or hardly) be modified.
Flash memories
Compromise between the two types of memory:
Accessible memory in reading and writing
Non -volatile memory
Access time more important than RAM
Central Memory
Made up of a set of memory words (32 bits).
Contains the instructions and data of the programs to be executed.
A word is made up of a set of bytes; each byte is uniquely identified by an address.
Interfaces with the CPU via the Memory-CPU bus.
Central Memory Addressing
The processor communicates with memory cells via a bus.
Includes selection, data transfer, and input/output buffer.
Central Memory: Writing
Involves selecting a memory address, transferring data via the data bus, and writing the data.
The Hierarchy of Memories: Cache Example
Cache memory is an intermediate storage area between the CPU and main memory (RAM).
Speeds up data access by providing faster access times (4 to 20 times faster than main memory).
Has a limited number of entries or capacity, measured in the number of words it can store.
Cache Memory: Principle (1)
Check if the sought information is in the cache.
If YES (Success): Bring the information into the CPU.
If NO (Miss): Search for the information in main memory.
If the information is in main memory:
Bring the information into the cache and then into the CPU.
Cache Memory: Principle of Temporal Locality
Temporal locality: If data at address A is accessed at time T, it's likely to be accessed again at times T+1, T+2.
The data is kept in the cache to minimize access time.
Cache Memory: Principle of Spatial Locality
Spatial locality: If data at address A is accessed at time T, it's likely that neighboring addresses will be accessed at times T+1, T+2.
Address A and neighboring addresses are kept in the cache to minimize access times.
Cache Memory: Cache in Reading
The processor attempts to read data from a specific address A.
The processor checks the data in the cache.
Load Cache with (a) and its neighbors load processor with (a)
Principles of Instruction Execution
Central Memory Stack
Memory capacity: bytes, words.
Address: 8 bits.
A particular area of memory is managed as a stack structure.
Identified by the RSP register of the processor.
Management policy: LIFO (Last In, First Out).
Functioning of a Stack: LIFO Policy
The stack is an area of central memory made up of a set of words.
Only the word at the top of the stack is accessible. Its address is in the RSP processor register.
Two authorized operations:
Push: Add a word to the top of the stack.
Pop: Remove the word from the top of the stack.
The Stack: Push Operation
Push r0:
The content of the R0 register is written to the word whose address is (RSP).
RSP is incremented.
The Stack: Pop Operation
Pop R1:
RSP is decremented.
The content of the word whose address is (RSP) is put in register R1.
Processor (Central Unit)
The register is the memorization entity manipulated by the processor.
OC (Ordinal Counter): Contains the address of the next instruction to be executed.
IR (Instruction Register): Contains the investigation in progress.
Processor (Central Unit): ALU
The arithmetic and logical unit (ALU) constitutes the processor execution unit.
Circuits for arithmetic (addition, multiplication, division) and logical operations (complement to 2, inverse, OR, AND) on operands Y1 and Y2.
A PSW state register contains indicators positioned by the result Z of operations carried out.
Execution of a Program
The program, composed of machine instructions and data, is loaded into central memory by a loader tool.
The ordinal counter (CO) is loaded with the address in central memory of the word containing the first instruction of the program.
The execution of the program is carried out by successive instructions, under the management of the processor control unit.
The processing of an instruction by the processor is cut into three stages:
FETCH: The instruction is read from central memory and copied into the processor's RI register.
DECODE: The instruction is recognized by the decoding unit.
EXECUTE: The operation corresponding to the instruction is carried out.
Material Interruptions
Concept of Interruptions
The execution of a program is carried out instruction after instruction.
An interruption is a mechanism to stop the execution of the current program in order to perform a task deemed more priority.
An interruption makes it possible to report an event on the machine and to perform a specific treatment (service program or interruption routine) linked to this event.
It prevents the processor from scrutinizing the peripherals
There are mainly two types of events:
External or material interruptions: Emitted by processor peripherals (end of disc writing, printer paper…). These are the IRQs.
Internal or software interruptions: Issued by the processor itself when it encounters an error in the execution of the program (division by zero, illegal memory access). These are the hatches.
Interruption Mechanism
A device signals an event to the processor by issuing a hardware interruption.
The processor tests its interruption entry line (INTR) before starting the processing of the following instruction of the program it executes.
Interruption Mechanism steps
The controller sends an interruption signal: INTR
The CPU acquitted with the INTA signal
The controller transmits an interruption number.
This number indexes a table in central memory called the interruption vector, which, for each interruption number, gives the address of the associated routine in central memory.