Study Notes: Instruction Sets

Chapter 13: 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.

Instruction Cycle State Diagram


Figure 13.1: Instruction Cycle State Diagram
  • Instruction Fetch: The process starts with fetching the instruction.

  • Operand Fetch: The required operands are retrieved for the operation.

  • Multiple Operands Handling: If applicable, multiple operands are fetched.

  • Operand Store: Results are stored back into memory or registers.

  • Instruction Address Calculation / Instruction Operation Decoding: The address of the next instruction is calculated and the current instruction is decoded.

  • Completion: Instructions are completed, and the next instruction or vector data is fetched.

Operand Locations

Source and result operands can exist in one of four areas:

  • Main or Virtual Memory: The instruction must specify the address in memory.

  • I/O Device: This includes specifying the I/O module and device for the operation.

  • Processor Register: Refers to the internal storage locations within the processor.

  • Immediate: The operand's value is given directly within the instruction.

Instruction Format

  • Each instruction is represented by a sequence of bits divided into fields, corresponding to constituent elements of the instruction.

    Figure 13.2: A Simple Instruction Format

Instruction Representation

  • Opcodes: Represented by abbreviations known as mnemonics (e.g., ADD, SUB, MUL, DIV, LOAD, STORE).

  • Operands: Symbolically represented; the programmer indicates their locations.

  • Each symbolic opcode has a fixed binary representation.

Instruction Types

  • I/O Instructions: Transfer programs and data in/out of memory.

  • Test Instructions: Check the value of data or computation status.

  • Branch Instructions: Control flow based on conditions.

  • Data Movement: Move data between registers, memory.

  • Arithmetic Instructions: Perform computations on numeric data.

  • Logic Instructions: Operate on bit-level representations.

Examples of Instruction Operations

Table 13.1: Utilization of Instruction Addresses (Nonbranching Instructions)

Number of Addresses

Symbolic Representation

Interpretation

3

OP A, B, C

A ← B OP C

2

OP A, B

A ← A OP B

1

OP A

AC ← AC OP A

Instruction Set Design

Fundamental Design Issues:
  • Operation Repertoire: Determine which operations to include and their complexity.

  • Data Types: Identify types of data operations.

  • Instruction Format: Define lengths, field numbers.

  • Registers: Determine the number and use cases for registers.

  • Addressing: Address operand specification modes.

Types of Operands
  • Addresses: Refer to memory locations.

  • Numbers: Include fixed-point and floating-point data types.

  • Characters: Textual representation data.

  • Logical Data: Boolean values represented as bits.

Numeric Data Types

  • Options include:

    • Binary Integer: Fixed-point representation.

    • Binary Floating Point: Floats represented in scientific notation.

    • Decimal: Use binary-coded decimal (BCD).

    • Packed Decimal: Each decimal digit in a 4-bit representation.

Character Encoding

  • Commonly used character encoding includes:

    • ASCII: American Standard Code for Information Interchange.

    • EBCDIC: Extended Binary Coded Decimal Interchange Code used by IBM.

Logical Data Representation

  • Logical Data: Represented in n bits, with each bit having a value of 0 or 1.

  • Advantages:

    • Efficient memory use for Boolean arrays.

    • Manipulation capabilities: Shifting bits in operations.

x86 Data Types

Table 13.2:

Data Type

Description

General

Various locations with arbitrary binary contents.

Integer

Signed/unsigned binary values using two's complement representation.

Ordinal

Unsigned integers.

Unpacked BCD

Contains one digit per byte.

Packed BCD

Two BCD digits per byte.

Near Pointer

16 to 64-bit effective addresses.

Far Pointer

Logical address with segment and offset.

Bit Field

Sequence of bits as independent units.

Floating Point

Numeric formats for floats.

Packed SIMD Data Types

Include several fixed-length arrays in one.

Numeric Data Formats


Figure 13.4: x86 Numeric Data Formats

SIMD Data Types

  • Introduced to the x86 architecture to optimize multimedia applications.

  • Extensions: Include MMX and SSE.

  • Data Types: Packed variants of bytes, words, doublewords, and floating-point numbers.

ARM Data Types

  • ARM processors support data types:

    • 8, 16, 32 bits in length.

  • Alignment Checking: Ensures proper data alignment. Unaligned access requires special handling.

Common x86 Instruction Set Operations

Table 13.3: Operations (1 of 3)

Operation Name

Description

MOV

Move data between registers/memory/immediate.

XCHG

Swap contents between registers.

PUSH

Push to stack.

POP

Pop from stack.

Table continued…

Processor Actions for Various Operations

Table 13.4: Actions

Type of Operation

Description

Data Transfer

Transfer data from one location to another.

Arithmetic

Perform operation in ALU.

Data Transfer Instructions

  • Most fundamental types of instructions.

  • Must indicate source, destination, length, and addressing mode.

IBM EAS/390 Example Data Transfer Operations

Table 13.5

Operation

Mnemonic

Bits Transferred

Description

L

Load

32

Load from memory to register.

Arithmetic Instructions

  • Basic operations typically include add, subtract, multiply, divide.

  • Also provided for floating-point and packed decimal values.

  • Additional operations: Absolute value, Negate, Increment, Decrement.

Logical Operations

Table 13.6: Example Operations

P

Q

NOT P

P AND Q

P OR Q

P XOR Q

0

0

1

0

0

0

Shift and Rotate Operations

Table 13.7 Examples

Input

Operation

Result

10100110

Logical right shift (3 bits)

00010100

Input/Output Approaches

  • Varieties include isolated programmed I/O, memory-mapped I/O, and DMA.

  • Many systems provide a few I/O instructions with specific actions specified by parameters/codes.

System Control Instructions

  • Executed in privileged states; often reserved for OS use.

  • Examples include modifying control registers and accessing process control blocks.

Transfer of Control Instructions

  • Include Branch, Skip, and Procedure call instructions.

Procedure Call Instructions

  • Self-contained programs that can be invoked multiple times.

  • Involves a CALL instruction to invoke and a RETURN instruction to exit.

x86 Procedure Operations

Table 13.8: Status Flags

Bit

Name

Description

C

Carry

Indicates carry/borrowing after operations.

Single-Instruction, Multiple-Data (SIMD) Instructions

  • Intel introduced MMX for multimedia tasks in 1996.

Table 13.10: MMX Instruction Set

Category

Instruction

Description

Arithmetic

PADD [B,W,D]

Parallel add of packed bytes.

Summary of Chapter 13

  • Includes machine instruction characteristics, instruction representation, types, number of addresses, operand types, and operation types for Intel x86 and ARM.

References

  • All rights reserved. Text derived from Pearson Education materials.