Chapter 12 (Instruction Sets Characteristics and Functions)
Chapter 12 (Instruction Sets Characteristics and Functions)
William Stallings
Computer Organization
and Architecture
10th Edition
© 2016 Pearson Education, Inc.,
Hoboken, NJ. All rights reserved.
2
Chapter 12
Instruction Sets: Characteristics and
Functions
+
3
Elements of an Instruction
1. Operation code (Op code):
– Specifies the operation to be performed
– Do this
• Source Operand reference:
– one or more source operands, that is, operands that are inputs for the operation.
– To this
1. Result Operand reference
– The operation may produce a result
– Put the answer here
2. Next Instruction Reference
– tells the processor where to fetch the next instruction after the execution of this instruction is complete.
– When you have done that instruction, do this...
4
Instruction Cycle State Diagram
5
Instruction Representation
• In machine code each instruction has a unique bit pattern
• For human consumption (well, programmers anyway) a symbolic representation is
used
– e.g. ADD, SUB, LOAD
• Operands can also be represented in this way
– ADD A,B
6
Source and result operands can be in one of four areas:
2) I/O device
– The instruction must specify the
I/O module and device for the 4) Immediate
operation. If memory-mapped
I/O is used, this is just another – The value of the operand is
main or virtual memory address contained in a field in the
instruction being executed
7
Simple Instruction Format
8
Instruction Types
• Data processing:
– Arithmetic and logic instructions.
• Data storage (main memory)
– Movement of data into or out of register and or memory locations .
• Data movement (I/O):
– I/O instructions.
• Program flow control
• -Test and branch instructions
9
Number of Addresses (a)
• 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
10
Number of Addresses (b)
• 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
11
Number of Addresses (c)
• 1 address
– Implicit second address
– Usually a register (accumulator)
– Common on early machines
12
Number of Addresses (d)
• 0 (zero) addresses
– All addresses implicit
– Uses a stack
– e.g. push a
– push b
– add
– pop c
– c=a+b
13
Number of Addresses
14
Design Decisions (1)
• Operation repertoire
– How many ops?
– What can they do?
– How complex are they?
• Data types
• Instruction formats
– Instruction length
– Length of op code field
– Number of addresses
15
Design Decisions (2)
• Registers
– Number of CPU registers available
– Which operations can be performed on which registers?
• Addressing modes (later…)
– The mode or modes by which the address of an operand is specified.
16
Types of Operand
• Machine instructions operate on data. The most important general categories of data
are:
• Addresses
• Numbers
– Binary Integer/floating point
• Characters
• ASCII: Each character in this code is represented by a unique 7-bit pattern.
• Logical Data
– Dealing with bit level
17
Question 1
18