## Introduction

As you know, a computer works on instructions. Our systems consist of machine instructions to perform some operations like add, subtract, multiply, divide etc. To achieve these operations, the system stores the data in registers. Now, to operate this data, the CPU has micro-operations. A **micro-operation **is a simple operation performed on the data stored in one or more registers. They transfer the data between registers. There are four types of micro-operations:-

- Register micro-operations
- Arithmetic micro-operations
- Logic micro-operations
- Shift micro-operations

In this blog, we will discuss arithmetic micro-operations.

## What are Arithmetic Micro-Operations?

Arithmetic micro-operations perform operations on the numeric data stored in the registers.

The basic arithmetic micro-operations are-

- Addition
- Subtraction
- Increment
- Decrement
- 1’s complement
- 2’s complement

Let’s discuss these arithmetic micro-operations one by one.

### Addition

The Add arithmetic micro-operation adds the values of the two registers and stores the output in the desired register.

The symbolic notation for the Add arithmetic micro-operation is-

**R3 <- R1 + R2**

Here, R1 and R2 are the registers whose contents we want to add and,

R3 is the desired register for storing the output.

**Note: **We can either store the output in another register or the same register, i.e. R1 or R2.

For example, consider the value of register R1 as 1010 and the value of register R2 as 0011. For performing the add arithmetic micro-operation remember the following rules:

- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (here, 0 is placed in the result and 1 is transferred as carry to the next column)

If we add R1 and R2, the output will be-

### Subtraction

The Subtract arithmetic micro-operation subtracts the values of the two registers and stores the output in the desired register.

The symbolic notation for the Add arithmetic micro-operation is-

**R3 <- R1 - R2**

Here, R1 and R2 are the registers whose contents we want to subtract and,

R3 is the desired register for storing the output.

**Note: **We can either store the output in another register or the same register, i.e. R1 or R2.

For example, consider the value of register R1 as 1011 and register R2 as 0101. For performing the subtract arithmetic micro-operation remember the following rules:

- 0 - 0 = 0
- 0 - 1 = 1 (because 10 is borrowed from next high order digit which is equal to 2 in decimal so 2 - 1 = 1)
- 1 - 0 = 1
- 1 - 1 = 0

If we subtract R2 from R1, the output will be-

Besides the above way, there is also an alternate way of doing the arithmetic subtraction. This way includes the use of the 2’s complement.

To subtract the values of two registers, we need to add the first register, the complemented value of the second register and one.

The symbolic notation is-

**R3 <- R1 + R2’ + 1**

Here, R1 and R2 are the registers whose contents we want to subtract and,

R3 is the desired register for storing the output.

Using this method, we get the same output as R1 - R2.

**Note: **We can either store the output in another register or the same register, i.e. R1 or R2.

For example, consider the value of register R1 as 1011 and register R2 as 0101 (same as we take firstly). Now, we will perform subtraction using the alternate method.

First, we will complement the value of the register R2. 0 will be converted to 1 and 1 to 0.

Therefore, the content of R2 will become 1010.

Second, we will add R2 and 1.

Finally, we will add R1 and R2.

We will ignore the overflow bit (1 in this case). So, our output will be 0110.

### Increment

The Increment arithmetic micro-operation increments the value of a register by 1. This means this operation adds 1 to the value of the given register and stores the output in the desired register.

The symbolic notation for the Increment arithmetic micro-operation is-

**R1 <- R1 + 1**

Here, R1 is the register whose value we want to increment and,

R1 is also the desired register for storing the output.

**Note: **We can store the output in another register or the same register.

For example, consider the value of register R1 as 0101. For performing the increment arithmetic micro-operation, we will add 1 to R1.

The Increment arithmetic micro-operations is carried out with the help of a combinational circuit or a binary up-down counter.

### Decrement

The Decrement arithmetic micro-operation decreases the value of a register by 1. This means this operation subtracts one from the value of the given register and stores the output in the desired register.

The symbolic notation for the Increment arithmetic micro-operation is-

**R1 <- R1 - 1**

Here, R1 is the register whose value we want to decrement and,

R1 is also the desired register for storing the output.

**Note: **We can store the output in another register or the same register.

For example, consider the value of register R1 as 0101. For performing the decrement arithmetic micro-operation, we will subtract one from R1.

The Decrement arithmetic micro-operation is carried out with the help of a combinational circuit or a binary up-down counter.

### 1’s Complement

The 1’s complement arithmetic micro-operation complements the contents of a register. In this micro-operation, 0 is converted to 1 and 1 is converted to 0.

The symbolic notation for the 1’s complement arithmetic micro-operation is-

**R1 <- R1’**

Here, R1 is the register whose value we want to complement and,

R1 is also the desired register for storing the output.

**Note: **We can store the output in another register or the same register.

For example, consider the value of register R1 as 0101. For performing the 1’s complement arithmetic micro-operation, we will just convert 0 to 1 and 1 to 0.

Therefore, 1’s complement of R1 will be 1010.

### 2’s Complement

The 2’s complement arithmetic micro-operation first complements the contents of the given register and then adds 1 to it. This micro-operation is also known as **Negation**.

The symbolic notation for the 2’s complement arithmetic micro-operation is-

**R2 <- R2’ + 1**

Here, R2 is the register on whose value we want to perform 2’s complement and,

R2 is also the desired register for storing the output.

**Note: **We can store the output in another register or the same register.

For example, consider the value of register R2 as 0101. For performing the 2’s complement arithmetic micro-operation first, we will find the 1’s complement of R2.

The 1’s complement of R2 will be 1010. Then we will add 1 to it.

The signals that implement these operations propagate through gates in this case, and the result of the process can be transferred into a destination register via a clock pulse immediately after the output signal propagates through the combinational circuit.

Besides the above-described arithmetic micro-operations, there are two more arithmetic micro-operations- **multiply **and **divide**. These two operations are valid arithmetic operations, but they are not part of the required set of micro-operations.

A series of add and shift micro-operations are used to perform the multiply micro-operation.

A series of subtracting and shifting micro-operations are used to complete the divide micro-operation.

The following table shows the symbolic representation of various Arithmetic Micro-operations.

Symbolic Representation | Description |

R3 ← R1 + R2 | The contents of R1 plus R2 are transferred to R3. |

R3 ← R1 - R2 | The contents of R1 minus R2 are transferred to R3. |

R2 ← R2' | Complement the contents of R2(1's complement). |

R2 ← R2' + 1 | 2's complement the contents of R2(negate). |

R3 ← R1 + R2' + 1 | R1 plus the 2's complement of R2(subtraction). |

R1 ← R1 + 1 | Increment the contents of R1 by one. |

R1 ← R1 - 1 | Decrement the contents of R1 by one. |