CA Lecture 10
CA Lecture 10
Lecture 9.
. Instruction Sets:
Characteristics and Functions.
Instructors
3
Elements of a Machine Instruction
4
Instruction Cycle State Diagram
5
Source and result operands
can be in one of four areas:
1) Main or virtual memory 3) Processor register
• As with next instruction references, • A processor contains one or more registers
the main or virtual memory address that may be referenced by machine
must be supplied
instructions.
2) I/O device • If more than one register exists each
• The instruction must specify the I/O register is assigned a unique name or
module and device for the number and the instruction must contain
operation. If memory-mapped I/O is
the number of the desired register
used, this is just another main or
virtual memory address
4) Immediate
• The value of the operand is
contained in a field in the instruction
being executed
6
Instruction Representation
7
Instruction Types
• Arithmetic instructions provide
computational capabilities for
processing numeric data
• Movement of data into
• Logic (Boolean) instructions or out of register and or
operate on the bits of a word as memory locations
bits rather than as numbers,
thus they provide capabilities
for processing any other type of Data Data
data the user may wish to
employ processing storage
Data
Control
• Test instructions are used to test the movement
value of a data word or the status of a
computation • I/O instructions are needed to
• Branch instructions are used to branch transfer programs and data into
to a different set of instructions memory and the results of
depending on the decision made computations back out to the
user
8
Number of Addresses
9
Instruction Addresses
Table 12.1
Utilization of Instruction Addresses (Nonbranching Instructions)
10
Types of Operands
Addresses
Numbers
Characters
Logical Data
11
Numbers
• 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
12
Characters
13
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
14
x86 Data Types
Table 12.2
15
x86 Numeric Data Formats
16
Single-Instruction-Multiple-Data (SIMD)
Data Types
17
ARM Data Types
Alignment checking
All three data types can also be • When the appropriate control bit is set,
used for twos complement a data abort signal indicates an
signed integers alignment fault for attempting
unaligned access
19
Processor Actions
Table 12.4
Processor Actions for Various Types of Operations
20
Data Transfer
Must specify:
Most fundamental • Location of the source and
destination operands
type of machine • The length of data to be
instruction transferred must be indicated
• The mode of addressing for each
operand must be specified
21
Table 12.5
Examples of IBM EAS/390 Data Transfer
Operations
22
Arithmetic
23
Logical
24
Shift and Rotate Operations
Table 12.7
Examples of Shift and Rotate Operations
25
Input/Output
• Many implementations provide only a few I/O instructions, with the specific
actions specified by parameters, codes, or command words
26
System Control
27
Transfer of Control
28
Branch Instruction
29
Procedure Call Instructions
30
Nested
Procedures
31
Use of Stack to Implement Nested
Procedures
32
Stack Frame Growth
33
X86 Operation Types
Table 12.8
x86
Operation Types (With
Examples of Typical
Operations)
(page 1 of 2)
34
X86 Operation Types
Table 12.8
x86
Operation Types (With
Examples of Typical
Operations)
(page 2 of 2)
35
Call/Return Instructions
36
x86 Status Flags
37
X86 Condition Codes
Table 12.10
x86
Condition Codes for
Conditional Jump
and SETcc
Instructions
38
x86 Single-Instruction, Multiple-Data
(SIMD) Instructions
• 1996 Intel introduced MMX technology into its Pentium product line
• MMX is a set of highly optimized instructions for multimedia tasks
• Video and audio data are typically composed of large arrays of small data types
• Three new data types are defined in MMX
• Packed byte
• Packed word
• Packed doubleword
• Each data type is 64 bits in length and consists of multiple smaller data fields,
each of which holds a fixed-point integer
39
MMX Instruction Set
Note: If an instruction supports multiple data types [byte (B), word (W), doubleword (D), quadword (Q)], the data types are indicated in brackets. 40
Conclusion
41
Questions
42
Answers
1 Operation code, source operand reference, result operand reference and next
instruction reference.
2 Register and memory.
3 Two operands, one result, and the address of the next instruction.
4 Address, character, numbers and logical data.
5 In logical shift, the bits of word are shifted left or right. Arithmetic shift treats the
data as a signed integer and does not shift the sign bit.
43
Answers (cont.)
6 Assemble language uses symbolic names for addresses that are not fixed to specific
physical address; this is not the case with machine language.
7 A multibyte numerical value stored with the most significant byte in the lowest
numerical address. A multibyte numerical value stored with the most significant byte
in the highest numerical address.
8 Register, start of procedure, top of stack
44