computer organization & assembly language © by dr. m. amer

29

Upload: willis-ball

Post on 05-Jan-2016

233 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Computer Organization & Assembly Language © by DR. M. Amer
Page 2: Computer Organization & Assembly Language © by DR. M. Amer

Computer Organization Computer Organization &&

Assembly LanguageAssembly Language

©© by DR. M. Amerby DR. M. Amer

Page 3: Computer Organization & Assembly Language © by DR. M. Amer

04/20/2304/20/23

Course Course ContentsContents• IntroductionIntroduction• Computer Evolution and PerformanceComputer Evolution and Performance• Top Level View of Computer Function Top Level View of Computer Function

and Interconnectionand Interconnection• Computer basic units organization Computer basic units organization

[Memory (Cache Memory - Internal & [Memory (Cache Memory - Internal & External Memory) – CPU]External Memory) – CPU]

• Computer cyclesComputer cycles• Input / Output devicesInput / Output devices• Interrupt handlingInterrupt handling• MicrocontrollerMicrocontroller• An Assembly Language is used in the An Assembly Language is used in the

lab.lab.

Page 4: Computer Organization & Assembly Language © by DR. M. Amer

ChapterChapter Introduction Introduction

04/20/2304/20/23

Page 5: Computer Organization & Assembly Language © by DR. M. Amer

What is a Computer?What is a Computer?

ComputerComputerDevice capable of performing computations and making Device capable of performing computations and making logical decisionslogical decisionsComputers process data under the control of sets of Computers process data under the control of sets of instructions called computer programsinstructions called computer programs

Personal computersPersonal computers: economical enough for individual: economical enough for individual

Distributed computingDistributed computing: computing distributed over : computing distributed over networksnetworks

Client/server computingClient/server computing: sharing of information across : sharing of information across computer networks between file servers and clients computer networks between file servers and clients (personal computers) (personal computers)

Page 6: Computer Organization & Assembly Language © by DR. M. Amer

What is a Computer? What is a Computer? (cont.)(cont.)

Computer HardwareComputer Hardware Various devices comprising a computer: Various devices comprising a computer:

Keyboard, screen, mouse, disks, memory, CD-Keyboard, screen, mouse, disks, memory, CD-ROM, and processing unitsROM, and processing units

Hardware Trends: every year or two the following Hardware Trends: every year or two the following approximately double (Moore’s Law):approximately double (Moore’s Law):

Amount of memory in which to execute programsAmount of memory in which to execute programs

Amount of secondary storage (such as disk storage)Amount of secondary storage (such as disk storage)Used to hold programs and data over the longer termUsed to hold programs and data over the longer term

Processor speedsProcessor speedsThe speeds at which computers execute their programsThe speeds at which computers execute their programs

High-levelLanguage

AssemblyLanguage

Firmware

MachineCode

Hardware

User

ApplicationSoftware

OS

Page 7: Computer Organization & Assembly Language © by DR. M. Amer

What is a Computer? What is a Computer? (cont.)(cont.)

Computer SoftwareComputer Software Computer Programs that run on a computer, includingComputer Programs that run on a computer, including

Operation System (OS)Operation System (OS)

Application SoftwareApplication Software

Computer LanguageComputer Language

High-levelLanguage

AssemblyLanguage

Firmware

MachineCode

Hardware

User

ApplicationSoftware

OS

Page 8: Computer Organization & Assembly Language © by DR. M. Amer

Moore's LawMoore's Law

Defined by Defined by Dr. Gordon Moore during the during the sixties.sixties.

Predicts an exponential increase in Predicts an exponential increase in component density over time, with a component density over time, with a doubling time of 18 months.doubling time of 18 months.

Applicable to microprocessors, DRAMs , Applicable to microprocessors, DRAMs , DSPs and other microelectronicsDSPs and other microelectronics..

Page 9: Computer Organization & Assembly Language © by DR. M. Amer

Moore’s Law - DensityMoore’s Law - Density

Page 10: Computer Organization & Assembly Language © by DR. M. Amer

Moore's Law and PerformanceMoore's Law and Performance

