chapter 10 instruction sets

41
Chapter 10 Instruction Sets 10.1 Instruction Characteristics 10.2 Types of Operands 10.3 Data Types 10.4 Operators

Upload: louie

Post on 22-Feb-2016

50 views

Category:

Documents


0 download

DESCRIPTION

Chapter 10 Instruction Sets. 10.1 Instruction Characteristics 10.2 Types of Operands 10.3 Data Types 10.4 Operators. 10.1 Machine Instruction Characteristics. Machine Instruction Characteristics. Machine Instructions- are instructions executed by the processor. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 10 Instruction Sets

Chapter 10Instruction Sets

10.1 Instruction Characteristics

10.2 Types of Operands

10.3 Data Types

10.4 Operators

Page 2: Chapter 10 Instruction Sets

10.1MACHINE INSTRUCTION

CHARACTERISTICS

Page 3: Chapter 10 Instruction Sets

Machine Instruction Characteristics

Machine Instructions- are instructions executed by the processor.

Instruction set- a collection of instructions that the processor can execute

Page 4: Chapter 10 Instruction Sets

Elements of a machine instruction

Opcode- uses a binary code which specifies the operation to be preformed.

Source operand reference- the input for the operation

Result operand reference- the result produced by the operation

Next instruction reference- tells the processor where to get the next instruction

Page 5: Chapter 10 Instruction Sets

Source and result operands can be found in

Main or virtual memory Processor register- contains registers that

can be used by machine instructions Immediate- the operand value is being

contained when the instruction is being executed

I/O devices- instruction specifies I/O module and device but if memory mapped then just another main or virtual memory address

Page 6: Chapter 10 Instruction Sets

Instruction Representation Are represented by a sequence of bits It is common to use “symbolic

representation” of machine instructions Op codes and operands are represented

by abbreviations called “mnemonics”

Page 7: Chapter 10 Instruction Sets

Mnemonics ADD add SUB subtract MUL multiply DIV divide LOAD load data from memory STOR store data to memory

Page 8: Chapter 10 Instruction Sets

Instruction types Data processing- arithmetic and logic

instructions Data storage- moving data into or out of

register or memory locations Data movement- I/O instructions Control- test and branch instructions

Page 9: Chapter 10 Instruction Sets

Number of Addresses• A traditional way of describing processor

architecture• What is the maximum number of

addresses one might need in an instruction?

• An instruction could be required to contain four addresses

Page 10: Chapter 10 Instruction Sets

Number of Addresses• 3 addresses

instructions• 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

Page 11: Chapter 10 Instruction Sets

Number of Addresses• 2 addresses

instructions• One address

doubles as operand and result

• a = a + b;• Reduces length of

instruction• Requires some extra

work• Temporary storage to

hold some results

Page 12: Chapter 10 Instruction Sets

Number of Addresses• 1 address

instructions• Implicit second

address• Usually a register

(accumulator)• Common on early

machines

Page 13: Chapter 10 Instruction Sets

Number of Addresses• 0 address instruction:

• Special memory organization

• Last in first out

• Stack is a known location

Page 14: Chapter 10 Instruction Sets

Number of AddressesUtilization of Instruction Addresses

(Nonbranching Instructions)

Page 15: Chapter 10 Instruction Sets

Number of Addresses1 ADDRESS INSTRUCTIONS 2 OR 3 ADDRESS

INSTRUCTIONS• One general purpose

register Multiple general

purpose registers

Page 16: Chapter 10 Instruction Sets

Instruction Set Design Operation Repertoire- How many and

which operations to provide, and how complex the operations should be.

Data Types- The various types of data upon which operations are performed.

Instruction Format- Instruction length (in bits), number of addresses and size of fields.

Page 17: Chapter 10 Instruction Sets

Instruction Set Design Registers- Number of processor registers

that can be referenced by instructions, and their use

Addressing- The mode or modes by which the address of an operand is specified.

Page 18: Chapter 10 Instruction Sets

10.2TYPES OF OPERANDS

Page 19: Chapter 10 Instruction Sets

TYPES OF OPERANDS Addresses Numbers Characters Logical Data Specialized Data Types Data Structures

Page 20: Chapter 10 Instruction Sets

Addresses Main or Virtual memory address Unsigned Integers

Page 21: Chapter 10 Instruction Sets

Numbers All machine languages include numeric

types Non-numeric processing: counters, field

widths, etc Numbers in a machine are limited by

magnitude and precision Consequences: rounding, overflow,

underflow

Page 22: Chapter 10 Instruction Sets

Numerical Data Binary integer or Binary fixed point Binary floating point Decimal

Page 23: Chapter 10 Instruction Sets

Decimal Majority of users deal with decimals Necessity to convert from decimal to

binary on input and binary to decimal on output

Packed decimal

Page 24: Chapter 10 Instruction Sets

Packed Decimal Used when there is a great deal of I/O

and simple computation Each decimal digit is represented by a 4-

