1 Introduction
1 Introduction
1 Introduction
Introduction
Engr. Osama Bin Naeem
What is this course
about?
To understand organization of a computer system
To gain an insight knowledge about the internal architecture and
working of microprocessors.
To understand working of memory devices, interrupt controllers
Course and I/O devices.
Objectives To learn Assembly Language
To understand how low level logic is employed for problem solving
by using assembly language as a tool.
3
Basic Structure & Components of a Computer System
Difference in Computer Organization & Computer Architecture
Computer Evolution
Microprocessor & Microcontrollers
Interconnection Structures
Course Memory Organization
Contents Data Representation
Instruction Set
Processor Structure & Function
Interrupts
Processor Registers & FLAGS
4
Assembly Language
Syntax
Basic Instructions
Flow Control Instructions
High Level Language Structures
Course Logic, Shift and Rotate Instructions
Contents
The Stack
Multiplication & Division Instructions
Contd.. Array & Addressing Modes
String Instructions
Procedures & Macros
Translation of high level language into assembly language.
5
An Example System
Consider this advertisement: z? ?
MH
e? ?
a ch MB?
C ?
L1
CI ? ?
P
US
B? ?
7
An Example System
8
An Example System
Hard disk capacity determines
the amount of data and size of
programs you can store.
9
An Example System
10
An Example System
Ports
allow movement of data between a
system and its external devices.
• Serial ports send data as a series of pulses along one or two data lines.
• Parallel ports send data as a single pulse along at least eight data lines.
• USB (Universal Serial Bus), is an intelligent serial interface that is self-
configuring. (It supports “plug and play.”)
11
ARCHITECTURE is those attributes visible to the programmer.
Instruction set, number of bits used for data representation, I/O
mechanisms, addressing techniques.
Architecture
&
Organization ORGANIZATION is how features are implemented.
Computer organization mainly deals with how a particular
hardware works.
Control signals, interfaces, memory technology.
13
Organization is how features are implemented.
How does a Computer Work?
For Example: Is there a special hardware multiply unit for
multiplication operation or is it done by repeated addition?
What is Computer Organization refers to the operational units and their
Computer interconnections that realize the architectural specifications.
Organizational attributes:
Organization? hardware details transparent to the programmer such as control
signals,
interfaces between peripherals and the computer,
the memory technology used.
14
Architecture:
Logical aspects of computer hardware that are visible to the
Computer programmer
What instruction a computer understands!
Organization
vs. Organization:
Architecture Physical aspects of computer hardware that are invisible to the
programmer
How does the computer hardware carries out instructions!
15
Computer Organization must be designed to implement a
particular architectural specifications.
Computer
Organization It is possible to have same architecture but different
vs. organizations.
Architecture All computers in the Intel Pentium series have the same architecture.
Each version of the Pentium has a different organization or
Contd.. implementation.
16
Architectural Issues:
Computer Reduced Instruction Set Computing (RISC)
Organization Complex Instruction Set Computing (CISC)
Pipeline etc
vs.
Architecture Organizational Issues:
Contd.. I/O, control unit, memory etc
17
Understand how computer works!
Computer functional components, their characteristics, their
Why Study performance, and their interactions.
Computer
Organization? How to select a system?
Understand tradeoff among various components, such as memory
size, CPU clock speed etc.
18
All Intel x86 family share the same basic ARCHITECTURE.
This gives code compatibility.
Architecture
& ORGANIZATION differs between different versions.
Organization
Composed of applications and is the level with which everyone is
most familiar.
Level
Hierarchy
Level - 6
The level with which we interact when we write programs in
languages such as C, C++ and Java.
These languages must be translated to a language the
machine can understand. (using either a compiler or
an interpreter)
Level – 5
Compiled languages are translated into assembly language
High-Level Language and then assembled into machine code. (They are
translated to the next lower level.)
The user at this level sees very little of the lower
levels.
Acts upon assembly language produced from Level 5, as
well as instructions programmed directly at this level
27
Allow programmers to write programs that look
more like natural language.
Examples: C++, Java, C#.NET etc
A program called Compiler is needed to translate
a high-level language program into machine
High-Level code.
Language Each statement usually translates into multiple
machine language instructions.
28
The "native" language of the computer
Numeric instructions and operands that can be stored in
memory and are directly executed by computer system.
Each ML instruction contains an op code (operation
code) and zero or more operands.
Machine Examples:
Language
Opcode Operand Meaning
-------------------------------------------------
40 increment the AX register
05 0005 add 0005 to AX
29
Use instruction mnemonics that have one-to-one
correspondence with machine language.
An instruction is a symbolic representation of a single
machine instruction
Assembly Consists of:
label always optional
Language mnemonic always required
operand(s) required by some instructions
comment always optional
30
Sample Program
5. int 20
31
Assembler is a program that converts source-code programs into a
machine language (object file).
Linker joins together two or more object files and produces a single
executable file.
Essential Tools Debugger loads an executable program, displays the source code,
and lets the programmer step through the program one instruction at
a time, and display and modify memory.
Emulator allows you to load and run assembly language programs,
examine and change contents of registers. Example: EMU8086
32
Learn how a processor works
Explore the internal representation of data and instructions
How to structure a program so it runs more efficiently.
Why Learn
Assembly Compilers/Device Drivers/ OS codes
Language? Games/Embedded System
33
Structure STRUCTURE is the way in which components relate to each other.
&
Function FUNCTION is the operation of individual components as part of
the structure.
Peripherals Computer
Central Main
Processing Memory
Unit
STRUCTURE Computer Systems
Interconnection
Top Level
Input
Output
Communication
lines
CPU
Computer Arithmetic
Registers and
STRUCTURE I/O
System
CPU
Login Unit
Bus
Internal CPU
Interconnection
Memory
The CPU
Control
Unit
Control Unit
CPU
Sequencing
STRUCTURE ALU
Internal Control
Login
Bus Unit
Control Unit
The Control
Registers Registers and
Decoders
Unit
Control
Memory
Data processing
Data storage
Function
Data movement
Control
OPERATIONS
Data
Movement
OPERATIONS
Storage
OPERATIONS
Processing
From / To
Storage
OPERATIONS
Processing
From Storage
to I / O