0% found this document useful (0 votes)
10 views46 pages

Lecture 1

CSC 222: Computer Organization & Assembly Language aims to provide students with an understanding of computer systems' organization, microprocessors, memory devices, and assembly language. The course covers topics such as computer architecture, data representation, instruction sets, and the relationship between high-level languages and assembly language. Students will learn the essential tools for programming in assembly language and the importance of understanding computer organization for efficient programming.

Uploaded by

aqsagondal4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views46 pages

Lecture 1

CSC 222: Computer Organization & Assembly Language aims to provide students with an understanding of computer systems' organization, microprocessors, memory devices, and assembly language. The course covers topics such as computer architecture, data representation, instruction sets, and the relationship between high-level languages and assembly language. Students will learn the essential tools for programming in assembly language and the importance of understanding computer organization for efficient programming.

Uploaded by

aqsagondal4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

CSC 222: Computer Organization

& Assembly Language

1 – An Introduction

Instructor: Ms. Sadia Waheed


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
Course Contents
 Basic Structure & Components of a Computer System
 Difference in Computer Organization & Computer
Architecture
 Computer Evolution
 Microprocessor & Microcontrollers
 Interconnection Structures
 Memory Organization
 Data Representation
 Instruction Set
 Processor Structure & Function
 Interrupts
 Processor Registers & FLAGS
5
Course Contents Contd..
 Assembly Language
 Syntax
 Basic Instructions
 Flow Control Instructions
 High Level Language Structures
 Logic, Shift and Rotate Instructions
 The Stack
 Multiplication & Division Instructions
 Array & Addressing Modes
 String Instructions
 Procedures & Macros
 Translation of high level language into assembly
language.
6
Basic Structure & Function –
Computer System
Structure

 Structure is the way in which components


relate to each other

8
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.

9
Structure - Top Level

Peripherals Computer

Central Main
Processing Memory
Unit

Computer
Systems
Interconnection

Input
Output
Communication
lines

10
Structure – Top Level Contd..
 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.

11
Structure - The CPU

CPU

Computer Arithmetic
Registers and
I/O Login Unit
System CPU
Bus
Internal CPU
Memory Interconnection

Control
Unit

12
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.

13
Structure - The Control Unit

Control Unit

CPU
Sequencing
ALU Logic
Control
Internal
Unit
Bus
Control Unit
Registers Registers and
Decoders

Control
Memory

14
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

15
What is Computer Organization?
Computer Architecture
 Computer Architecture refers to those attributes of
a system visible to a programmer
 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.

 Example: Architectural design issue whether a


computer will have multiply instruction or not.

17
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.
18
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!

19
Computer Organization vs. Architecture
Contd..
 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.

20
Computer Organization vs. Architecture
Contd..
 Architectural Issues:
 Reduced Instruction Set Computing (RISC)
 Complex Instruction Set Computing (CISC)
 Pipeline (multiple instructions are overlapped
during execution) etc

 Organizational Issues:
 I/O, control unit, memory etc

21
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.

22
Assembly Language
Computer Level Hierarchy

Figure Reference:
24 http://users.dickinson.edu/~braught/courses/cs251f09/topics/slides/
Programming Languages

 High-Level Languages (HLL)


 Assembly Language
 Machine Language

25
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.

26
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

27
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

28
C++ and Java Relate to Assembly
Language
int Y;
int X = (Y + 4) * 3;
 Following is the equivalent translation to assembly
language. The translation requires multiple
statements because assembly language works at a
detailed level:
mov eax, Y ; move Y to the EAX register
add eax, 4 ; add 4 to the EAX register
mov ebx, 3 ; move 3 to the EBX register
imul ebx ; multiply EAX by EBX
mov X, eax ; move EAX to X

29
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

30
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 rather than machine code, examine and change
contents of registers. Example: EMU8086

31
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

32
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-many 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 (CPU)

33
Comparisons with High-level
Languages
 Advantages of Assembly Languages
• Space-efficiency,(e.g. hand-held device
softwares, etc)
• Time-efficiency,(e.g. Real-time applications, etc )
• Accessibility to system hardwares,(e.g., Network
interfaces, device drivers, video games, etc)
 Advantages of High-level Languages
• Development
• Maintenance (Readability)
• Portability (compiler, virtual machine)

34
Comparisons

35
Virtual Machine Concepts
 How a computer’s hardware and software are
related is called the virtual machine concept
 Programming Language analogy:
• Each computer has a native machine
language (language L0) that runs directly on
its hardware
• A more human-friendly language is usually
constructed above machine language, called
Language L1

36
Virtual Machine Concepts(Cont)
 Programs written in L1 can run two different ways:
 Interpretation:
 L0 program interprets and executes L1
instructions one by one. As the L1 program is
running, each of its instructions could be decoded
and executed by a program written in language
L0.

 Translation:
 L1 program is completely translated into an L0
program, which then runs on the computer
hardware

37
Virtual Machine
 The virtual machine VM1, can execute
commands written in language L1
 The virtual machine VM0 can execute
commands written in language L0

38
Translating Languages

39
Specific Machine Levels
 Level 05-level 0

40
High-Level Language (Level 5):
 Application-oriented languages such as C++,
Java, Pascal, Visual Basic.
 Programs in these languages contain
powerful statements that translate into
multiple instructions at assembly language
(Level 4)

41
Assembly Language (Level 4):
 Instruction mnemonics such as ADD, SUB,
and MOV, which are easily translated to
machine language (Level 2). Instruction
mnemonics that have a one-to-one
correspondence to machine language.
 Calls functions written at the operating
system level (Level 3)
 Programs are translated into machine
language (Level 2) before execution

42
Operating System (Level 3):
 Provides services to Level 4 programs
 Translated and run at the instruction set
architecture level (Level 2)
 Operating System understands interactive
commands by users to load and execute
programs, display directories, and so forth.

43
Instruction Set Architecture (Level 2):
 Also known as conventional machine language
 Executed by microarchitecture (Level 1)
program
 Computer chip manufactures design into the
processor an instruction set to carry out basic
operations, such as move, and, or multiply.
Each machine-language instruction is
executed by several microinstructions.

44
Microarchitecture (Level 1):
 Integrated circuit consist of micro chips
 Interprets conventional machine instructions
(Level 2)
 Executed by digital hardware (Level 0)
 The specific microarchitecture commands are
often a proprietary secret.

45
Digital Logic (Level 0):
 CPU, Memory: Constructed from digital logic
gates

46

You might also like