Computer Organization &
Assembly Language
1 – An Introduction
Outline
About this Course
Basic Structure of Computer
What is Computer Organization?
About Assembly Language
2
What is this course about?
Course Objectives
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 and I/O devices.
To learn Assembly Language
To understand how low level logic is employed for
problem solving by using assembly language as a tool.
4
Basic Structure & Function –
Computer System
Structure
Structure is the way in which components
relate to each other
6
Difference in Peripherals &
Communication Lines
When data is received from or delivered by a
device that is directly connected to the computer,
process is called Input-Output (I/O).
When data are moved over longer distance, to or
from a remote device, the process is known as
Data Communication.
7
Structure - Top Level
Peripherals Computer
Central Main
Processing Memory
Unit
Computer
Systems
Interconnection
Input
Output
Communication
lines
8
Structure – Top Level Cont..
Four main structural components:
CPU: controls the operation of the computer and
performs its data processing functions; often
referred as processor.
Main Memory: stores data
I/O: moves data between the computer and its
external environment.
System Interconnections: Mechanism for
communication among CPU, memory, and I/O.
9
Structure - The CPU
CPU
Computer Arithmetic
Registers and
I/O Login Unit
System CPU
Bus
Internal CPU
Memory Interconnection
Control
Unit
10
Structure – The CPU
Control Unit: controls the operation of CPU and
hence the computer.
Arithmetic and logic unit: performs the
computer’s data processing functions.
Registers: provides storage internal to CPU.
CPU interconnection: Mechanism that provides
for communication among the control unit, ALU,
and registers.
11
Structure - The Control Unit
Control Unit
CPU
Sequencing
ALU Logic
Control
Internal
Unit
Bus
Control Unit
Registers Registers and
Decoders
Control
Memory
12
Function
Function is the operation of individual
components as part of the structure.
Main functions performed by a computer system
are:
Process Data
Store Data
Move Data
Control the above three functions
13
Functional View of Computer
14
Possible Operations
Data movement Data storage device
device (read/write)
15
Possible Operations Contd..
Figure (a), show that simply transferring
data from one peripheral or communication
line to another.
Figure (b), show data transfer from external
environment to the computer storages and
vice versa.
16
Possible Operations Cont..
Processing on data stored in storage or in external
environment
17
Possible Operations Contd..
The final two diagrams show operations
involving data processing, on data either in
storage (Figure c) or in route between
storage and the external environment
(Figure d).
18
What is Computer Organization?
Computer Architecture
Computer Architecture refers to those attributes of a system
visible to a programmer … Design, Blue Print
Those attributes that have direct impact on logical execution of a
program.
Architectural attributes include:
the instruction set,
no. of bits used to represent various data types (numbers,
characters etc),
I/O mechanisms and technology for addressing memory.
Instruction set: is a collection of instruction that a CPU can execute. Each
instruction in the set is a command that tells the CPU to perform a specific
operation, such as arithmetic calculations, data movement or control tasks
Example: Architectural design issue whether a computer will
have multiply instruction or not.
20
What is Computer Organization?
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?
Computer Organization refers to the operational
units and their interconnections that realize the
architectural specifications.
Organizational attributes:
hardware details transparent to the programmer such as
control signals,
interfaces between peripherals and the computer,
the memory technology used.
21
Computer Organization vs.
Architecture
Architecture:
Logical aspects of computer hardware that are visible
to the programmer
What instruction a computer understands!
Organization:
Physical aspects of computer hardware that are
invisible to the programmer
How does the computer hardware carries out instructions!
EXAMPLE: Say you are in a company that manufactures cars,
design and all low-level details of the car come under computer
architecture (abstract, programmers view), while making it’s parts
piece by piece and connecting together the different components of
that car by keeping the basic design in mind comes under computer
organization (physical and visible).
22
Computer Organization vs. Architecture
Cont..
Computer Organization must be designed to
implement a particular architectural
specifications.
It is possible to have same architecture but
different organizations.
All computers in the Intel Pentium series have the same
architecture.
Each version of the Pentium has a different organization
or implementation.
23
Why Study Computer Organization?
Understand how computer works!
Computer functional components, their characteristics,
their performance, and their interactions.
How to select a system?
Understand tradeoff among various components, such
as memory size, CPU clock speed etc.
24
Assembly Language
Computer Level Hierarchy
Figure Reference:
26 [Link]
Programming Languages
High-Level Languages (HLL)
Assembly Language
Machine Language
27
High-Level Language
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 code.
Each statement usually translates into multiple
machine language instructions.
28
Machine Language
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.
Examples:
Opcode Operand Meaning
-------------------------------------------------
40 increment the AX register
05 0005 add 0005 to AX
29
Assembly Language
Use instruction mnemonics that have one-to-one
correspondence with machine language.
An instruction is a symbolic representation of a single
machine instruction
Consists of:
label always optional
mnemonic always required
operand(s) required by some instructions
comment always optional
30
Sample Program
1. mov ax, 5 ax 05 Memory
011C
2. add ax, 10 ax 15 011E
35 0120
3. add ax, 20 ax 35 0122
0124
4. mov [0120], ax ax 35 0126
5. int 20
31
Essential Tools
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.
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
Why Learn Assembly Language?
Learn how a processor works
Explore the internal representation of data and
instructions
How to structure a program so it runs more efficiently.
Compilers/Device Drivers/ OS codes
Games/Embedded System
33