• No results found

Chapter7-Instruction Sets.ppt

N/A
N/A
Protected

Academic year: 2020

Share "Chapter7-Instruction Sets.ppt"

Copied!
30
0
0

Loading.... (view fulltext now)

Full text

(1)

Computer Organization

Computer Organization

and Architecture

and Architecture

Chapter 7

Chapter 7

Instruction Sets

(2)

What is an instruction set?

What is an instruction set?

►The complete collection of instructions The complete collection of instructions

that are understood by a CPU

that are understood by a CPU

►Machine CodeMachine Code ►BinaryBinary

(Usually represented by assembly codes)

(3)

Instruction Representation

Instruction Representation

►In machine code each instruction has a In machine code each instruction has a

unique bit pattern

unique bit pattern

►For human consumption, a symbolic For human consumption, a symbolic

representation is used

representation is used

 e.g. ADD, SUB, LOADe.g. ADD, SUB, LOAD

►Operands can also be represented in this Operands can also be represented in this

way

way

(4)

High Level Language

Instruction Representation

Instruction Representation

Compiler

Assembly Language

Assembler

Machine Language

Interpreter

(5)

Instruction Cycle

Instruction Cycle

(refer to chapter 4)(refer to chapter 4)

Fetch Instruction Decode Instruction

Fetch Operand Execute at ALU

Store Result Next

Instruction Fetch instruction from program Memory

Determine required actions and instruction size

Locate and obtain operand data

Compute result, value or status

Save result in memory

(6)

Instruction Types

Instruction Types

►Data processingData processing

►Data storage (main memory)Data storage (main memory)

(7)

Design Decisions

Design Decisions

►Instruction formatsInstruction formats

 Length of op code fieldLength of op code field

 Number of addressesNumber of addresses

►Operation selectionOperation selection  How many ops?How many ops?

 What can they do?What can they do?

 How complex are they?How complex are they?

►Data types and sizeData types and size

Fetch Instruction Decode Instruction

Fetch Operand Execute at ALU

Store Result Next

(8)

Design Decisions

Design Decisions

Fetch Instruction Decode Instruction Fetch Operand Execute at ALU

Store Result Next

Instruction

► Location of operands and resultLocation of operands and result

 Number of CPU registers Number of CPU registers

available

available

 Which operations can be Which operations can be

performed on which registers?

performed on which registers?

 which can or cannot be in which can or cannot be in

memory?

memory?

► Addressing modesAddressing modes ► Next instructionNext instruction

(9)

Major choices in the type of

Major choices in the type of

internal storage in the CPU

internal storage in the CPU

a stack a stack (the operands are implicitly on (the operands are implicitly on

top of the stack)

top of the stack)

an accumulatoran accumulator (one operand is (one operand is

implicitly the accumulator)

implicitly the accumulator)

a set of registersa set of registers (all operands are (all operands are

explicit either registers or memory

explicit either registers or memory

locations)

(10)

The code segment C = A + B how it would appear on the classes of instruction sets

Stack Accumulator Register

PUSH A Load A Load R1,A PUSH B ADD B ADD R1,B ADD Store C Store C,R1 POP C

(11)

Primary advantages and disadvantages of each class of machine

Machine

Type Advantages Disadvantages

Stack

Simple model of

expression evaluation. Good code density.

A stack can't be randomly

accessed. It makes it difficult to generate efficient code.

Accumulator

Minimizes internal state of machine. Short

instructions

Since accumulator is only temporary storage, memory traffic is highest.

Register Most general model for code generation

All operands must be named, leading to longer instructions.

(12)

Types of Operand

Types of Operand

►AddressesAddresses

►NumbersNumbers

 Integer/floating pointInteger/floating point

►CharactersCharacters  ASCII etc.ASCII etc.

(13)

Specific Data Types

Specific Data Types

► General - arbitrary binary contentsGeneral - arbitrary binary contents ► Integer - single binary valueInteger - single binary value

► Ordinal - unsigned integerOrdinal - unsigned integer

► Unpacked BCD - One digit per byteUnpacked BCD - One digit per byte ► Packed BCD - 2 BCD digits per bytePacked BCD - 2 BCD digits per byte

► Near Pointer - 32 bit offset within segmentNear Pointer - 32 bit offset within segment ► Bit fieldBit field

(14)

Data Transfer

Data Transfer

►SpecifySpecify  SourceSource

 DestinationDestination

 Amount of dataAmount of data

►May be different instructions for different May be different instructions for different

movements

movements

(15)

Instruction Fetch Cycle (Steps 1 and 2)

Instruction Fetch Cycle (Steps 1 and 2)

► The CPU presents the The CPU presents the

value of the program

value of the program

counter (PC) on the

counter (PC) on the

address bus

address bus

► The CPU then fetches The CPU then fetches

the instruction from

the instruction from

main memory via the

main memory via the

data bus into the

data bus into the

Instruction Register (IR)

Instruction Register (IR)

CU

Step 1

Step 2 Decode Instruction

(16)

Execute Cycle (Steps 3 and 4)

Execute Cycle (Steps 3 and 4)

► Read the effective address” Read the effective address”

from memory if the

from memory if the

instruction has an indirect

instruction has an indirect

address address T1 T2 ALU CC D0 D6 D1 CU IR D7 A0 TP A1 PC SP 1 CU

Step 3 Operand Fetch

Step 4 Execute" the instruction

► From the instruction register, From the instruction register,

the data forming the instruction

the data forming the instruction

is decoded by the control unit

is decoded by the control unit

► pass the decoded information as a sequence of control signals to the pass the decoded information as a sequence of control signals to the

function units to perform the actions required by the instruction

function units to perform the actions required by the instruction

► Then pass them to the Arithmetic logic unit (ALU) for processingThen pass them to the Arithmetic logic unit (ALU) for processing ► write the result back to a register write the result back to a register

(17)

Step 5. Store Result

Step 5. Store Result

►"Store" in memory any results generated by "Store" in memory any results generated by

the operation or send the results to an

the operation or send the results to an

output device

output device

►Based on the condition feedback from the Based on the condition feedback from the

ALU, the PC is either incremented to

ALU, the PC is either incremented to

address the next instruction or updated to a

address the next instruction or updated to a

different address where the next instruction

different address where the next instruction

will be fetched

will be fetched

(18)

Two different competing

philosophies in designing modern

computer architecture

complex instruction set computercomplex instruction set computer

(

(CISCCISC))

reduced instruction set computerreduced instruction set computer

(

(19)

CISC

CISC

► A A complex instruction set computercomplex instruction set computer ( (CISCCISC) is ) is a microprocessor instruction set architecture (ISA)

a microprocessor instruction set architecture (ISA)

in which each instruction can execute several

in which each instruction can execute several

low-level operations, such as a load from memory, an

level operations, such as a load from memory, an

arithmetic operation, and a memory store, all in a

arithmetic operation, and a memory store, all in a

single instruction

single instruction

► Examples of CISC processors are the CDC 6600, Examples of CISC processors are the CDC 6600, System/360, VAX, PDP-11, Motorola 68000 family,

System/360, VAX, PDP-11, Motorola 68000 family,

and Intel and AMD x86 CPUs

(20)

CISC

CISC

► requires the use of microcode to decode the requires the use of microcode to decode the (macro) instructions

(macro) instructions

► primarily motivated by a desire to reduce the

"semantic gap" between the machine language of the processor and the high-level languages in

which people were programming (Work well with simpler compiler)

► instruction set typically includes many instructions

(21)

CISC

CISC

►many very complex instructions never or

seldom used, but they make the control unit extremely complex and thus have a high

control unit delay.

►Richer instruction set, some simple, some

very complex

►Instructions generally take more than 1

(22)
(23)

RISC

RISC

reduced instruction set computerreduced instruction set computer, or , or

RISC

RISC, is a microprocessor CPU design , is a microprocessor CPU design

philosophy that favors a simpler set of

philosophy that favors a simpler set of

instructions that all take about the same

instructions that all take about the same

amount of time to execute

amount of time to execute

►most common RISC microprocessors are most common RISC microprocessors are

AVR, PIC, ARM, DEC Alpha, PA-RISC,

AVR, PIC, ARM, DEC Alpha, PA-RISC,

SPARC, MIPS, and Power Architecture

(24)

RISC

RISC

►design philosophies behind RISC chip are

(25)

RISC

RISC

►Simple primitive instructions and addressing

modes

►Instructions execute in one clock cycle

►simpler processor pipeline

►Uniformed length instructions and fixed

instruction format

►Instructions interface with memory via fixed

(26)

RISC

RISC

►Hardwired control

►Complexity pushed to the compiler

►Large number of registers

(27)

Who wins???

Who wins???

►RISC processors gain a reputation for high

performance

►nowadays, the difference between RISC and

(28)

Bottom Line

Bottom Line

►What counts in a real world is always how

fast a chip can execute the instructions it is given; and

►how well it runs existing software.

►Making a processor successful is more than

(29)

“ The biggest threat for CISC and RISC might not be each other, but a new technology

called EPIC (Explicitly Parallel Instruction Computing)”

(30)

References

References

► William Stallings. Computer Architecture and William Stallings. Computer Architecture and Organization, 2000

Organization, 2000

► Miles Morducca and Vincent Heuring. Principles Miles Morducca and Vincent Heuring. Principles of Computer Architecture, 1999

of Computer Architecture, 1999

► Hamacher, V. C., Vranesic, Z.G. and Zaky, S.G., Hamacher, V. C., Vranesic, Z.G. and Zaky, S.G., Computer Organization, 4th Ed.

Computer Organization, 4th Ed., McGraw-Hill, , McGraw-Hill,

1996.

1996.

► Yi Gao, Shilang Tang, Zhongli Ding. Comparison

References

Related documents

5. Special instructions: system calls, traps, access to special purpose registers.. Laboratorio de Tecnologías de Información. Hw Hw 3 3 : List of Processors : List

Pooled results from the present meta-analysis, includ- ing four RCTs in patients with diabetic and antiretroviral toxic neuropathy, showed the ef ficacy of ALC compared to placebo

scope and required forms to be submitted with proposal but to verify if the scope of work is attainable. Respond to question via

Push address of next instruction onto stack Start executing instructions at Dest.

Where the operand is at the memory location whose address is the sum of a register and a constant in the instruction

DESCRIPTION: Grants to residential substance abuse treatment programs for women and children and a variety of projects related to mental health concerns such as prevention and

Marinated, grilled lamb tenderloin skewer, chicken skewer, meat balls, lamb chops, rice, grilled vegetables, house bread.

b) common instruction set architecture c) complex information set architecture d) common information set architecture.. reduce the cycles per instruction at the cost of the number of