Top Banner
Instruction Set Design CE 140 A1/A2 30 June 2003
39

Instruction Set Design

Jan 09, 2016

Download

Documents

toya

Instruction Set Design. CE 140 A1/A2 30 June 2003. Six-Level Computer. PROBLEM-ORIENTED LANGUAGE LEVEL. Level 5. ASSEMBLY LANGUAGE LEVEL. Level 4. OPERATING SYSTEM MACHINE LEVEL. Level 3. IS DESIGN. INSTRUCTION SET ARCHITECTURE LEVEL. Level 2. MICROARCHITECTURE LEVEL. Level 1. - PowerPoint PPT Presentation
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: Instruction Set Design

Instruction Set Design

CE 140 A1/A230 June 2003

Page 2: Instruction Set Design

Six-Level Computer

PROBLEM-ORIENTED LANGUAGE LEVELLevel 5

ASSEMBLY LANGUAGE LEVELLevel 4

OPERATING SYSTEM MACHINE LEVELLevel 3

INSTRUCTION SET ARCHITECTURE LEVELLevel 2

MICROARCHITECTURE LEVELLevel 1

DIGITAL LOGIC LEVELLevel 0

IS DESIGN

Page 3: Instruction Set Design

Instruction Set Architecture

Interface between hardware and software (compilers)

High-level languages are translated to ISA level

Hardware is built to execute ISA-level programs directly

Page 4: Instruction Set Design

ISA Level

Page 5: Instruction Set Design

ISA Design Process

Architect will talk to compiler writers and hardware engineers Is it cost-effective? Can it be used? Output: a perfectly optimized ISA that

satisfies both compiler writers and hardware engineers

NOT ALWAYS

Page 6: Instruction Set Design

More ISA Design Requirements

“Is it compatible with the predecessor?”

“Can I run my old operating system on it?”

“Will it run all my existing application programs unmodified?”

Constraint: Backward compatibility

Page 7: Instruction Set Design

What makes a good ISA?

Hardware engineers: Instruction set that can be impemented efficiently in current and future technologies

Compiler writers: Clean target for compiled code

Page 8: Instruction Set Design

ISA Level

How machine appears to machine language programmer

Memory Model Registers Data types Instructions

Page 9: Instruction Set Design

Memory Model

Big Endian or Little Endian Alignment requirements Address space

Page 10: Instruction Set Design

Registers

Special-purpose registers PC, SP

General-purpose registers Variables, results, temporary storage Fast access

Flags register or Program Status Word (PSW)

Page 11: Instruction Set Design

Instructions

LOAD, STORE, MOVE Arithmetic instructions Logical instructions Boolean instructions Comparing, branching

Page 12: Instruction Set Design

Data types

Hardware supported data types Integers (signed and unsigned) Floating-point numbers BCD Strings Boolean values

Page 13: Instruction Set Design

Instruction Format Instruction

Opcode Addressing mode Operands

Page 14: Instruction Set Design

Classifying ISAs C = A + B

Stack Accumulator

Register(register-memory)

Register (load-store)

Memory-memory

Push A Load A Load R1, A Load R1, A Add C, A, B

Push B Add B Add R1, B Load R2, B

Add Store C Store C, R1 Add R3, R1, R2

Pop C Store C, R3

Page 15: Instruction Set Design

Design Critera for Instruction Formats

Size Can accommodate all operations Number of bits in the address field

Page 16: Instruction Set Design

Expanding Opcode

16-bit instructions

Page 17: Instruction Set Design

Expanding Opcode

Page 18: Instruction Set Design

Addressing Modes

Immediate Addressing Direct Addressing Register Addressing Register Indirect Addressing Indexed Addressing Based-Index Addressing

Page 19: Instruction Set Design

Immediate Addressing

Operand is directly specified Immediately fetched from memory

with instruction Can only specify constant Range limited by size of field Example: MOV DL, 21

Stores the value 21 into DL

Page 20: Instruction Set Design

Direct Addressing

Operand is specified by giving its address

Constant memory location Can be used for global variables Example: MOV AL, [0200]

Stores the byte located at offset 0200 into AL

Page 21: Instruction Set Design

Register Addressing

Operand is specified by giving the register it is stored in

Examples: MOV AX, BX

Page 22: Instruction Set Design

Register Indirect Addressing

Operand is specified by the register that contains operand’s address

Pointer Example: MOV AX, [BX]

Store the word located at the address specified in BX into AX

Page 23: Instruction Set Design

Indexed Addressing

Useful in accessing elements of a data structure

Example: MOV CX, 5 ST: ADD AX, 0200[SI] ADD SI, 2 LOOP ST

Page 24: Instruction Set Design

Instruction Types

Data Movement Instructions Dyadic Operations Monadic Operations Comparison and Conditional Branches Procedure Call Instructions Stack Instructions Loop Control Input/Output

Page 25: Instruction Set Design

Data Movement Instructions

Movement = Copy Examples

MOV AX, BX MOV AX, [0200] MOV [0200], AX

Page 26: Instruction Set Design

Dyadic Operations

Combine two operands to produce a result

Arithmetic operations Logic operations Examples:

ADD AX, BX AND AX, BX

Page 27: Instruction Set Design

Monadic Operations

Single operand Arithmetic and Logic operations Examples:

Shift - SAL Rotate - ROL

Page 28: Instruction Set Design

Comparison and Conditional Branches

Allow testing data and alter the sequence of instructions based on the result

Branching Uses flags register Examples:

CMP – compare JE – jump if equal

Page 29: Instruction Set Design

Stack Instructions

Allow stack operations Stack – LIFO (Last In, First Out) Examples

PUSH AX PUSH BX POP BX POP AX

Page 30: Instruction Set Design

Procedure Call Instructions

Procedure/subroutine – group of instructions that can be called from several places in the program

Return address must be stored Examples:

CALL RET

Page 31: Instruction Set Design

Loop Control

Execute a group of instructions a fixed number of times

Involves a counter Examples:

LOOP 0100

Page 32: Instruction Set Design

Input/Output

Access input and output ports Examples:

IN AX, 378 OUT 378, AX

Page 33: Instruction Set Design

Pentium II ISA

IA-32 Full support for 8086 and 8088

programs

Page 34: Instruction Set Design

Pentium II Operating Modes Real Mode – operates like a simple

8086/8088 Virtual 8086 Mode – 8086/8088 programs

run in an isolated environment Protected Mode – larger address space,

four privilege levels

Page 35: Instruction Set Design

Pentium II Registers

Page 36: Instruction Set Design

Pentium II Data Types

Type 8 bits 16 bits 32 bits 64 bits

Signed Integer

x x x

Unsigned Integer

x x x

Binary Coded Decimal Integer

x

Floating Point x x

Page 37: Instruction Set Design

Pentium II Instruction Formats

Page 38: Instruction Set Design

Pentium II Addressing Modes

Immediate Direct Register Register Indirect Indexed

Page 39: Instruction Set Design

Pentium II ISA Issues Few, different registers Addressing modes are highly irregular Ancient ISA Current technology

suited for RISC ISA’s Next Generation:

IA-64 - Intel’s 64-bit platform – not compatible with IA-32

AMD64 – AMD’s 64-bit platform – compatible with x86