bit code. Ex: 0 = 0000, 1 = 0001 Numbers are formed by a string of 4-bit

codes usually in multiples of 8-bit 246 = 0000 0010 0100 0110 Positive: 1100 Negative: 1101

Page 25: Chapter 10 Instruction Sets

Characters Text or character strings Represented by a sequence of bits Morse Code International Reference Alphabet (IRA) American Standard Code for Information

Interchange (ASCII) Extended Binary Coded Decimal

Interchange Code (EBCDIC)

Page 26: Chapter 10 Instruction Sets

Logical Data Consider n-bit unit as consisting of n 1-bit

items of data, each having a value of 0 or 1

Advantages: Store array of Boolean or Binary data items Manipulating bits of data items

Page 27: Chapter 10 Instruction Sets

10.3DATA TYPES

Page 28: Chapter 10 Instruction Sets

Intel x86 and ARM data types

are instruction set architecture.

change code into instructions a processor can understand and execute.

determines which operating systems and apps to run.

 

Page 29: Chapter 10 Instruction Sets

x86 data types The x86 can deal with data types of 8 (byte), 16

(word), 32 (doubleword), 64 (quadword),and 128 (double quadword) bits in length.

are referred to as general data types.

To allow maximum flexibility in data structures and efficient memory utilization, words do not need be aligned at even numbered addresses and doublewords do not need to aligned at addresses evenly divisible by 4.

x86 also supports specific data types that are recognized and operated on by particular instructions.

Page 30: Chapter 10 Instruction Sets
Page 31: Chapter 10 Instruction Sets

ARM data types support data types of 8 (byte), 16 (halfword),

and 32 (word) bits in length.

ARM processor do not provide floating point hardware, which saves power and area.

If required it must be implement in software.

Can be configure to be little Endian or big Endian mode.

Page 32: Chapter 10 Instruction Sets

10.4OPERATORS

Page 33: Chapter 10 Instruction Sets

Types of Operations Data Transfer Arithmetic Logical Conversion Input/output System Control Transfer of Control

Page 34: Chapter 10 Instruction Sets

Data TransferOPERATION NAME DESCRIPTION Move(Transfer) Store Load (Fetch) Exchange Clear ( Reset) Set Push Pop

Transfer word from source to destination

From processor to memory From memory to processor Swap contents of source and

destination Transfer 0s to destination Transfer 1s to destination Word from source to top of

stack From top of stack to

destination

Page 35: Chapter 10 Instruction Sets

Arithmetic

OPERATION NAME DESCRIPTION Add Subtract Multiply Divide Absolute Negate Increment Decrement

Compute sum of two operands

Difference of two operands

Product of two operands Quotient of two operands Replace by its absolute

value Change sign Add 1 to operand Subtract 1 to operand

Page 36: Chapter 10 Instruction Sets

LogicalOPERATION NAME DESCRIPTION AND; OR; NOT; OR Test Compare Set Control Variables Shift Variables

Perform the specified logical operation bitwise

Test specified condition; set flags based on outcome

Make logical and arithmetic comparison of two operands

Class of instructions to set controls for protection purposes, interrupt handling, timer control.

Left/right operand introducing constants at end.

Left/right with wraparound end

Page 37: Chapter 10 Instruction Sets

Conversion

OPERATION NAME DESCRIPTION Translate Convert

Translate values in a section of memory based on a table of correspondences

Convert the contents of a word from one form to another. E.g(packed decimal to binary

Page 38: Chapter 10 Instruction Sets

I/OOPERATION NAME DESCRIPTION Input (Read) Output ( Write) Start I/O End I/O

Transfer data from specified I/O port or device to destination

From specified source to I/O port or device

Transfer instructions to I/O processor to initiate I/O operation

Transfer status info from I/O system to specified destination

Page 39: Chapter 10 Instruction Sets

System Of Control Can be executed only while the processor is in a

certain privileged state or is executing a program in a special privileged area of memory.

These instructions, are reserved for the use of the operating system.

Examples: A system control instruction may read or alter a

control register An instruction to read or modify a storage

protection key Access to process control blocks in

multiprogramming system

Page 40: Chapter 10 Instruction Sets

Transfer Of Control

OPERATION NAME DESCRIPTION Jump (Branch) Jump Conditional Jump to Subroutine Return Execute Skip Skip conditional Halt Wait (Hold) No Operation

Unconditional Transfer: load PC with specified address

Test condition: either load PC with specified address or do nothing

Place current program control info in known location; jump to specified address

Replace contents of PC and other register from known location

Fetch operand from location and execute as instructed

Increment PC to skip next instruction Either skip or do nothing based on

condition Stop program execution Test specified repeatedly and resume

condition No operation is performed; but program

execution is continued.

Page 41: Chapter 10 Instruction Sets

QUESTIONS How many different address designs are

there? Name two types of operations. What are the most general categories of

data? What type of endian mode does x86 use? What are the most used Character Codes

nowadays? What are the elements of machine

instruction? What are the advantages of Logical Data?