The performance of computers is The performance of computers is determined by architecture and clock determined by architecture and clock speed.speed.Clock speed doubles over a 3 year period Clock speed doubles over a 3 year period due to the scaling laws on chip.due to the scaling laws on chip.Processors using identical or similar Processors using identical or similar architectures gain performance directly as architectures gain performance directly as a function of Moore's Law.a function of Moore's Law.Improvements in internal architecture can Improvements in internal architecture can yield better gains than predicted by yield better gains than predicted by Moore's Law.Moore's Law.

Page 11: Computer Organization & Assembly Language © by DR. M. Amer

Moore’s Law - Clock SpeedMoore’s Law - Clock Speed

Page 12: Computer Organization & Assembly Language © by DR. M. Amer

Computer OrganizationComputer Organization

A Typical Von-Neumann ArchitectureA Typical Von-Neumann Architecture

Example:Example:

1.1. InputInput unit unit2.2. OutputOutput unit unit 3.3. MemoryMemory unit unit 4.4. Arithmetic and logicArithmetic and logic unit (ALU) unit (ALU) 5.5. Central processingCentral processing unit (CPU) unit (CPU) 6.6. Secondary storageSecondary storage unit unit

Control Circuit(ex: PC: Program Counter)

ALUMemory I/O

CPU

Page 13: Computer Organization & Assembly Language © by DR. M. Amer

Computer Organization Computer Organization (cont.)(cont.)

Six logical units in every computer:Six logical units in every computer:1.1. InputInput unit unit

Obtains information from input devices (keyboard, mouse)Obtains information from input devices (keyboard, mouse)

2.2. OutputOutput unit unit Outputs information (to screen, to printer, to control other Outputs information (to screen, to printer, to control other devices)devices)

3.3. MemoryMemory unit unit

Rapid access, low capacity, stores input informationRapid access, low capacity, stores input informationROM (Read Only Memory): CMOS, EPROM …ROM (Read Only Memory): CMOS, EPROM …RAM (Random Access Memory): SRAM, DRAM, SIMM, DIMM RAM (Random Access Memory): SRAM, DRAM, SIMM, DIMM ……

Page 14: Computer Organization & Assembly Language © by DR. M. Amer

Computer Organization Computer Organization (cont.)(cont.)

Six logical units in every computer (cont):Six logical units in every computer (cont):

3.3. Arithmetic and logicArithmetic and logic unit (ALU) – part of CPU unit (ALU) – part of CPUPerforms arithmetic calculations (addition, subtraction...) and Performs arithmetic calculations (addition, subtraction...) and logic decisionslogic decisions

4.4. ControlControl unit (CU) - part of CPU unit (CU) - part of CPUSupervises and coordinates the other sections of the computerSupervises and coordinates the other sections of the computer

5.5. Secondary storageSecondary storage unit unit Cheap, long-term, high-capacity storageCheap, long-term, high-capacity storage

Stores inactive programsStores inactive programs

Page 15: Computer Organization & Assembly Language © by DR. M. Amer

Computer Organization Computer Organization (cont.)(cont.)

Central Processing Unit (CPU), Central Processing Unit (CPU), ““brain” of a computer, consisting ofbrain” of a computer, consisting of

Arithmetic and logic unitArithmetic and logic unit (ALU): performs arithmetic calculations (ALU): performs arithmetic calculations (addition, subtraction...) and logic decisions (>, <, =, ...)(addition, subtraction...) and logic decisions (>, <, =, ...)

Control Unit (CU): decodes each machine instruction and sends Control Unit (CU): decodes each machine instruction and sends signal to other components for carrying out the instruction.signal to other components for carrying out the instruction.

An integrated circuit (IC) that is a full central processing unit An integrated circuit (IC) that is a full central processing unit is called a microprocessor (is called a microprocessor (pp); a CPU’s current instruction ); a CPU’s current instruction and data values are stored temporally inside the CPU in and data values are stored temporally inside the CPU in special high-speed memory location called registers.special high-speed memory location called registers.

CPU speed: ? MHz (M: Mega = 10CPU speed: ? MHz (M: Mega = 1066, Hz=1/sec);, Hz=1/sec);

