Types of Instructions|Independent vs Memory-Mapped I/O

Types of Instructions:

mostly classified into 3 types

  1. Data Transfer Instructions:
  2. Data Manipulation Instructions
  3. Program Control Instructions
Data Transfer Instructions:
Data transfer instructions cause transfer of data from one location to another without changing the information content. load,store,move, input,out put, push,pop are data transfer instructions.

The common transfers may be between memory and processor registers, between processor registers and input/output.

The stack instructions push and pop transfer data between a memory stack and a processor register or memory. The push operation places an item onto the top of the stack (TOS).
 • The pop operation removes one item from the TOS.
 • Stack is basically part of the memory, and to provide the logic of pushing and popping a register is used which is called Stack Pointer (SP).

Independent(Isolated) vs Memory-Mapped I/O 

There are two techniques for address I/O devices by CPU

  • Memory mapped I/O
  • Isolated I/O
Input and output instructions transfer data between processor registers and input and output devices.
 • These instructions are similar to load and store instructions except that the transfers are to and from external registers (I/O) instead of memory words.
 • A port is typically a register with input and/or output lines connected to the device. And each port requires an address to be accessed by the computer.

Isolated I/O:
 • In the independent I/O the address ranges memory and I/O ports are independent from each other. 
I/O  read and I/O write line for I/O transfer.
memory read and memory write lines for memory transfer.
in and  out instruction deal with I/O transfer.

(two seprate address space are used 1.memory 2.I/O device}

Memory mapped I/O:
1 address space is used for memory location and I/O devices.
only 1 set of read and write instruction line
• In memory-mapped I/O the portion of memory address range is used to address the I/Os. So same type of instructions ( e.g. load, store) can be used to access the both memory and I/Os.

Data Manipulation Instructions:
 Data manipulation instructions perform operations on data and provide the computational capabilities for the computer. 

There are three types of data manipulation instructions: Arithmetic instructions, Logical and bit manipulation instructions, and Shift instructions.
Arithmetic Instructions
Four basic arithmetic instructions are addition, multiplication, subtraction and division.
 • The subtract reverse instruction performs B-A instead of A-B.
 • The negate instruction calculates the 2’s complement of the number.

Logical and Bit-Manipulation Instructions
Clear means making all the bit of a register ‘0’.
 • Set means making all the bit of a register ‘1’.
 • AND is sometimes referred to as bit clear instruction or mask
 • OR is sometimes referred to as bit set instruction 
• XOR is referred to as bit complement instruction

Shift Instructions
The table shows exemplary instructions of shifting. Below is a format of shift instruction which has following fields.
 • OP is opcode field
 • REG determines which register is to be shifted 
• TYPE tells the type of shifting from the list given below 
• RL tells whether to shift right or left.
 • COUNT tells the number of places to be shifted


Floating Point Computations

Floating point notation is used to represent long range numbers often found in scientific calculations. • The floating-point number has two parts: • Fraction (or mantissa) contains the sign and a fraction. • Exponent designates position of the radix point in the number. • Decimal numbers are interpreted as representing the number in the form • Only fraction and exponent are represented in the computer registers. 10 and decimal point are not stored explicitly. • For example the number +1001.11 is represented

Program Control Instructions
Program control instructions specify conditions for altering the content of the program counter, while data transfer and manipulation instructions specify conditions for data processing operations. The change in value of a program counter as a result of the execution of a program control instruction causes a break in the sequence of instruction execution.

Program Control Instructions
 • Branch Instructions
 • Procedure Call and Return Instructions

A program control instruction changes address value in the PC and hence the normal flow of execution.
 • Change in PC causes a break in the execution of instructions.
 • It is an important feature of the computers since it provides the control over the flow of the program and provides the capability to branch to different program segments.

Typical Program Control Instructions
 • Branch (BR) and Jump (JMP) instructions are used sometimes interchangeably but, they are different.
 • Branch and Jump instructions usually differ in addressing modes. • Usually Jump is used to refer to unconditional version of branch.
 • Skip (SKP) instructions is used to skip one(next) instruction. It can be conditional or unconditional. It does not need an address field.
 • In case of conditional skip instruction, the combination of conditional skip and a unconditional branch can be used an alternative of conditional branch. But, storing two instructions will take extra space.
 • In skip instruction we increment the PC in execution stage, effectively incrementing it by 2.
 SKP (skip if z=0 )
 JMP $100
 ADD R2,R1,R3

 BRNZ $100

Typical Program Control Instructions 
• Compare (CMP) instruction performs a comparison via a subtraction, with difference not retained.
 • The comparison causes one of the three following operations a. A conditional Branch ( 3ree addresses [2 registers and 1 memory] ) b. Change in the contents of a register ( 3ree addresses) c. Sets or resets stored status bits (2 addresses), this type of instruction is usually followed by a branch instruction to conditionally check the status bit and perform a branch.
 • Similarly test ( TEST) instructions performs the AND of two operands without retaining the result. • It also causes one the above three functions.

Conditional Branch Instructions
 • A conditional branch instruction is a branch instruction that may or may not cause a transfer of control depending on the value of stored bits in the PSR (processor status register).
 • Each conditional branch instruction tests a different combination of Status bits for a condition.
 • If the condition is true, control is transferred to the effective address (PC←Add). If the condition is false, the program continues with the next instruction (PC←PC+1).
 • Below is a list of Conditional Branch instructions, letter ‘N’ stands for NOT.

Conditional Branch Instructions 
• ‘C’ represents the carry, or borrow after arithmetic addition or subtraction.
 • ‘N’ represents the leftmost bit of the result of the operation i.e. sign bit.
 • ‘V’ is for overflow i.e. if the sign of the result is changed (inverted).
• ‘Z’ is for zero i.e., to check whether the result of an operation is zero (Z=1) or not zero (Z=0).

Comparison Branch Instructions
 • Some branch instructions are a combination of compare and conditional branch instructions. They are run after the compare instruction has performed the comparison and status bits are updated.
 • Different status bits are checked for signed and unsigned numbers.
 • Keep in mind that
 • A≥B is complement of AB. That means if we know the condition of status bits for one, the condition for the other complementary relation is obtained by complement.


Comments

Popular posts from this blog

WHAT ETHICAL, SOCIAL, AND POLITICAL ISSUES ARE RAISED BY INFORMATION SYSTEMS?

Porter’s Value Chain Analysis

General Register organization & Components of CPU and their functions: