Lecture 1 and 2
Basic Concepts
Computer Organiaztion and Assembly
Language
Lecturer
CS2032– Computer Organization and Assembly Language
Khawaja Ubaid ur Rehman
Computer Science Department
Lecturer: UMT Lahore
Email:
[email protected] MS in Software Engineering
Area of research: Pattern Recognition & Image Processing
Basic Concepts Computer Organization and Assembly Language
slide 2/43
Instructor’s Background
Educational Background and Achievements
MS-Software Engineering (MS-SE), UMT Lahore
BS-Computer Science (BS-CS), UMT Lahore
Awarded three times Dean’s Merit Award
Awarded Rector’s Medal Award at 11th Convocation of UMT Lahore from Prof.
Ahsan Iqbal and honorable Rector Dr. Hasan Sohaib Murad
Awarded Silver Medal Award at 11th Convocation of UMT Lahore by honorable
Rector Dr. Hasan Sohaib Murad
Awarded Dr. Abdul Qadeer Khan award of Entrepreneurship and Innovation from
US General Consul Lahore Zachary Harkenrider and honorable Rector UMT Lahore
Dr. Hasan Sohaib Murad in recognition of my publication in international conference
IVCNZ IEEE endorsed at 11th Convocation of UMT Lahore.
Red Hat Certified Network Administrator
Basic Concepts Computer Organization and Assembly Language
slide 3/43
Instructor’s Background
Recent Publications:
Android Based Interactive Learning application for the Kids in
International Conference on Innovative Computing.
A comparative analysis of Distributed and Parallel Computing in
VFAST Journal of SE
A comparative analysis of Traditional and Cloud Data
Warehouse in VFAST Journal of CS
Algorithms for Data cleaning in Knowledge bases in VFAST
Journal of SE
Basic Concepts Computer Organization and Assembly Language
slide 4/43
Students
Answer these questions (Not graded!)
1. Your name and city?
2. Your favorite subject which you have studied so far?
3. Your favorite teacher from which you have studied?
4. Total Marks in F.SC/ICS (optional)?
Basic Concepts Computer Organization and Assembly Language
slide 5/43
Course Page
Moodle (http://lms.umt.edu.pk/)
Search course (Computer Organization and Assembly Language
or Khawaja Ubaid ur Rehman)
SST - School of Systems and Technology - Undergraduate
courses – Spring 2020
All the announcements related to quiz, assignments, Mid and
final term etc. will be on Moodle.
Basic Concepts Computer Organization and Assembly Language
slide 6/43
Textbook
Textbook
Assembly Language Programming and Organization
Of The IBM Pc by Yatha Yu.
Reference books
The Intel Microprocessors by Barry b. Brey
Assembly Language for Intel-Based Computer by Kip
R.Irvin
Basic Concepts Computer Organization and Assembly Language
slide 7/43
Grading Policy(tentative)
Instrument Description Weight
Assignments Assigned during important stages of 10%
the course to apply and practice the
learnt concepts
Quizzes In-class (un)announced or may be 10%
announced quizzes 15 to 20 minutes
tests
Lab Compulsory for all students to attend 20%
all labs and pass the lab
Project Compulsory for all students to make 10%
project covering all the knowledge
.learned throughout the course
Mid-Term Exam A single 75-minute exam from the 20%
material covered during the first 6-7
weeks
Final Exam Will cover the entire course. At least 30%
80% of the topics would be from post
.mid term
Late Submission Policy: Late submissions not allowed
Basic Concepts Computer Organization and Assembly Language
slide 8/43
Classroom Policy
1. Maintain teacher and student respect decorum.
2. Behavior is very important. Be obedient.
3. Attendance is very important, 85% is required, 100% is recommended. Be
regular and be punctual.
4. Do not come late in the class. Late comers attendance will not be marked
as online attendance is closed.
5. Avoid to use mobile phones during lecture. Keep your mobiles switch off
or in silent mode.
6. It is your responsibility not to delete your assignment on Moodle even after
its submission.
7. Quizzes can be announced or unannounced. 1 quiz can be dropped out of
5 or 6 quizzes. No retake for missed quizzes.
8. *The plagiarism(copy/paste) and cheating cases would be reported to the
Disciplinary Committee.
9. *Only 6 absentees are allowed in any course. On 7th absentee you will be
marked Short Attendance (SA).
10. Moodle will be the resource sharing medium, keep checking the Moodle
page and your emails regularly.
Basic Concepts Computer Organization and Assembly Language
slide 9/43
Goals and Required Background
Goals: broaden student’s interest and knowledge in …
Basic organization of a computer system
Intel IA-16 and IA-32 processor architecture
How to write assembly language programs
How high-level languages translate into assembly language
Interaction between the assembly language programs, libraries,
the operating system, and the hardware
How interrupts, system calls, and handlers work
Required Background
The student should already be able to program confidently in at
least one high-level programming language, such as Java or C.
Basic Concepts Computer Organization and Assembly Language
slide 10/43
Computer Circuit Parts
Functionally Computer Circuit consists of three parts:
Central Processing Unit (CPU)
Memory
I/O devices
In a microcomputer CPU is a single chip processor
called microprocessor.
CPU is a brain of computer it controls all the operations.
It uses memory circuits to store information and I/O
circuits to communicate with I/O devices.
Basic Concepts Computer Organization and Assembly Language
slide 11/43
System board
Inside the system unit is a main circuit board called
system board, which contains the microprocessor and
memory circuits. The system board is also called a
motherboard.
Basic Concepts Computer Organization and Assembly Language
slide 12/43
Memory
There are two kinds of memory
RAM it a volatile memory which loses its contents
when computer is turned off.
ROM it a non-volatile memory which does not loses
its contents when the computer is turned off.
Basic Concepts Computer Organization and Assembly Language
slide 13/43
Overview of RAM
RAM stands for Random Access Memory. It is also called
direct access memory.
RAM is used to store data and instructions temporarily.
A program must be loaded into RAM before execution.
RAM is a volatile memory. It means that its contents are lost
when the power is turned off.
RAM is read/write memory.
CPU can read from data from RAM and write data to RAM
It is used to store data and instructions while it is being
executed.
RAM is also called main memory or primary storage.
Basic Concepts Computer Organization and Assembly Language
slide 14/43
Overview of ROM
ROM stands for Read Only Memory. The instructions in ROM
prepare the computer for use. These instructions can be read
but cannot be changed or deleted.
It is not possible to write new information or instructions into
the ROM.
ROM stores data and instructions permanently. When the
power is switched off the instructions stored in ROM are not
lost. Therefore, ROM is called non volatile memory.
The information in ROM is stored by the manufacturer. When
the computer is switched on, the instructions in the ROM are
automatically loaded into the memory of the computer. The
ROM based programs are known as firmware. They are
responsible for loading start up programs as well as for self
testing of computer when it is turned on.
Basic Concepts Computer Organization and Assembly Language
slide 15/43
Cache Memory
A cache is a small and very fast memory. It is designed to speed up
the transfer of data and instructions.
It is located close to CPU chip. It is more expensive and faster than
RAM.
The data and instructions that are most recently or frequently used
the CPU are stored in cache.
The data and instructions are retrieved from RAM when CPU uses
them for the first time. A copy of data or instructions is stored in
cache. The next time the CPU needs that data or instruction, it looks
in cache. If the required data is found there it is retrieved from cache
memory instead of main memory. It speeds up the working of CPU.
Basic Concepts Computer Organization and Assembly Language
slide 16/43
Cache Memory
Basic Concepts Computer Organization and Assembly Language
slide 17/43
Byte and Words
Information processed by the computer is stored in its
memory.
A memory circuit element can store one bit of data.
However, the memory circuits are usually organized into
groups that can store eight bits of data
A string of eight bits is called as byte.
Each memory byte or memory circuit is identified by a
number that is called its address.
Basic Concepts Computer Organization and Assembly Language
slide 18/43
Address and Contents
The first memory byte has address 0.
The data stored in memory byte are called its contents.
Basic Concepts Computer Organization and Assembly Language
slide 19/43
Difference between Address and Contents
Address Contents
Address of memory byte is The contents of memory
fixed. It is different from the byte are not unique. They
address of any other are subject to change
memory byte in memory because they denote the
.data currently being stored
The number of bits in an Contents of a memory byte
address depends on are always eight bits
.processor
Basic Concepts Computer Organization and Assembly Language
slide 20/43
Byte and Word
In a typical microcomputer, two bytes form a word. As
we know that 1 byte = 8 bits, So, 2 byte = 16 bits
Basic Concepts Computer Organization and Assembly Language
slide 21/43
Buses
A processor communicates with memory and l/O devices
by using signals that travel along a set of wires or
connections called buses.
These buses connect different components of computer.
There are three kinds of buses:
Data bus
Address bus
Control bus
Basic Concepts Computer Organization and Assembly Language
slide 22/43
Address, Data and Control Bus
To inform memory whether processor wants to read or
write – control bus
To inform memory the precise element processor is
interested in – address bus
To transfer the data element from memory to processor
– data bus
Basic Concepts Computer Organization and Assembly Language
slide 23/43
Basic Computer Organization
Since the 1940's, computers have 3 classic components:
Processor, called also the CPU (Central Processing Unit)
Memory and Storage Devices
I/O Devices
Interconnected with one or more buses
Bus consists of
Data Bus
Address Bus
Control Bus
Basic Concepts Computer Organization and Assembly Language
slide 24/43
Processor (CPU)
Processor consists of
Datapath
ALU
Registers
Control unit
ALU
Performs arithmetic
and logic instructions
Control unit (CU)
Generates the control signals required to execute instructions
Implementation varies from one processor to another
Basic Concepts Computer Organization and Assembly Language
slide 25/43
A Hierarchy of Languages
Basic Concepts Computer Organization and Assembly Language
slide 26/43
Assembly and Machine Language
Machine language
Native to a processor: executed directly by hardware
Instructions consist of binary code: 1s and 0s
Assembly language
A programming language that uses symbolic names to represent
operations, registers and memory locations.
Slightly higher-level language
Readability of instructions is better than machine language
One-to-one correspondence with machine language instructions
Assemblers translate assembly to machine code
Compilers translate high-level programs to machine code
via an assembler
Basic Concepts Computer Organization and Assembly Language
slide 27/43
Why we need to study Assembly language?
Better/deep understanding of software and hardware
Optimization of processing time while converting code
from high level language to machine language.
We can access and use registers using this language.
Assembly language can communicate better than a high-
level.
In assembly language, we can directly read pointers at a
physical address which is not possible in high-level
Working with bits is easier in assembly language.
Basic Concepts Computer Organization and Assembly Language
slide 28/43
Why we need to study Assembly language?
The executable code of high-level language is larger
than assembly language code so it takes a longer time to
execute.
Due to long executable code, high-level programs are
less space efficient than assembly language programs.
The most high-level language code is first automatically
converted into assembly code.
Course requirement
Basic Concepts Computer Organization and Assembly Language
slide 29/43
What’s the difference between Microprocessor
and Microcontroller
Basic Concepts Computer Organization and Assembly Language
slide 30/43
Microcontroller
Basic Concepts Computer Organization and Assembly Language
slide 31/43
Microprocessor
Basic Concepts Computer Organization and Assembly Language
slide 32/43
Microcontroller
Basic Concepts Computer Organization and Assembly Language
slide 33/43
Basic Concepts Computer Organization and Assembly Language
slide 34/43
Microprocessor
Basic Concepts Computer Organization and Assembly Language
slide 35/43
Microcontroller
Basic Concepts Computer Organization and Assembly Language
slide 36/43
Processor
Basic Concepts Computer Organization and Assembly Language
slide 37/43
Basic Concepts Computer Organization and Assembly Language
slide 38/43
Basic Concepts Computer Organization and Assembly Language
slide 39/43
Summary
Basic Concepts Computer Organization and Assembly Language
slide 40/43
What is Computer Architecture?
Computer architecture is a set of rules and methods that
describe the functionality, organization, and
implementation of computer systems.
Basic Concepts Computer Organization and Assembly Language
slide 41/43