Page 16: Computer Organization & Assembly Language © by DR. M. Amer

Computer Organization Computer Organization (cont.)(cont.)

MemoryMemoryA large collection of circuits, each capable of A large collection of circuits, each capable of storing bitstoring bit

Cells (words): manageable units; typical size is 8 Cells (words): manageable units; typical size is 8 bits (1 byte), some machines are 16 bits (2 bits (1 byte), some machines are 16 bits (2 bytes) and some are 32 bits or 64 bitsbytes) and some are 32 bits or 64 bits

Byte (8 bits), KB (kilobyte, 10Byte (8 bits), KB (kilobyte, 1033 2 210 10 bytes), MB bytes), MB (Megabyte, 10(Megabyte, 1066 2 220 20 bytes), GB (Gigabyte, 10bytes), GB (Gigabyte, 1099 2 230 30

bytes). Note: k bytes). Note: k ≠ K because 1000 ≠ 1024.≠ K because 1000 ≠ 1024.

Page 17: Computer Organization & Assembly Language © by DR. M. Amer

Computer Organization Computer Organization (cont.)(cont.)

Computer memory is comparable to a collection of Computer memory is comparable to a collection of numbered mailboxes. To identify individual cells in a numbered mailboxes. To identify individual cells in a machine’s main memory, each cell is assigned a unique machine’s main memory, each cell is assigned a unique name, called its addressname, called its address

The organization of byte-size memory cellThe organization of byte-size memory cell

...01001000 01100101 01101100 0110111101101100 00101110

H e l l o ,ASCII

...Data

Address 0000 0101 0000 0110 0000 0111 0000 1000 0001 0001 0001 0010

Address BusData Bus

0 0 0 0 0 1 0 1 Low-order endHigh-order end

Least Significant Bit (LSB)Most Significant Bit (MSB)

Page 18: Computer Organization & Assembly Language © by DR. M. Amer

Architecture & Organization 1

• Architecture is those attributes visible to the programmer—Instruction set, number of bits used for data

representation, I/O mechanisms, addressing techniques.

—e.g. Is there a multiply instruction?

• Organization is how features are implemented—Control signals, interfaces, memory

technology.—e.g. Is there a hardware multiply unit or is it

done by repeated addition?

Page 19: Computer Organization & Assembly Language © by DR. M. Amer

Architecture & Organization 2

• All Intel x86 family share the same basic architecture

• The IBM System/370 family share the same basic architecture

• This gives code compatibility—At least backwards

• Organization differs between different versions

Page 20: Computer Organization & Assembly Language © by DR. M. Amer

Structure & Function

• Structure is the way in which components relate to each other

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

Page 21: Computer Organization & Assembly Language © by DR. M. Amer

Function

• All computer functions are:—Data processing—Data storage—Data movement—Control

Page 22: Computer Organization & Assembly Language © by DR. M. Amer

Functional View

Page 23: Computer Organization & Assembly Language © by DR. M. Amer

Operations (a) Data movement

Page 24: Computer Organization & Assembly Language © by DR. M. Amer

Operations (b) Storage

Page 25: Computer Organization & Assembly Language © by DR. M. Amer

Operation (c) Processing from/to storage

Page 26: Computer Organization & Assembly Language © by DR. M. Amer

Operation (d)Processing from storage to I/O

Page 27: Computer Organization & Assembly Language © by DR. M. Amer

Structure - Top Level

Computer

Main Memory

InputOutput

SystemsInterconnection

Peripherals

Communicationlines

CentralProcessing Unit

Computer

Page 28: Computer Organization & Assembly Language © by DR. M. Amer

Structure - The CPU

Computer Arithmeticand Login Unit

ControlUnit

Internal CPUInterconnection

Registers

CPU

I/O

Memory

SystemBus

CPU

Page 29: Computer Organization & Assembly Language © by DR. M. Amer

Structure - The Control Unit

CPU

ControlMemory

Control Unit Registers and Decoders

SequencingLogin

ControlUnit

ALU

Registers

InternalBus

Control Unit