100% found this document useful (1 vote)
226 views

Chapter 12 - Instruction Set and Functions

The document discusses machine instruction sets and their characteristics. It covers the structure of machine instructions, including operation codes, operands, and addressing modes. Common types of operands are numbers, characters, logical data, and packed decimal. Instruction sets also typically include common operations like data transfer, arithmetic, logical, conversion, I/O, system control, and transfer of control.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
226 views

Chapter 12 - Instruction Set and Functions

The document discusses machine instruction sets and their characteristics. It covers the structure of machine instructions, including operation codes, operands, and addressing modes. Common types of operands are numbers, characters, logical data, and packed decimal. Instruction sets also typically include common operations like data transfer, arithmetic, logical, conversion, I/O, system control, and transfer of control.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

+

Instruction Sets:
Chapter 12
Characteristics and Functions

William Stallings, Computer Organization and Architecture, 9th Edition


2
+
Objectives
 Questions:
 What is the structure of a machine
instruction?
 What can computers do?

 After
studying this chapter, you should
be able to:
 Present an overview of essential
characteristics of machine instructions.
 Describe the types of operands used in
typical machine instruction sets.
3
+
Contents

 12.1 Machine Instruction Characteristics


 12.2 Types of Operands
 12.4 Types of Operations
+ 12.1- Machine Instruction 4

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
 Instruction’s semantic is works which are performed by
hardware.
Elements of a Machine Instruction 5

ADD, Operation code Source operand


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

Result Next instruction


operand reference
reference • This tells the processor
where to fetch the
• The operation may next instruction after
produce a result the execution of this
instruction is complete
6

Instruction Cycle State Diagram


Source and result operands can 7

be in one of four areas:


3) Processor register
Opcode Operand1 Operand2 Operand3  A processor contains one or
more registers that may be
referenced by machine
1) Main or virtual memory instructions.
 As with next instruction references,  If more than one register
the main or virtual memory address exists each register is
must be supplied assigned a unique name or
number and the instruction
2) I/O device must contain the number of
 The instruction must specify the the desired register
I/O module and device for the
operation. If memory-mapped 4) Immediate
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
8
+
Instruction Representation

 Withinthe 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
9

• Movement of
• Arithmetic instructions data into or out of
for processing numeric register and or
data memory locations
• Logic instructions
operate on the bits of a
word capabilities for
processing any other data
type
Data Data
processing storage

Data
Control
• Test the value of a data movement
word or the status of a • I/O instructions
computation are needed to
• Branching to a different transfer programs
set of instructions and data into
depending on the memory and the
decision made results of
computations back
out to the user
+ Number of Addresses 10
Table 12.1
11
+
Utilization of Instruction Addresses
(Nonbranching Instructions)

3
5
2
1
Instruction Set Design 12

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 Data types Instruction Registers Addressing
repertoire • The various format • Number of • The mode or
• How many and types of data processor modes by
upon which • Instruction registers that
which operations length in bits, which the
to provide and operations are can be address of an
how complex performed number of referenced by
addresses, size operand is
operations should instructions and specified
be of various their use
Repertoire: items fields, etc.
13
12.2- Types of Operands

They
may
be
14
+
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
10 digits  4 bits /digit
 Binary floating point
 Decimal 1 byte/2 digits
’37’  0011 0111
 Packed decimal (số thập phân nén)
 Each decimal digit is represented by a 4-bit code with two digits
stored per byte
15
+
Characters
A common form of data is text or character strings

 Textualdata in character form cannot be easily stored


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

 Mostcommonly 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 is used on IBM mainframes
16
+
How to create a packed number:
“69”: Packed 69:
0011 0110 0011 1001 0110 1001
+ Logical Data 17

 An n-bit unit (byte, half word, …) 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 18

Useful and typical categorization:

 Data transfer

 Arithmetic

 Logical

 Conversion

 I/O

 System control

 Transfer of control
+Table 12.3 Common Instruction Set Operations (page 1 of 3)
Table 12.3
Common Instruction
+ Set Operations
(page 2 of 3)
Table 12.3
Common Instruction
+ Set Operations
(page 3 of 3)
Table 12.4 22
Processor Actions for Various Types of Operations
Data Transfer 23

Must specify:
Most • Location of the source and
destination operands
fundamental type • The length of data to be
of machine transferred must be
indicated
instruction • The mode of addressing
for each operand must be
specified
Table 12.5 : Examples of IBM EAS/390 Data Transfer Operations
24
Most machines provide the basic arithmetic 25
+

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:
 Absolute Arithmetic
 Take the absolute value of the operand
 Negate
 Negate the operand
 Increment
 Add 1 to the operand
Decrement
 Subtract 1 from the operand
Logical 26

(R1) = 1010 0101


(R2) = 1111 1111
then (R1) XOR (R2) = 0101 1010
+

Shift and
Rotate
Operations
Figure 12.6-
Shift and Rotate
Operations
Table 12.7 28

Examples of Shift and Rotate Operations

+
29

Instructions
that change
the format or
operate on
Conversion
the format of
data

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

 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
31
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 An instruction to Access to process


instruction may read or modify a control blocks in a
read or alter a storage protection multiprogramming
control register key system
32
+
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
BRP X : Branch to location X if result is positive.
Branch
+ Instruction
BRN X : Branch to location X if result is negative.
BRZ X : Branch to location X if result is zero.
BRO X : Branch to location X if overflow occurs.
BRE R1, R2, X : Branch to X if value of R1 = value of R2.
Skip Instructions 34

Typically implies that one


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

Because the skip Example is the


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

 Self-contained
codes 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: 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 37

Implement
Nested
Procedures
Stack Frame Growth 38
Using Sample Procedures P and Q
Stack frame:
Data can be
stacked just
before a
procedure is
called: (1)
return address,
(2) parameters
(3) Caller stack
frame

Procedure P has local


variables x1, x2,
procedure Q has 2 local
variables y1, y2.
+E 12.1 What are the typical elements of a machine instruction?
39

x 12.2 What types of locations can hold source and destination operands?

12.3 If an instruction contains four addresses, what might be the purpose of each
e address?

12.4 List and briefly explain five important instruction set design issues.
r 12.5 What types of operands are typical in machine instruction sets?

c 12.6 What is the relationship between the IRA character code and the packed
decimal representation?

i 12.7 What is the difference between an arithmetic shift and a logical shift?

s 12.8 Why are transfer of control instructions needed?

12.9 List and briefly explain two common ways of generating the condition to be
e tested in a conditional branch instruction.

12.10 What is meant by the term nesting of procedures?


s 12.11 List three possible places for storing the return address for a procedure return.
Summary
40
+ Instruction Sets:
Characteristics and
Functions
Chapter 12
 Intel x86 and ARM data types
 Machine instruction
 Types of operations
characteristics
 Data transfer
 Elements of a machine
instruction  Arithmetic
 Instruction representation  Logical
 Instruction types  Conversion
 Number of addresses  Input/output
 Instruction set design  System control
 Types of operands  Transfer of control
 Numbers
 Characters
 Logical data

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy