Docsity

Computer organization and assembly language introduction, Lecture notes of Computer Architecture and Organization

Partial preview of the text

Download Computer organization and assembly language introduction and more Lecture notes Computer Architecture and Organization in PDF only on Docsity!

Computer Organization & Assembly Languages Introduction

Defining a Computer System

  • A computer system combines

hardware, software, and data.

  • Hardware: CPU, memory, I/O
  • Software: OS and apps
  • Data: Raw facts turned into information.
  • Understanding all parts helps

trace how instructions turn into

actions.

Computer Architecture & Computer Organization Computer Architecture is like the blueprint of a house. It specifies the layout, rooms, and purpose of each space. Computer Organization is like the construction process: how bricks, wiring, plumbing, and materials are arranged to make the blueprint a reality.

Key Differences b/w Computer Architecture & Computer Organization Aspect Computer Architecture Computer Organization Definition Conceptual design and functional behavior of a computer system Physical implementation of components and their interconnections Focus Instruction set, addressing modes, data types, performance optimization Control signals, memory hierarchy, CPU registers, hardware wiring Perspective Programmer’s view – what the system can do Engineer’s view – how the system achieves it Examples RISC vs. CISC instruction sets, pipeline design, cache strategies Microarchitecture, bus systems, memory modules, ALU design Level of Abstraction High-level, abstract design Low-level, concrete implementation Design Stage Developed first, serves as a blueprint Comes later, realizing the architecture in hardware

CPU Structure

CPU Structure (cont.) ALU: Performs addition, subtraction, AND, OR, Comparisons Control Unit: Fetches, Decodes and Executes instruction Registers:

  • (^) In computer organization, registers are Small high-speed memory inside CPU.
  • (^) used to hold data temporarily during instruction execution.
  • (^) speeding up processing by minimizing memory access.

Example in Assembly (8086) MOV AX, 5 ; Load 5 into AX ADD AX, 3 ; Add 3 to AX Here, AX is a general-purpose register acting as an accumulator.

Instruction Cycle (Fetch–Decode– Execute)

1. Fetch - (^) The CPU retrieves the next instruction from memory (usually from the program counter, PC). - (^) The instruction is loaded into the Instruction Register (IR). - (^) The PC is updated to point to the next instruction.

Instruction Cycle (Fetch–Decode– Execute) (cont.)

3. Execute

• The CPU performs the required

operation: arithmetic, logic,

memory access, or control.

• Results may be stored in

registers or memory.

• If the instruction involves

branching, the PC may be

updated to a new address.

Assembly Language Assembly Language is a low-level programming language that is close to machine code.

  • (^) Lies in between HLL and machine language
  • (^) Collection of Mnemonics(ADD, SUB, MOV, CALL)

Why Use Assembly?

  • (^) Fast execution

Hardware control

  • (^) Embedded systems

System programming

First Glance at Assembly

Language

■Low-level language ⮚ (^) Each instruction performs a much lower- level task compared to a high-level language instruction ⮚ (^) Most high-level language instructions need more than one assembly instruction ■One-to-one correspondence between assembly language and machine language instructions ⮚ (^) For most assembly language instructions, there is a machine language equivalent ■Directly influenced by the instruction set and architecture of the processor

Comparisons with High-level Languages (cont.) Feature Assembly Language High-Level Language Level of Abstraction (^) Low-level, close to hardware High-level, closer to human language Ease of Learning (^) Difficult, requires hardware knowledge Easy, user-friendly syntax Execution Speed (^) Very fast (optimized, direct machine code) Slower (depends on compiler/interpreter) Control (^) Full control over hardware & memory Limited hardware control Portability (^) Not portable (machine dependent) Highly portable across platforms Development Time (^) Long (complex, detailed coding) Short (fast development with libraries) Use Cases (^) OS, device drivers, embedded systems Application software, web, enterprise apps

Time Comparison

3 4 5 C version 1 0 2 0 20 40 60 80 100 Number of calls (in millions) Time (seconds) Multiplication time comparison on a 2.4-GHz Pentium 4 system ASM version