0% found this document useful (0 votes)
55 views

CH12 Instruction Sets Characteristics and Functions

This document discusses machine instruction characteristics and types. It covers the following key points in 3 sentences: Machine instructions contain operation codes that specify operations, and references to source and result operands. Common instruction types include data transfer instructions, arithmetic instructions, logical instructions, and I/O instructions. The document also examines instruction formats, addressing modes, types of operands like numbers and characters, and categories of operations like arithmetic, logical, shift/rotate, and conversion operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

CH12 Instruction Sets Characteristics and Functions

This document discusses machine instruction characteristics and types. It covers the following key points in 3 sentences: Machine instructions contain operation codes that specify operations, and references to source and result operands. Common instruction types include data transfer instructions, arithmetic instructions, logical instructions, and I/O instructions. The document also examines instruction formats, addressing modes, types of operands like numbers and characters, and categories of operations like arithmetic, logical, shift/rotate, and conversion operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

+

William Stallings
Computer Organization
and Architecture
9th Edition
Chapter 12
+

Instruction Sets:
Characteristics and Functions
+
Machine Instruction Characteristics

 The operation of the processor is determined by the instructions it


executes, referred to as machine instructions or computer instructions

 The collection of different instructions that the processor can execute


is referred to as the processor’s instruction set

 Each instruction must contain the information required by the


processor for execution
Elements of a Machine Instruction

Operation code Source operand


(opcode) reference
• Specifies the operation to • The operation may
be performed. The involve one or more
operation is specified by source operands, that is,
a binary code, known as operands that are inputs
the operation code, or for the operation
opcode

Result operand Next instruction


reference reference
• The operation may • This tells the processor
produce a result where to fetch the next
instruction after the
execution of this
instruction is complete
Instruction Cycle State Diagram
Source and result operands can be in
one of four areas:
3) Processor register
 A processor contains one or more
1) Main or virtual memory registers that may be referenced
 As with next instruction by machine instructions.
references, the main or virtual
memory address must be supplied
 If more than one register exists
each register is assigned a unique
name or number and the
instruction must contain the
number of the desired register
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 main or
 The value of the operand is
virtual memory address contained in a field in the
instruction being executed
+
Instruction Representation
 Within the computer each instruction is represented by a sequence of
bits

 The instruction is divided into fields, corresponding to the constituent


elements of the instruction
Instruction Types
• Arithmetic instructions provide computational capabilities • Movement of data into or out
for processing numeric data of register and or memory
• Logic (Boolean) instructions operate on the bits of a word locations
as bits rather than as numbers, thus they provide capabilities
for processing any other type of data the user may wish to
employ

Data
Data storage
processing

Data
Control
movement

• Test instructions are used to test the value of a data word or the • I/O instructions are needed to
status of a computation transfer programs and data into
• Branch instructions are used to branch to a different set of memory and the results of
instructions depending on the decision made computations back out to the
user
+
Number of Addresses
+
Table 12.1  
Utilization of Instruction Addresses
(Nonbranching Instructions)
Instruction Set Design
Very complex because it affects so many aspects of the computer system

Defines many of the functions performed by the processor

Programmer’s means of controlling the processor

Fundamental design issues:

Operation repertoire Data types Instruction format Registers Addressing


• How many and which • The various types of data upon • Instruction length in bits, • Number of processor registers • The mode or modes by which
operations to provide and how which operations are performed number of addresses, size of that can be referenced by the address of an operand is
complex operations should be various fields, etc. instructions and their use specified
Types of Operands

e sses
Ad d r
Num
be rs

Chara
cters
a l Da t a
Lo gi c
+
Numbers

 All machine languages include numeric data types

 Numbers stored in a computer are limited:


 Limit to the magnitude of numbers representable on a machine
 In the case of floating-point numbers, a limit to their precision

 Three types of numerical data are common in computers:


 Binary integer or binary fixed point
 Binary floating point
 Decimal

 Packed decimal
 Each decimal digit is represented by a 4-bit code with two digits stored per
byte
 To form numbers 4-bit codes are strung together, usually in multiples of 8 bits
+
Characters

 A common form of data is text or character strings

 Textual data in character form cannot be easily stored or transmitted


by data processing and communications systems because they are
designed for binary data

 Most commonly used character code is the International Reference


Alphabet (IRA)
 Referred to in the United States as the American Standard Code for
Information Interchange (ASCII)

 Another code used to encode characters is the Extended Binary


