# What are the types of Data Manipulation Instructions in Computer Architecture?

Computer ArchitectureComputer ScienceNetwork

Data manipulation instructions have computational capabilities. They perform arithmetic, logic, and shift operations on data.

There are three types of data manipulation instructions are as follows −

## Arithmetic Instructions

Arithmetic operations include addition, subtraction, multiplication, and division. Some computers provide instructions only for addition and subtraction operations and generate multiplication and division operations from these two operations. Each instruction is represented by a mnemonic symbol.

The table shows some of the arithmetic instructions and their respective mnemonic symbols.

Arithmetic Instructions

NameMnemonic Symbols
StoreST
MoveMOV
ExchangeXCH
InputIn
OutputOUT
PushPUSH
PopPOP

The description of these instructions is as follows −

Increment − The increment instruction adds 1 to the value stored in the register or memory word.

Decrement − The decrement instruction subtracts 1 from the contents stored in the register or memory word.

Arithmetic Instructions − The arithmetic instructions are available for different types of data such as floating-point, binary, single-precision, or double-precision data.

During the execution of arithmetic instructions, the processor status flags or conditional codes are set to designate the outcome of the operation.

## Logical and Bit Manipulation Instructions

Logical instructions carry out binary operations on the bits stored in the registers. In logical operations, each bit of the operand is treated as a Boolean variable. Logical instructions can change bit value, clear a group of bits, or can even insert new bit value into operands that are stored in registers or memory words. Each logical instruction is represented by mnemonic symbols.

NameMnemonics
ClearCLR
ComplementCOM
ANDAND
OROR
Exclusive-ORXOR
Clear carryCLRC
Set carrySETC
Complement carryCOMC
Enable interruptEI
Disable interruptDI

The clear instruction replaces the specific operand with 0’s. The complement instruction inverts all the bits of the operand and produces 1’s complement. The AND, OR, and XOR instructions perform logical operations on each bit or group of bits of the operand.

The AND instruction can clear a bit or group of bits of an operand. For the Boolean variable, a, the relationship ‘ab0 = 0’ and ‘ab1 = a’ indicates that the binary variable when ANDed with 0 changes the value to 0.

The OR instruction can set a bit or group of bits of an operand. For the Boolean variable, a, the relationship ‘a + 1 =1’ and ‘a + 0 = a’ indicates that the binary variable when ORed with 1, changes the value to 1.

The XOR instruction can complement bits of an operand. For the Boolean variable, a, the relationship ‘a + 1 = a’ and ‘a + 0 = a’ indicates that the binary variable is complemented when XORed with 1. However, the variable does not change the value when XORed with 0.

The carry bits can be cleared, set, or complemented with appropriate instructions. The bit manipulation instructions can also enable or disable the interrupt facility, which is controlled by flip-flops.

## Shift Instructions

Shift instruction helps to shift the bits of an operand to the right or the left. The direction of the shift is based on specific instructions. The operand is first loaded into the accumulator and then the shift operation is performed bit by bit.

The shift-left operation shifts the zero into low-order vacated positions. In shift-right operations, zeros are shifted into high-order vacated positions. The bits that are shifted can also be the original value of the sign bit as in the case of arithmetic right shift or can be the bits that are shifted out of a low-order position of the accumulator-extension as in the case of Rotate Right Accumulator and Extension (RRAE).