Lecture 6
Lecture 6
Instruction Sets:
Characteristics and
Functions
+
+ 2
Example
Instruction Format
Example of
Program
Execution
Elements of a Machine Instruction
5
Instruction Representation
Within the computer each instruction is represented by a sequence of
bits
Instruction Representation
Opcodes are represented by abbreviations
called mnemonics
Examples include:
ADD Add
SUB Subtract
MUL Multiply
DIV Divide
LOAD Load data from memory
STOR Store data to memory
Instruction - Example
• Consider a high-level language instruction:
X = X + Y;
• The set of machine instructions must be sufficient to express any of the instruction
from a high-level language
Instruction Types 11
Data
Data storage
processing
Data
Control
movement
• Test instructions are used to test the value of a data • I/O instructions are
word or the status of a computation needed to transfer
• Branch instructions are used to branch to a different programs and data into
set of instructions depending on the decision made memory and the results
of computations back out
to the user
12
13
Table 12.1
Utilization of Instruction Addresses
(Non-branching Instructions)
Instruction Set Design 14
Types of Operands
e sses
Ad d r
Num
be rs
Chara
cters
a l Da t a
Lo gi c
+ Numbers 16
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
+ 17
Characters
Logical Data
An n-bit unit consisting of n 1-bit items of data, each item having the
value 0 or 1
Table 12.2
x86
Data Types
20
Table 12.3
Common
Instruction Set
Operations
(page 1 of 2)
Table 12.3
Common
Instruction Set
Operations
(page 2 of 2)
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
+
24
Table 12.6
Basic Logical Operations
26
27
Table 12.7
Instructions that
change the format
or operate on the Conversion
format of data
An example of a
more complex
editing instruction
is the EAS/390
An example is Translate (TR)
converting instruction
from decimal
to binary
+ 29
Input/Output
Typically these instructions are reserved for the use of the operating system
Transfer of Control
References