1 text reference: warford. 2 computer architecture: the design of those aspects of a computer which...

19
1 Text Reference: Text Reference: Warford Warford

Upload: amanda-moore

Post on 05-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

11

Text Reference: WarfordText Reference: Warford

Page 2: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

22

Computer Architecture:Computer Architecture:

The design of those aspects of a The design of those aspects of a computer which are visible to the computer which are visible to the programmer.programmer.

Architecture

Organization

Instruction Set

Memory

Registers

Page 3: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

33

Digital Computer:Digital Computer:“…“…machine that accepts digitized input machine that accepts digitized input information, processes it according to a list of information, processes it according to a list of internally stored instructions, and produces the internally stored instructions, and produces the resulting output information.resulting output information.

The list of instructions is called a computer The list of instructions is called a computer programprogram and the internal storage is called computer and the internal storage is called computer memorymemory.”.”

from: Computer Organization 4th Editionfrom: Computer Organization 4th Edition

Hamacher, Banesic, ZakyHamacher, Banesic, Zaky

McGraw Hill, 1996.McGraw Hill, 1996.

Page 4: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

44

Processing

Processing

?

analysis

design

Computer Work FlowComputer Work Flow

Input

Input

Input

Output

Output

?

data flow

instruction flow

Page 5: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

55

Computer Main ElementsComputer Main Elements

System Bus

CentralProcessing

Unit (CPU)

MemoryInput/Output

Page 6: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

66

Computer Instruction SetComputer Instruction SetIndividual instructions are very simple:Individual instructions are very simple:– add two numbersadd two numbers– move a piece of data from one location to move a piece of data from one location to

anotheranother– compare two numberscompare two numbers

The only representation of instructions and data The only representation of instructions and data that a computer can understand is that a computer can understand is BINARY BINARY (values of 1 and 0 only).(values of 1 and 0 only).

Page 7: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

77

Sample machine language instruction:Sample machine language instruction:

(ADD contents of Register B to contents of (ADD contents of Register B to contents of Register A)Register A)

0000011 110000110000011 11000011

Sample Data:Sample Data:

(the character “B”, also the number 66)(the character “B”, also the number 66)

0100001001000010

Problem: Binary representation of instructions Problem: Binary representation of instructions and data are not easily generated, and data are not easily generated, manipulated, or understood by humans.manipulated, or understood by humans.

Page 8: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

88

Solution:Solution:– design a new set of instructions (L2) more design a new set of instructions (L2) more

convenient to use by humans than native convenient to use by humans than native (L1) machine instructions.(L1) machine instructions.

L1 Instruction:L1 Instruction: 00000011 00000011 1100001111000011

Equivalent L2 Instruction:Equivalent L2 Instruction: ADD A, BADD A, B

– How can a program written in L2 be How can a program written in L2 be executed?executed?

Page 9: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

99

TranslationTranslation

L2 program(ADD A, B)

Translator Program

(00000011 11000011)

L1 program(00000011 11000011)

Page 10: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1010

InterpretationInterpretation

L2 program(ADD A, B)

Interpreter Program(L2 Virtual Machine)

(00000011 11000011)

Page 11: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1111

Digital Computer as a Multilevel MachineDigital Computer as a Multilevel Machine

High Level Language Level

Assembly Language Level

Operating System Level

Machine Language Level

Microprogram Level

Digital Logic Level

Translation (Compiler)

Translation (Assembler)

Softw

areH

ardw

are

Machine code

Machine codePartial Interpretation,Partial Pass-through

Interpretation (microprogram)

Directly executed by hardware

Applications Level

Page 12: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1212

““gate” level logic circuits. Primitive gate” level logic circuits. Primitive “computations” confined to “computations” confined to Boolean operations (AND, OR, Boolean operations (AND, OR, NOT)NOT)

no concept of a no concept of a programprogram at this at this level. There is simply a sequence level. There is simply a sequence of instructions to be processed.of instructions to be processed.

Digital Logic LevelDigital Logic Level

Page 13: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1313

Microprogramming LevelMicroprogramming Level

machine language instruction machine language instruction interpretedinterpreted. - causes a series of . - causes a series of simpler instructions to be executed simpler instructions to be executed by underlying digital logic level.by underlying digital logic level.

