Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: –...

22
Instruction Sets: Characteristics and Functions Chapter 10 Introduction to Computer Architecture and Organization Lesson 15 – Slide 1/22

Transcript of Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: –...

Page 1: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Instruction Sets:Characteristicsand Functions

Chapter 10

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 1/22

Page 2: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Machine instruction set

• Computer designer: The machine instruction set provides the functional requirements for the CPU.

• Computer programmer: The user who chooses to program in machine language becomes aware of the register and memory structure, the types of data directly supported by the machine, and the functioning of the ALU.

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 2/22

Page 3: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

What is an instruction set?

• The complete collection of instructions that are understood by a CPU

• Machine Code• Binary• Usually represented by assembly codes

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 3/22

Page 4: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Elements of an Instruction

• Operation code (Op code)– Do this

• Source Operand reference– To this

• Result Operand reference– Put the answer here

• Next Instruction Reference– When you have done that, do this...

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 4/22

Page 5: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Instruction Cycle State Diagram

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 5/22

Page 6: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 6/22

Where have all the Operands gone?

• Main or virtual memory• CPU register• I/O device

Page 7: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 7/22

Instruction Representation• In machine code each instruction has a unique

bit pattern• For human consumption (well, programmers

anyway) a symbolic representation is used. Opcodes are represented by abbreviations called mnemonics– e.g. ADD, SUB, LOAD, STOR, DIV, MPY

• Operands can also be represented in this way– ADD A,B

Page 8: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 8/22

Simple Instruction Format

Page 9: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Instruction Types

• X = X + Y (X = 513, Y = 514)– Register <= $513 from memory– Register <= register + $514 from memory– $513 of memory <= register

• Data processing: arithmetic and logic• Data storage: memory• Data movement: I/O• Control: test and branch

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 9/22

Page 10: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

• 3 addresses– Operand 1, Operand 2, Result– a = b + c;– May be a forth - next instruction (usually

implicit)– Not common– Needs very long words to hold everything

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 10/22

Number of Addresses (1)

Page 11: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Number of Addresses (2)

• 2 addresses– One address doubles as operand and result– a = a + b– Reduces length of instruction– Requires some extra work

• Temporary storage to hold some results

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 11/22

Page 12: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 12/22

Number of Addresses (c)

• 1 address– Implicit second address– Usually a register (accumulator)– Common on early machines

Page 13: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 13/22

Number of Addresses (d)

• 0 (zero) addresses– All addresses implicit– Uses a stack

Page 14: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Number of Addresses (e)

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 14/22

Page 15: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

How Many Addresses

• More addresses– More complex (powerful?) instructions– More registers

• Inter-register operations are quicker

– Fewer instructions per program

• Fewer addresses– Less complex (powerful?) instructions– More instructions per program– Faster fetch/execution of instructions

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 15/22

Page 16: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Design Decisions (1)• Operation repertoire

– How many ops?– What can they do?– How complex are they?

• Data types• Instruction formats

– Length of op code field– Number of addresses

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 16/22

Page 17: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Design Decisions (2)

• Registers– Number of CPU registers available– Which operations can be performed on which

registers?

• Addressing modes

• RISC v CISC

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 17/22

Page 18: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Types of Operand

• Addresses• Numbers

– Integer or fixed point / floating point / decimal

• Characters– ASCII

• Logical Data– Bits or flags

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 18/22

Page 19: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Pentium Data Types

• 8 bit Byte• 16 bit word => odd-numbered addresses• 32 bit double word• 64 bit quad word• Addressing is by 8 bit unit• A 32 bit double word is read at addresses

divisible by 4

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 19/22

Page 20: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Specific Data Types• General - arbitrary binary contents• Integer - single binary value• Ordinal - unsigned integer• Unpacked BCD - One digit per byte• Packed BCD - 2 BCD digits per byte• Near Pointer - 32 bit offset within segment• Bit field• Byte String• Floating Point

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 20/22

Page 21: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

Pentium numeric

data formats

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 21/22

Page 22: Instruction Sets: Characteristics and Functions · • Fixed point processor recognises: – Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned

PowerPC Data Types• 8 (byte), 16 (halfword), 32 (word) and 64 (doubleword)

length data types• Some instructions need operand aligned on 32 bit

boundary• Can be big- or little-endian• Fixed point processor recognises:

– Unsigned byte, unsigned halfword, signed halfword, unsigned word, signed word, unsigned doubleword, byte string (<128 bytes)

• Floating point– IEEE 754– Single or double precision

Introduction to Computer Architecture and OrganizationLesson 15 – Slide 22/22