The Instruction Set Architecture Level Chapter 5.

82
The Instruction Set Architecture Level Chapter 5
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    227
  • download

    1

Transcript of The Instruction Set Architecture Level Chapter 5.

Page 1: The Instruction Set Architecture Level Chapter 5.

The Instruction SetArchitecture Level

Chapter 5

Page 2: The Instruction Set Architecture Level Chapter 5.

Tradeoffs

a) Hardware wants simple clean from point of view of components

b) Software wants complex, fast, extended instructions

c) Sales (customers) want backward compatibility

Page 3: The Instruction Set Architecture Level Chapter 5.

Good ISA

a) Implement efficiently in current and future technology

b) Good target for compiled code

Page 4: The Instruction Set Architecture Level Chapter 5.

Properities of ISA levela) Memory modelb) Registersc) Data Typesd) Instructionse) Security

In Additiona) Pipelineb) Superscalarc) Etc.

Some officially documented (SPARC)

Page 5: The Instruction Set Architecture Level Chapter 5.

ISA Level

The ISA level is the interface between the compilers and the hardware.

Page 6: The Instruction Set Architecture Level Chapter 5.

Memory Models

An 8-byte word in a little-endian memory. (a) Aligned. (b) Notaligned. Some machines require that words in memory be aligned.

Page 7: The Instruction Set Architecture Level Chapter 5.

Memory Modela) Alignment

b) Legacy

c) Cache logic– Synchronization– Serialized– other

d) Legacy

e) Split memory data/instructions

f) Linear

g) Access modes

Page 8: The Instruction Set Architecture Level Chapter 5.

Registers

a) ISA always visible to micro architecture

b) Micro level some visible to ISA

c) Register types– General– Specific– Mixed (EDX)– Flag Register – PSW

• N negative• Z Zero• V oVerflow• C Carry• A Auxilary cary• P Parity

Page 9: The Instruction Set Architecture Level Chapter 5.

ISA Modes

a) Pentium modes– Real mode 8088 compatibility– Virtual 8086 mode – run multiple 8088 protected– Protected mode – all features on– Memory 16K different 4 GB address spaces– Limited by OS

Page 10: The Instruction Set Architecture Level Chapter 5.

Overview of the Pentium 4 ISA Level

The Pentium 4’s primary registers.

Page 11: The Instruction Set Architecture Level Chapter 5.

UltraSparc III ISA

a) 64 bit machine

b) 264 linear memory – larger than needed

c) Register windows – emulate call stack in registers

d) Load/store architecture

Page 12: The Instruction Set Architecture Level Chapter 5.

Overview of the UltraSPARC III ISA Level (1)

The UltraSPARC III’s general registers.

Page 13: The Instruction Set Architecture Level Chapter 5.

Overview of the UltraSPARC III ISA Level (2)

Operation of the

UltraSPARC III

register windows.

Page 14: The Instruction Set Architecture Level Chapter 5.

8051 Architecture

a) 64K for program

b) 64K for data

c) Split for ROM/RAM combination

d) 4 sets of registers ( 8 registers per set)

e) Allows for quick interrupt

f) No built in security

g) Bit Addressable memory

h) Registers and IO use memory space

i) Some registers general and some dedicated

Page 15: The Instruction Set Architecture Level Chapter 5.

Overview of the 8051 ISA Level

(a) On-chip memory organization for the 8051. (b) Major 8051 registers.

Page 16: The Instruction Set Architecture Level Chapter 5.

Data Types on the Pentium 4

The Pentium 4 numeric data types.

Supported types are marked with ×.

Page 17: The Instruction Set Architecture Level Chapter 5.

Data Types on the UltraSPARC III

The UltraSPARC III numeric data types.

Supported types are marked with ×.

Page 18: The Instruction Set Architecture Level Chapter 5.

Data Types on the 8051

The 8051 numeric data types.

Supported types are marked with ×.

Page 19: The Instruction Set Architecture Level Chapter 5.

Instruction Formats (1)

Four common instruction formats: (a) Zero-address instruction. (b) One-address instruction (c) Two-address instruction. (d) Three-address instruction.

Page 20: The Instruction Set Architecture Level Chapter 5.

Instruction Formats (2)

Some possible relationships between instruction and word length.

Page 21: The Instruction Set Architecture Level Chapter 5.

Instruction Design Criteria

a) Stack based vs. many registers

b) Now vs. the future

c) Short are better than long (within limits)

d) Leave room for expansion

e) Upper limit = (cache band width)/instruction length

f) Bits in address field

Page 22: The Instruction Set Architecture Level Chapter 5.

Expanding Opcodes (1)

An instruction with a 4-bit opcode and three 4-bit address fields.

Page 23: The Instruction Set Architecture Level Chapter 5.

Expanding Opcodes (2)

An expanding opcode allowing 15 three-address instructions, 14two-address instructions, 31 one-address instructions, and 16

zero-address instructions. The fields marked xxxx, yyyy, and zzzz are 4-bit address fields.

Page 24: The Instruction Set Architecture Level Chapter 5.

Pentium opcodes

a) Highly complex and irregular

b) 6 variable length fields, 5 are optional

c) Only one operand in memory

Page 25: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Instruction Formats

The Pentium 4 instruction formats.

Page 26: The Instruction Set Architecture Level Chapter 5.

UltraSPARC instruction format

a) All 32 bit

b) Aligned in memory

c) Up to 3 operands in instruction

Page 27: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instruction Formats

The original SPARC instruction formats.

Page 28: The Instruction Set Architecture Level Chapter 5.

8051 Instruction format

a) 6 formats

b) 1,2 or 3 bytes long

c) Original 8088 compare to Pentium structure

Page 29: The Instruction Set Architecture Level Chapter 5.

The 8051 Instruction Formats

The 8051 instruction formats.

Page 30: The Instruction Set Architecture Level Chapter 5.

Address modes

a) Immediate - embedded constant

b) Direct – full address in instruction

c) Register Addressing – refers to register instead of memory

d) Register Indirect addressing – address in register

e) Indexed Addressing – memory iindexed by register

f) Based-Index Addressing – add 2 register plus an optional offset

g) Stack Addressing –

h) Index mode – branch +- offset

Page 31: The Instruction Set Architecture Level Chapter 5.

Addressing

An immediate instruction for loading 4 into register 1.

Register Indirect Addressing: a generic assembly program for computing the sum of the elements of an array.

Page 32: The Instruction Set Architecture Level Chapter 5.

Indexed Addressing (1)

A generic assembly program for computing the OR of Ai AND Bi for two 1024-element arrays.

Page 33: The Instruction Set Architecture Level Chapter 5.

Indexed Addressing (2)

A possible representation of MOV R4,A(R2).

Page 34: The Instruction Set Architecture Level Chapter 5.

Reverse Polish Notation (1)

Each railroad car represents one symbol in the formula to be converted from infix to reverse Polish notation.

Page 35: The Instruction Set Architecture Level Chapter 5.

Reverse Polish Notation (2)

Decision table used by the infix-to-reverse Polish notation algorithm

Page 36: The Instruction Set Architecture Level Chapter 5.

Reverse Polish Notation (3)

Some examples of infix expressions and their reverse Polish notation equivalents.

Page 37: The Instruction Set Architecture Level Chapter 5.

Evaluation of Reverse Polish notation Formulas

Use of a stack to evaluate a reverse Polish notation formula.

Page 38: The Instruction Set Architecture Level Chapter 5.

Orthogonality of Opcodes and Addressing Modes (1)

A simple design for the instruction formats of a three-address machine.

Page 39: The Instruction Set Architecture Level Chapter 5.

Orthogonality of Opcodes and Addressing Modes (2)

A simple design for the instruction formats of a two-address machine.

Page 40: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Addressing Modes (1)

The Pentium 4 32-bit addressing modes. M[x] is the memory word at x.

Page 41: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Addressing Modes (2)

Access to a[i].

Page 42: The Instruction Set Architecture Level Chapter 5.

Discussion of Addressing Modes

A comparison of addressing modes.

Page 43: The Instruction Set Architecture Level Chapter 5.

Instruction types

a) Data movement instructions

b) Dyadic Operations add, sub, mul, div, and

c) Monadic Operations one operand and one result (shift)

d) Comparison and Conditional branch

e) Procedure calls

f) Loop Control

g) Input/Output

Page 44: The Instruction Set Architecture Level Chapter 5.

Loop Control

(a) Test-at-the-end loop. (b) Test-at-the-beginning loop.

Page 45: The Instruction Set Architecture Level Chapter 5.

Input/Output (1)

Device registers for a simple terminal.

Page 46: The Instruction Set Architecture Level Chapter 5.

Input/Output (2)

An example of programmed I/O.

Page 47: The Instruction Set Architecture Level Chapter 5.

Input/Output (3)

A system with a DMA controller.

Page 48: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Instructions (1)

A selection of the Pentium 4 integer instructions.

Page 49: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Instructions (2)

A selection of the Pentium 4 integer instructions.

Page 50: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Instructions (3)

A selection of the Pentium 4 integer instructions.

Page 51: The Instruction Set Architecture Level Chapter 5.

The Pentium 4 Instructions (4)

