Docsity

Instruction Set Architecture: Understanding the Interface between Hardware and Software - , Study notes of Computer Science

Toggle sidebar
bg1
1
Page1
Chapter2
InstructionSetPrincipleand
Examples
InstructionSetArchitecture
•Instructionsetarchitectureistheinterface ofa
computerthatamachinelanguageprogrammer,
anoperatingsystemdesigner,oracompiler
writermustunderstandtowriteacorrect
machineprogram,anoperatingsystem,a
compiler,respectivelyforthatmachine.
•Theinstructionsetarchitectureisalsothe
interface thatahardwaredesignermust
understandtodesignacorrectimplementation
ofthecomputer.
TowardsEvaluationofISAand
Organization


instructionset
software
hardware
InterfaceDesign
Agoodinterface:
•Laststhroughmanyimplementations(portability,compatibility)
•Isusedinmanydifferentways(generality)
•Providesconvenient functionalitytohigherlevels
•Permitsanefficient implementationatlowerlevels
Interface imp1
imp2
imp3
use
use
use
time
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Instruction Set Architecture: Understanding the Interface between Hardware and Software - and more Study notes Computer Science in PDF only on Docsity!

Page 1

Chapter 2

Instruction Set Principle and Examples

Instruction Set Architecture

  • Instruction set architecture is the interface of a computer that a machine language programmer, an operating system designer, or a compiler writer must understand to write a correct machine program, an operating system, a compiler, respectively for that machine.
  • The instruction set architecture is also the interface that a hardware designer must understand to design a correct implementation of the computer.

Towards Evaluation of ISA and Organization

instruction set

software

hardware

Interface Design

A good interface:

  • Lasts through many implementations (portability, compatibility)
  • Is used in many different ways (generality)
  • Provides convenient functionality to higher levels
  • Permits an efficient implementation at lower levels

Interface imp 1 imp 2 imp 3

use use use

time

Page 2

Machine Instruction

  • Carries out a step of processing
  • Must specify:
    • Function - OPCODE
    • Input Operand(s)
    • What to do with results
    • What to do next?

OPCODE Operand 1 Operand 2 Result Next?

Four Address Instruction

Assume availability of linear address space

Evolution of Instruction Sets Single Accumulator (EDSAC 1950) Accumulator + Index Registers (Manchester Mark I, IBM 700 series 1953)

Separation of Programming Modelfrom Implementation

High-level Language Based Concept of a Family (B5000 1963) (IBM 360 1964) General Purpose Register Machines Complex Instruction Sets Load/Store Architecture

RISC

(Vax, Intel 432 1977-80) (CDC 6600, Cray 1 1963-76)

(Mips,Sparc,88000,IBM RS6000,.. .1987)

Evolution of Instruction Sets

  • Major advances in computer architecture are typically associated with landmark instruction set designs - Ex: Stack vs. GPR (System 360)
  • Design decisions must take into account:
    • technology
    • machine organization
    • programming languages
    • compiler technology
    • operating systems
    • And they in turn influence these

Classifying Instruction Set Architecture

Stack Accumulator Register

Operations

Number : (0,1,2,3) Type, Size : byte, int, float Location : memory or register (effective address)

Internal Storage

Operands

Type : add, sub, mul, … How is it specified?

Page 4

Characterizing GPR architectures (ALU instructions)

No. of Mem Addresses Max NO of Ops Examples per ALU Instruction allowed 0 2 IBM RT 3 SPARC, MIPS, PowerPC, Alpha 1 2 PDP-10, M 68000, IBM 360 3 IBM 360 (RS Inst) 2 2 PDP 11, National 32x32, IBM 360 (SS Inst) 3 3 VAX

General Purpose Register Arch.

Register-Register (0,3)

  • Advantages
    • Simple, Fixed Length Instruction Encoding
    • Simple Code Generation Model
    • Similar CPI values
  • Disadvantages
    • Higher Instruction Count
    • Bit Encoding may be wasteful

Register-Memory (1,2)

  • Advantages
    • No loading first required
    • Easy to encode with good density
  • Disadvantages
    • Source operand is destroyed
    • CPI Varies
    • Encoding a register No. in each inst - limit Reg No.

General Purpose Register Arch. General Purpose Register Arch.

Memory-Memory (3,3)

  • Advantages
    • Most compact
    • does not waste registers for temp info
  • Disadvantages
    • Large variation in instruction size
    • Large variation in work per instruction
    • Memory access may create memory bottleneck

Page 5

Memory Addressing

  • Ordering of bytes within a word
  • Alignment
  • Addressing modes

Byte Ordering: Big/Little Endian

0 1 2 3 (^31) Big Endian 0

0 1 2 3 ff 08 47 35

byte whose address is “x…x00” at

Big endian: most-significant position IBM mainframes, MIPS, 680x0, SPARC

Little endian: least-significant position Vax, Intel 80x 3 2 1 0 (^31) Little Endian^0

Alignment

32

32

32

Mis-aligned word reference

To Processor

Access to an object of size s bytes at byte address A is aligned if A mod s = 0

Addressing modes Addressing mode : how architectures specify the (address of an) object that they will access

Effective address: actual memory address specified

Page 7

Displacement Values (^) Immediate or Literal Addressing Modes

  • Used
    • in arithmetic operations
    • in comparisons (primarily for branches)
    • in moves where a constant is needed in a register » Constant written in code (Small) » address constants (Large)
  • Range of Value for Immediates
    • Again, directly influence instruction length
  • Again, may have to depend on measurements taken from typical programs

Displacement of Immediate Values (^) Summary: Memory Addressing

  • Expect an architecture to support
    • displacement
    • immediate
    • register deferred These modes represent 75% to 99% of modes used for some typical programs
  • Displacement mode to be 12 to 16 bits
  • Immediate field to be 8 to 16 bits

Page 8

Classifying Instruction Set Architecture

Stack Accumulator Register

Operations

Number : (0,1,2,3) Type, Size : byte, int, float Location : memory or register (effective address)

Internal Storage

Operands

Type : add, sub, mul, … How is it specified?

Operations in the Instruction Set

  • Instruction Categories
  • Top 10 Instructions

Instruction Categories Top 10 Instructions

Page 10

Destination Address Unknown

  • Procedure returns or indirect jumps
    • Need to specify target dynamically
  • May use any addressing mode for destination address
  • Use a register as address
    • Useful for » Case or Switch statements » Dynamically Shared Libraries - Loaded at run time as needed » Virtual Functions - Allow different routines to be called depending on data type

Procedure Call and Returns

Include control transfer and some state saving

  • At a minimum return address has to be saved
  • May also save registers » Through hardware action » Through software instructions
  • Two conventions for saving registers » Caller Saving - Calling procedure must save the registers » Callee Saving - Called program must save the registers it wants to used
  • Use depends on the program - Compilers use a combination