MicroprogramMicroprogram for each instruction for each instruction stored permanently in memory stored permanently in memory internal to the microprocessor when internal to the microprocessor when it is manufactured.it is manufactured.

Page 14: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1414

Microprogram level example:Microprogram level example:

Machine language level instruction:Machine language level instruction:00000011 1100001100000011 11000011

Microprogram:Microprogram:1. Fetch instruction from memory1. Fetch instruction from memory

2. Increment Program Counter in preparation for the 2. Increment Program Counter in preparation for the next instruction. (the Program Counter is a register next instruction. (the Program Counter is a register that indicates where the next instruction to be that indicates where the next instruction to be executed is stored in memory)executed is stored in memory)

3. Route contents of Register B and Register A to 3. Route contents of Register B and Register A to Arithmetic Logic Unit (ALU) input.Arithmetic Logic Unit (ALU) input.

4. ADD the two inputs to the ALU generating a result.4. ADD the two inputs to the ALU generating a result.

5. Store result in Register A.5. Store result in Register A.

Page 15: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1515

this level defines the interface this level defines the interface between the inner workings of the between the inner workings of the processor and the outside world.processor and the outside world.

Every model of processor has a Every model of processor has a unique set of instructions (ISA: unique set of instructions (ISA: Instruction Set ArchitectureInstruction Set Architecture) and ) and encoded instruction formats.encoded instruction formats.

Machine Language LevelMachine Language Level

Page 16: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1616

Operating System LevelOperating System Levelan Operating System is a an Operating System is a programprogram that provides an that provides an environment in which a user can execute other programs in environment in which a user can execute other programs in a convenient and efficient manner.a convenient and efficient manner.

It is responsible for managing system resources (in time It is responsible for managing system resources (in time and space), allocating resources to user programs, and and space), allocating resources to user programs, and monitoring the integrity of the computer system.monitoring the integrity of the computer system.

It provides services to programs in order to make the It provides services to programs in order to make the programming task easier. These services can be invoked by programming task easier. These services can be invoked by the user program through “system calls”.the user program through “system calls”.

Most of the code generated by upper levels is passed Most of the code generated by upper levels is passed directly to the machine language level.directly to the machine language level.

Page 17: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1717

Assembly Language LevelAssembly Language Levelassembly language is a symbolic representation of the assembly language is a symbolic representation of the machine language level.machine language level.

The programmer must still be aware of the internal The programmer must still be aware of the internal architecture of the target machine.architecture of the target machine.

In general, there is a 1-to-1 mapping between an assembly In general, there is a 1-to-1 mapping between an assembly language statement and a machine language statement.language statement and a machine language statement.

Example PC machine language instruction: Example PC machine language instruction: 00000011 00000011 1100001111000011

Equivalent PC Assembly Language instruction: Equivalent PC Assembly Language instruction: ADD ADD AX, BXAX, BX

(adds the contents of processor register “AX” to contents (adds the contents of processor register “AX” to contents of processor register “BX” and stores the result in AX)of processor register “BX” and stores the result in AX)

Page 18: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1818

Hides the low level architectural Hides the low level architectural details from the programmer.details from the programmer.

High level languages are generally High level languages are generally machine (architecture)machine (architecture) independent. independent.

Provides language constructs for Provides language constructs for specifying and manipulating specifying and manipulating complex data structures. complex data structures.

Supports a variety of programming Supports a variety of programming styles (i.e. linear, object oriented)styles (i.e. linear, object oriented)

High Level Language LevelHigh Level Language Level

Page 19: 1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization

1919

High Level Language LevelHigh Level Language Level– Pascal, C, C++,Fortran, JavaPascal, C, C++,Fortran, Java (compiled) (compiled)– Perl, Python, JavaScript, Java Perl, Python, JavaScript, Java

(interpreted)(interpreted)– Hides the low level architectural details Hides the low level architectural details

from the programmer.from the programmer.– High level languages are generally machine High level languages are generally machine

(architecture)(architecture) independent. independent.Example code to add two numbers together:Example code to add two numbers together:

int value1, value2;int value1, value2;value1 = value1 + value2;value1 = value1 + value2;