A selection of the Pentium 4 integer instructions.

Page 52: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instructions (1)

The primary UltraSPARC III integer instructions.

Page 53: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instructions (2)

The primary UltraSPARC III integer instructions.

Page 54: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instructions (3)

The primary UltraSPARC III integer instructions.

Page 55: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instructions (4)

The primary UltraSPARC III integer instructions.

Page 56: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instructions (5)

The primary UltraSPARC III integer instructions.

Page 57: The Instruction Set Architecture Level Chapter 5.

The UltraSPARC III Instructions (6)

Some simulated UltraSPARC III instructions.

Page 58: The Instruction Set Architecture Level Chapter 5.

8051 Instructions (1)

The 8051 Instruction set.

Page 59: The Instruction Set Architecture Level Chapter 5.

8051 Instructions (2)

The 8051 Instruction set.

Page 60: The Instruction Set Architecture Level Chapter 5.

8051 Instructions (3)

The 8051 Instruction set.

Page 61: The Instruction Set Architecture Level Chapter 5.

8051 Instructions (4)

The 8051 Instruction set.

Page 62: The Instruction Set Architecture Level Chapter 5.

8051 Instructions (5)

The 8051 Instruction set.

Page 63: The Instruction Set Architecture Level Chapter 5.

Sequential Flow of Control and Branches

Program counter as a function of time (smoothed). (a) Without branches. (b) With branches.

Page 64: The Instruction Set Architecture Level Chapter 5.

Recursive Procedures (1)

Initial configuration for the Towers of Hanoi problem for five disks.

Page 65: The Instruction Set Architecture Level Chapter 5.

Recursive Procedures (2)

The steps required to solve the Towers of Hanoi for three disks.

Page 66: The Instruction Set Architecture Level Chapter 5.

Recursive Procedures (3)

The steps required to solve the Towers of Hanoi for three disks.

Page 67: The Instruction Set Architecture Level Chapter 5.

Recursive Procedures (4)

A procedure for solving the Towers of Hanoi.

Page 68: The Instruction Set Architecture Level Chapter 5.

Recursive Procedures (5)

The stack at several points during the execution of Fig. 5-42.

Page 69: The Instruction Set Architecture Level Chapter 5.

Coroutines (1)

When a procedure is called,

execution of the procedure

always begins at the first

statement of the procedure.

Page 70: The Instruction Set Architecture Level Chapter 5.

Coroutines (2)

When a coroutine is resumed, execution begins at thestatement where it left off the previous time, not at the beginning.

Page 71: The Instruction Set Architecture Level Chapter 5.

Interrupts

Time sequence of multiple interrupt example.

Page 72: The Instruction Set Architecture Level Chapter 5.

Towers of Hanoi in Pentium 4 Assembly Language (1)

Towers of Hanoi for Pentium 4.

. . .

Page 73: The Instruction Set Architecture Level Chapter 5.

Towers of Hanoi in Pentium 4 Assembly Language (2)

Towers of Hanoi for Pentium 4.

. . .

. . .

Page 74: The Instruction Set Architecture Level Chapter 5.

Towers of Hanoi in Pentium 4 Assembly Language (3)

Towers of Hanoi for Pentium 4.

. . .

Page 75: The Instruction Set Architecture Level Chapter 5.

Towers of Hanoi in UltraSPARC III Assembly Language (1)

Towers of Hanoi for UltraSPARC III.

. . .

Page 76: The Instruction Set Architecture Level Chapter 5.

Towers of Hanoi in UltraSPARC III Assembly Language (2)

Towers of Hanoi for UltraSPARC III.

. . .

. . .

Page 77: The Instruction Set Architecture Level Chapter 5.

Towers of Hanoi in UltraSPARC III Assembly Language (3)

Towers of Hanoi for UltraSPARC III.

. . .

Page 78: The Instruction Set Architecture Level Chapter 5.

Reducing Memory References

The Itanium 2’s registers.

Page 79: The Instruction Set Architecture Level Chapter 5.

Instruction Scheduling

An IA-64 bundle contains three instructions.

Page 80: The Instruction Set Architecture Level Chapter 5.

Reducing Conditional Branches: Predication (1)

(a) An if statement.

(b) Generic assembly code for a).

(c) A conditional instruction.

Page 81: The Instruction Set Architecture Level Chapter 5.

Reducing Conditional Branches: Predication (2)

(a) An if statement.

(b) Generic assembly code for a).

(c) Conditional instruction.

Page 82: The Instruction Set Architecture Level Chapter 5.

Reducing Conditional Branches: Predication (3)

(a) An if statement.

(b) Generic assembly code for a).

(c) Predicated instruction.