Zeeshan Waheed Computer Organization and Assembly Language
Time Lecture
Plan Contents of Lecture Strategy
(min) (Remarks)
20 Introduction
mins
Assembly language is a symbolic representation of a processor's native code.
Using machine code allows the programmer to control precisely what the processor
does. It offers a great deal of power to use all of the features of the processor. The
resulting program is normally very fast and very compact. In small programs timing is
also very predictable.
Timings, for example, can be calculated very precisely and program flow is easily
controlled. It is often used for small, real time applications. However, the programmer
needs to have a good understanding of the hardware being used. As programs become
larger, assembly language get very cumbersome.
Maintenance of assembly language is notoriously difficult, especially if another
programmer is brought in to carry out modifications after the code has been written.
Assembly language also has no support of an operating system, nor does it have any
complex instructions.
Lesson 1 -2- Computer Organization and Assembly Language
Time Lecture
Plan Contents of Lecture Strategy
(min) (Remarks)
15 Micro Computer:
mins
CPU
MEMORY UNIT
I/O CIRCUIT
CPU
CPU is the abbreviation for central processing unit. Sometimes referred to simply
as the central processor, but more commonly called processor the CPU is the brains
of the computer where most calculations take place. In terms of computing power, the
CPU is the most important element of a computer system.
Memory Unit (Bytes and words)
Smallest unit is bit.
8 bit groups of bits referred as byte.
Each memory byte is identified by an identifier called address.
The data stored in byte is called contents.
Difference of address byte contents & address.
Q: How many memory bytes can be accessed by a processor using ‘20’ bits
address?
1 bit → can represent 2 addresses: 0 and 1
2 bits → 00, 01, 10, 11 → 4 addresses
Address bits = 20
So, total memory locations = 220 1,048,576
Early processors like the Intel 8086 had 20-bit address buses. That’s why the original
IBM PC could access only 1 MB of memory.
Unit Value in Bits
1 bit 1 bit
1 nibble 4 bits
1 byte 8 bits
1 kilobyte (KB) 1024 bytes (8,192 bits)
1 megabyte (MB) 1,048,576 bytes (8,388,608 bits)
Lesson 1 -3- Computer Organization and Assembly Language
Time
Plan
(min) Some pc treats consecutive word as a single unit, called a memory word.
The lower byte address is used as a word address.
High byte low byte
15----------8(MSB) 7---------0(LSB)
Contents of Lecture
Lesson 1 -4- Computer Organization and Assembly Language
15
mins 1. Memory operations.
Read/Write
Ram /Rom
2. Buses
Address bus CPU places the address of
Data bus the content (memory
Control bus location)
3. CPU
15 Machine code usage.
mins
Instruction set defined.
Instruction set of every CPU is unique.
CPU has two units
1. Execution unit (ALU)
2. Bus interface unit(LU)
1. Execution Unit (EU)
Also known as: Arithmetic Logic Unit (ALU)
The Execution Unit is responsible for carrying out instructions — the actual
processing.
Functions:
Performs arithmetic operations (add, subtract, multiply, divide)
Performs logical operations (AND, OR, NOT, XOR)
Lesson 1 -5- Computer Organization and Assembly Language
Time Lecture
Plan Controls instruction execution Strategy
(min) (Remarks)
Manages registers, flags, and the control unit
Components inside EU:
ALU – Arithmetic Logic Unit (does the math/logic)
Registers – Temporary storage (like AX, BX, etc.)
Control unit – Decodes and executes instructions
2. Bus Interface Unit (BIU)
Also known as: Link Unit (LU) or Communication unit
The Bus Interface Unit handles communication between the CPU and memory
or I/O devices.
Functions:
Fetches instructions from memory (before EU executes them)
Reads/writes data from/to memory or I/O
Manages address and data buses
Components inside BIU:
Instruction queue (in pipelined CPUs like 8086)
Segment registers (CS, DS, SS, ES)
Address Generation Unit – Calculates memory addresses
System buses – Connects CPU to memory and peripherals:
o Address bus – Sends memory addresses
o Data bus – Transfers data
o Control bus – Sends control signals
Instruction execution
How an instruction is executed?
Machine instruction has two parts.
OP-Code
OP-code specifies the type of operation.
Operand
Operand on which the operation is performed (mostly
memory location).
Execution of instruction
Contents of Lecture
Lesson 1 -6- Computer Organization and Assembly Language
20
mins
Fetch:
1. Fetch an instruction from memory.
2. Decode the instruction to determine the operation.
3. Fetch data from memory.
Execution:
1. Perform the operation on data.
2. Store the result in memory if needed.
Timing:
To ensure steps are carried out in timely manner.
1. A clock circuit controls the processor by generating a train of clock pulse.
2. The time interval between the pulses is called clock period.
3. Number of pulse per second is called the clock rate measures in MHZ.
Lesson 1 -7- Computer Organization and Assembly Language
Lesson 1 -8- Computer Organization and Assembly Language
Using control buss process inform ram data processor want to write data or read data.
There are memory locations in the Ram every memory location have address according to picture
like
100, 102
Processor inform the ram where data read and write with the help or address bus
Internal Buses.
Processor to Ram Communication.
External Buses
Ram to Input output devices Communication
Lesson 1 -9- Computer Organization and Assembly Language
Lesson 1 -10- Computer Organization and Assembly Language