Coded Decimal Interchange Code (EBCDIC)
 EBCDIC is used on IBM mainframes
+
Logical Data

 An n-bit unit consisting of n 1-bit items of data, each item having the
value 0 or 1

 Two advantages to bit-oriented view:


 Memory can be used most efficiently for storing an array of Boolean or
binary data items in which each item can take on only the values 1 (true)
and 0 (false)
 To manipulate the bits of a data item
 If floating-point operations are implemented in software, we need to be
able to shift significant bits in some operations
 To convert from IRA to packed decimal, we need to extract the
rightmost 4 bits of each byte
+
12.4 TYPES OF
OPERATIONS

Table 12.3  

Common
Instruction Set
Operations

(page 1 of 2)
+
Table 12.3  

Common
Instruction Set
Operations

(page 2 of 2)
Table 12.4  
Processor Actions for Various Types of Operations
Data Transfer

Must specify:
• Location of the source and destination
operands
Most fundamental type of • The length of data to be transferred
machine instruction must be indicated
• The mode of addressing for each
operand must be specified
Table 12.5  
Examples of IBM EAS/390 Data Transfer Operations
+
 Most machines provide the basic arithmetic operations
of add, subtract, multiply, and divide
 These are provided for signed integer (fixed-point)
numbers
 Often they are also provided for floating-point and
packed decimal numbers
 Other possible operations include a variety of single-
operand instructions:
Arithmetic
 Absolute
 Take the absolute value of the operand
 Negate
 Negate the operand
 Increment
 Add 1 to the operand
Decrement
 Subtract 1 from the operand
Logical

Table 12.6  Basic Logical Operations


+

Shift and Rotate


Operations
+
Table 12.7
Examples of Shift and Rotate
Operations
Instructions that
change the format
or operate on the
format of data Conversion

An example of a
An example is more complex
converting editing instruction
from decimal is the EAS/390
to binary Translate (TR)
instruction
+
Input/Output

 Variety of approaches taken:


 Isolated programmed I/O
 Memory-mapped programmed I/O
 DMA
 Use of an I/O processor

 Many implementations provide only a few I/O instructions, with the


specific actions specified by parameters, codes, or command words
System Control

Instructions that 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

Typically these instructions are reserved for the use of the operating system

Examples of system control operations:

A system control instruction Access to process control


An instruction to read or modify
may read or alter a control blocks in a multiprogramming
a storage protection key
register system
+
Transfer of Control

 Reasons why transfer-of-control operations are required:


 It is essential to be able to execute each instruction more than once
 Virtually all programs involve some decision making
 It helps if there are mechanisms for breaking the task up into smaller
pieces that can be worked on one at a time

 Most common transfer-of-control operations found in instruction sets:


 Branch
 Skip
 Procedure call
+

Branch
Instruction
Skip Instructions

Typically implies that one


instruction be skipped, thus
the implied address equals
Includes an implied address
the address of the next
instruction plus one
instruction length

Because the skip instruction


Example is the increment-
does not require a destination
and-skip-if-zero (ISZ)
address field it is free to do
instruction
other things
+
Procedure Call Instructions

 Self-contained computer program that is incorporated into a larger


program
 At any point in the program the procedure may be invoked, or called
 Processor is instructed to go and execute the entire procedure and then return
to the point from which the call took place

 Two principal reasons for use of procedures:


 Economy
 A procedure allows the same piece of code to be used many times
 Modularity

 Involves two basic instructions:


 A call instruction that branches from the present location to the procedure
 Return instruction that returns from the procedure to the place from which it
was called
+
Nested
Procedures
Use of Stack to Implement Nested
Procedures
+ Summary Instruction Sets:
Characteristics and
Functions
Chapter 12
 Intel x86 and ARM data types
 Machine instruction characteristics  Types of operations
 Elements of a machine instruction  Data transfer
 Instruction representation
 Arithmetic
 Instruction types
 Logical
 Number of addresses
 Conversion
 Instruction set design
 Input/output
 Types of operands
 Numbers
 System control
 Characters
 Transfer of control
 Logical data  Intel x86 and ARM operation types
+ Key terms Chapter 12

 accumulator  procedure return


 address  branch
 arithmetic shift  jump
 conditional branch  rotate
 instruction set  skip
 machine instruction  stack
 operand  pop
 operation  push
 packed decimal
 procedure call
+ Homework Instruction Sets:
Characteristics and
Functions
Chapter 12

 12.1
 12.2
 12.3
 12.6
 12.8

You might also like