Top Banner
Computer Organization & Assembly Language Instructor: Nausheen Majeed Email: [email protected]
34

Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : [email protected].

Dec 25, 2015

Download

Documents

Justin Parks
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Computer Organization & Assembly Language

Instructor: Nausheen MajeedEmail: [email protected]

Page 2: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Course Objective 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

2

Page 3: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Course Contents Introduction to Microprocessors History & Evolution of Intel Microprocessors Organization of Intel 8086 Processor Fetch-Execution Cycle Microprocessor Bus Structure Internal Memory, External Memory, Input Output Devices Instruction Representation Memory Organization & Structure Memory Addressing Cache Interrupts, DMA Pipelining

3

Page 4: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Contd.. Introduction of Assembly Language:

Data Declaration Loop and Jump Using Arithmetic and Logical Instructions Using Shift and rotate instructions Input / Output and display text Stack and operations on stack Subroutine and Procedures Interfacing with High level languages

Overview of Debugger and practice of writing and debugging programs

Using EMU8086 to write and test assembly language programs

Introduction to Microcontroller Programming

4

Page 5: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Text Books Assembly Language programming and Organization of the IBM PC

by Ytha Yu and Charles Marut. Computer Organization and Architecture, William Stallings Kip Irvine, “Assembly Language for Intel-Based Computers”, Third

Edition,, Prentice Hall Incorporated

5

Page 6: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Outline Introduction to Computer Organization An Introduction to Microprocessors History of Intel 8086 Microprocessors An Introduction to Assembly Language

6

Page 7: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Introduction

7

Page 8: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

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?

8

Page 9: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Structure & Function

9

Structure is the way in which components relate to each other

Function is the operation of individual components as part of the structure.

Main functions performed by a computer system are: Data processing Data storage Data movement Control

Page 10: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

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

10

Page 11: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Structure - Top Level

11

Computer

Main Memory

InputOutput

SystemsInterconnection

Peripherals

Communicationlines

CentralProcessing Unit

Computer

Page 12: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Structure - The CPU

12

Computer Arithmeticand Login Unit

ControlUnit

Internal CPUInterconnection

Registers

CPU

I/O

Memory

SystemBus

CPU

Page 13: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Structure - The Control Unit

13

CPU

ControlMemory

Control Unit Registers and Decoders

SequencingLogic

ControlUnit

ALU

Registers

InternalBus

Control Unit

Page 14: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Microprocessors

14

Page 15: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Microprocessor

15

Microprocessor is an electronic circuit that functions as the central processing unit (CPU) of a computer, providing computational control.

Microprocessors are also used in other advanced electronic systems, such as computer printers, automobiles, and jet airliners.

Page 16: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Processor Integration

16

Early computers had many separate chips for the different portions of a computer system

RegistersALU

Control Memory

Page 17: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Microprocessors

17

First microprocessors placed control, registers, arithmetic logic unit in one integrated circuit (one chip).

I/ODevices

Memory

CPU(ALU +Reg +

control)

Data BusAddress Bus

Control Bus

Page 18: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Modern Processors

18

Modern microprocessors (general purpose Processors) also integrate memory onchip for faster access. External memory and I/O components still required. Memory integrated on the microprocessor is called cache memory.

I/ODevices

Memory

Data BusAddress Bus

Control Bus

Registers, ALU,Fetch,Exe Logic,Bus logic,Cache Memory

CPU

Page 19: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Microcontrollers

19

Microcontrollers integrate all of the components (control, memory, I/O) of a computer system into one integrated circuit. Microcontrollers are intended to be single chip solutions for systems requiring low to moderate processing power.

Microcontroller

Page 20: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Microprocessor vs. Microcontroller

20

Microprocessor CPU is stand-alone, RAM,

ROM, I/O, timer are separate

designer can decide on the amount of ROM, RAM and I/O ports.

general-purpose

Microcontroller CPU, RAM, ROM, I/O and

timer are all on a single chip

fix amount of on-chip ROM, RAM, I/O ports

single-purpose

Page 21: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

History of Intel Microprocessors

21

1971 - 4004 First microprocessor All CPU components on a single chip 4 bit

Followed in 1972 by 8008 8 bit Both designed for specific applications

1974 - 8080 Intel’s first general purpose microprocessor

Page 22: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Pentium Evolution (1)

22

8080 first general purpose microprocessor 8 bit data path Used in first personal computer – Altair

8086 much more powerful 16 bit instruction cache, prefetch few instructions 8088 (8 bit external bus) used in first IBM PC

80286 16 Mbyte memory addressable up from 1Mb

80386 32 bit Support for multitasking

Page 23: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Pentium Evolution (2)

23

80486 sophisticated powerful cache and instruction

pipelining built in maths co-processor

Pentium Superscalar Multiple instructions executed in parallel

Pentium Pro Increased superscalar organization Aggressive register renaming branch prediction data flow analysis speculative execution

Page 24: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Pentium Evolution (3)

24

Pentium II MMX technology graphics, video & audio processing

Pentium III Additional floating point instructions for 3D

graphics Pentium 4

Note Arabic rather than Roman numerals Further floating point and multimedia

enhancements Itanium

64 bit

Page 25: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Assembly Language

25

Page 26: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

Programming Languages

High-Level Languages (HLL) Assembly Language Machine Language

26

Page 27: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

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.

27

Page 28: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

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 register05 0005 add 0005 to AX

28

Page 29: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

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

29

Page 30: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

1.

2.

3.

4.

mov ax, 5

add ax, 10

add ax, 20

mov [0120], ax ax

ax

ax

ax 05

15

35

35

Memory

35 0120

5. int 20

011E

011C

0122

0124

0126

Sample Program Written in Debug

30

Page 31: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

ASM ML

ML

ML

ML

ML

HLL

Figure 1. Machine Language Generation by ASM and HLL programs.

31

Page 32: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

32

Why Learn Assembly Language? Learn how a processor works Explore the internal representation of data and

instructions Allows creation of small and efficient programs Provides a convenient way to directly access the

computers hardware Programmers write subroutine also known as

Interface Subroutine / device drivers in assembly language and call them from high-level language programs.

Page 33: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

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

33

Page 34: Computer Organization & Assembly Language Instructor: Nausheen Majeed Email : nausheen.majeed@ciitlahore.edu.pk.

References

Chapter 1 & 3, Ytha Yu and Charles Marut, “Assembly Language Programming and Organization of IBM PC”,

Chapter 3, William Stallings, “Computer Organization & Architecture”

Chapter 1, Kip Irvine, “Assembly Language for Intel-Based Computers”, Third Edition,, Prentice Hall Incorporated

34