0% found this document useful (0 votes)
5 views

1st Lecture

Uploaded by

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

1st Lecture

Uploaded by

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

COMPUTER ORGANIZATION

&
ASSEMBLY LANGUAGE

Basic Concept: Welcome to Assembly


Language,Virtual Machine Concept,x86
Processor Architecture

1
Grading Policy

⦿ Midterm Exam 25 Marks


⦿ Final Exam 40 Marks
⦿ Test 10 Marks
⦿ Project 15 Marks
⦿ Assignment 1 10 Marks

2
Welcome to Assembly Language

⦿ Some Good Questions to Ask


⦿ What is Assembly language?
⦿ Hierarchy of Languages
⦿ Why Assembly?
⦿ Assembly Language Applications

3
Some Good Questions to Ask
⦿ Why am I taking this course (reading this book)?
⦿ What background should I have?
⦿ What is an assembler?
⦿ What hardware/software do I need?
⦿ What types of programs will I create?
⦿ What do I get with this book?
⦿ What will I learn?

4
Welcome to Assembly Language
(cont)
⦿ How does assembly language (AL) relate to
machine language?
⦿ How do C++ and Java relate to AL?
⦿ Is AL portable?
⦿ Why learn AL?

5
What is Assembly language?

⦿ low-level programming language .

⦿ converted into executable machine code by a


utility program referred to as an assembler.

⦿ Mnemonics or Keywords are used.

6
Hierarchy of Languages

7
Why Assembly?

⦿ Better understanding of software & harware


interaction
⦿ requires less memory
⦿ requires less execution time
⦿ allows hardware-specific complex jobs in an
easier way
⦿ suitable for writing interrupt service routines

8
Assembly Language Applications
⦿ Some representative types of applications:
› Business application for single platform
› Hardware device driver
› Business application for multiple platforms
› Embedded systems & computer games

9
Comparing ASM to High-Level Languages

10
Virtual Machine Concept
⦿ Virtual Machines
⦿ Specific Machine Levels

11
Virtual Machines
⦿ 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
⦿ Programs written in L1 can run two different ways:
› Interpretetation – L0 program interprets and executes L1
instructions one by one
› Translation – L1 program is completely translated into an L0
program, which then runs on the computer hardware

12
Specific Machine Levels

13
High-Level Language
⦿ Level 5
⦿ Application-oriented languages
⦿ Programs compile into assembly
language (Level 4)

14
Assembly Language
⦿ Level 4
⦿ 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)

15
Operating System
⦿ Level 3
⦿ Provides services to Level 4 programs
⦿ Programs translated and run at the
instruction set architecture level (Level
2)

16
Instruction Set Architecture
⦿ Level 2
⦿ Also known as conventional machine
language
⦿ Executed by Level 1 program
(microarchitecture, Level 1)

17
Microarchitecture
⦿ Level 1
⦿ Interprets conventional machine
instructions (Level 2)
⦿ Executed by digital hardware (Level
0)

18
Digital Logic
⦿ Level 0
⦿ CPU, constructed from digital logic
gates
⦿ System bus
⦿ Memory

19
x86 Processor Architecture
⦿ What is Microprocessor
⦿ General Concepts
⦿ IA-32 Processor Architecture
⦿ IA-32 Memory Management
⦿ 64-bit Processors
⦿ Components of an IA-32 Microcomputer
⦿ Input-Output System

20
Introduction: What is Microprocessor

Microprocessor

⦿ important part of a computer architecture

⦿ manages the computer's arithmetical,logical and


control activities

21
General Concepts
⦿ Basic microcomputer design
⦿ Instruction execution cycle
⦿ Reading from memory
⦿ How programs run

22
Basic Microcomputer Design
⦿ control unit (CU) coordinates sequence of execution steps
⦿ clock synchronizes CPU operations
⦿ ALU performs arithmetic and bitwise processing

23
Clock
⦿ synchronizes all CPU and BUS operations
⦿ machine (clock) cycle measures time of a single
operation
⦿ clock is used to trigger events

24
Instruction Execution Cycle

⦿ Fetch
⦿ Decode
⦿ Fetch operands
⦿ Execute
⦿ Store output

25
Reading from Memory
⦿ Multiple machine cycles are required when reading from memory, because it
responds much more slowly than the CPU. The steps are:
› address placed on address bus
› Read Line (RD) set low
› CPU waits one cycle for memory to respond
› Read Line (RD) goes to 1, indicating that the data is on the data bus

26
Cache Memory
⦿ High-speed expensive static RAM both inside and
outside the CPU.
› Level-1 cache: inside the CPU
› Level-2 cache: outside the CPU
⦿ Cache hit: when data to be read is already in cache
memory
⦿ Cache miss: when data to be read is not in cache
memory.

27
General-Purpose Registers
Named storage locations inside the CPU, optimized for speed.

28
Accessing Parts of Registers
⦿ Use 8-bit name, 16-bit name, or 32-bit name
⦿ Applies to EAX, EBX, ECX, and EDX

29
Index and Base Registers
⦿ Some registers have only a 16-bit name for
their lower half:

30
Some Specialized Register Uses (1 of 2)
⦿ General-Purpose
› EAX – accumulator
› ECX – loop counter
› ESP – stack pointer
› ESI, EDI – index registers
› EBP – extended frame pointer (stack)
⦿ Segment
› CS – code segment
› DS – data segment
› SS – stack segment
› ES, FS, GS - additional segments

31
Some Specialized Register Uses (2
of 2)

⦿ EIP – instruction pointer


⦿ EFLAGS
› status and control flags
› each flag is a single binary bit

32
Status Flags
⦿ Carry
› unsigned arithmetic out of range
⦿ Overflow
› signed arithmetic out of range
⦿ Sign
› result is negative
⦿ Zero
› result is zero
⦿ Auxiliary Carry
› carry from bit 3 to bit 4
⦿ Parity
› sum of 1 bits is an even number

33
Floating-Point, MMX, XMM Registers
⦿ Eight 80-bit floating-point data registers
› ST(0), ST(1), . . . , ST(7)
› arranged in a stack
› used for all floating-point arithmetic
⦿ Eight 64-bit MMX registers
⦿ Eight 128-bit XMM registers for single-instruction
multiple-data (SIMD) operations

34
Registers

⦿ small set of data holding places that are part of a


computer processor .
⦿ may hold a computer instruction
⦿ or may hold a storage address
⦿ or may hold any kind of data (such as a bit
sequence or individual characters)

35
Registers Location

36
Some Important Types of Registers

› General Purpose Registers

Accumulator register(AX)
Most of arithmetical operations are done with AX.

Base register (BX)


Common use is to do array operations. BX is usually used
with other registers, most notably SP to point to stacks.
Counter register(CX)
This register is used for counter purposes.
Data register(DX)
It is usually used for keeping data value.

37
Types of Registers
Segment registers
CS, DS, ES, and SS are segment registers.
Index registers (SI and DI )
Usually used to process arrays or strings. SI is called source index
and DI is destination index.
Pointer registers(BP, SP, and IP )
› BP is base pointer. Used for preserving space to use local
variables.
› SP is stack pointer. Points to the last used location in the stack.
› IP is instruction pointer Points to the instruction that is going to
be executed next.
› Flag register.
Flag is a register that contains processor status
Different Types

38
64-Bit Processors
⦿ 64-Bit Operation Modes
1. Compatibility mode-can run exisiting 16-bit and 32-bit
applications(Windows supports only 32-bit apps in this mode)
2. 64-bit mode-Windows 64 uses this
⦿ Basic Execution Environment
1. Addresses can be 64 bits(48 bits,in practice)
2. 16 64-bit general purpose registers
3. 64-bit instruction pointer named RIP

39
Memory
⦿ ROM
› read-only memory
⦿ EPROM
› erasable programmable read-only memory
⦿ Dynamic RAM (DRAM)
› inexpensive; must be refreshed constantly
⦿ Static RAM (SRAM)
› expensive; used for cache memory; no refresh required
⦿ Video RAM (VRAM)
› dual ported; optimized for constant video refresh
⦿ CMOS RAM
› complimentary metal-oxide semiconductor
› system setup information
⦿ See: Intel platform memory (Intel technology brief: link address may
change)

40
Levels of Input-Output
⦿ Level 3: Call a library function (C++, Java)
› easy to do; abstracted from hardware; details hidden
› slowest performance
⦿ Level 2: Call an operating system function
› specific to one OS; device-independent
› medium performance
⦿ Level 1: Call a BIOS (basic input-output system)
function
› may produce different results on different systems
› knowledge of hardware required
› usually good performance

41
ASM Programming levels
ASM programs can perform input-output at each of the
following levels:

42

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy