In computer science, the Arithmetic Logic Unit is a type of digital circuit that helps perform various operations on binary numbers. The Arithmetic Logic Unit mainly performs two operations, Arithmetic operations and bitwise operations. The circuit of the Arithmetic Logic Unit is used in manufacturing various computer-based devices, like CPUs, FPUs and GPUs. The Input is how the operations would be performed, and in ALU, input is called operands. Along with this, the output is the final result obtained after implementing all operations. In the Arithmetic Logic Unit circuit, both Input and output remain between the external status registers and ALU.

## Arithmetic Logic Unit Circuit

Arithmetic Logic Unit Circuit is based on combinational logic. It means both input and output work asynchronously with each other. If the Input gets changed, the output also gets changed in ALU. The external mechanism of the ALU circuit consists of sequential logic. Sequential logic makes sure that the output will come on time.

## Signals in ALU

The ALU conveys the communication using digital signals. It transfers or receives messages from external circuitry via electrical signals. When the Arithmetic Logic Unit Circuit works, the ALU receives the Input from external circuitry after processing all the operations. The ALU sends outputs to the external circuitry.

## Data

The normal ALU circuit consists of three buses arranged in parallel. These three buses are Input, output and result. A and B id the Input to the ALU circuit, and after processing the operations, C will come. C is the output. The word size of all the three buses remains similar to each other.

## Opcode

An opcode is the operation selection code of the Arithmetic Logic Unit Circuit. The opcode consists of a value that demonstrates the specific logic or operation on the input values. The size of the opcode id is not fixed; it depends upon the number of operations ALU can perform. For instance, the 2-bit opcode can carry up to 4 operations.

## Functions did by ALU

The Arithmetic Logic Unit mainly performs the Arithmetic and bitwise operations. These are demonstrated here in detail.

## Arithmetic operations in ALU

- Add The sum of two binary numbers (A+B). The output comes as C
- Add with carrying: The sum of two input numbers and carry (A+B+Y). The output comes as C
- Subtract: One number gets minus from the two input numbers. The output comes as C
- Increment: The one is added to the value of Input. The output comes as C
- Decrement: The one gets minus from the input value. The output comes as C

## Bitwise logical operators in ALU

- AND: The bitwise AND takes two number inputs as A or B. It provides output by combining with the number. The output comes as C
- Exclusive OR: The bitwise OR takes two numbers as an input. The output comes as C
- Ones’ complement: All the input values get inverted in this operation, and the output comes as C

### Bit Shift operators in ALU

The ALU shift operations change the position of A or B. Move the weather to the right or left. Here are some different types of shift operand used in ALU catalogued:

- Arithmetic Shift: The Arithmetic shift operation works as a two’s complement integers
- Logical shift: The zero moves towards the input number under this operation
- Rotate: Rotate operation works as a circular buffer on the input values
- Rotate through carrying: The carry bit and input number perform the circular buffer under this operation

## Applications of ALU

Arithmetic Logic Unit helps perform various logical applications in CPU and other computer devices. These are:

### Multiple-precision arithmetic in ALU

Multiple-precision arithmetic is a type of algorithm which plays a major role in performing various arithmetic operations. Multiple Precision Arithmetic algorithms work on those large inputs, which have a large word size compared to ALU. For facilitating this algorithm, the operands are arranged according to the size. The operands can be arranged from most-significant Input (MS) to least-significant Input (LS) and conversely.

The Multiple-precision arithmetic operation directly works with the fragments of operands, which consequently generates the same fragments.

### Complex operations in ALU

ALU is fabricated to work upon various complex functions of computer science. But, sometimes, some undesired things like high complexity, big size, high power consumption hinder complex functions. Due to this, the area of ALU is limited to simple functions.

For overcoming this problem, the external processor circuitry is utilised. These processors work upon the different complex functions by arranging the values of operations

## Conclusion

The Arithmetic Logic Unit is used for performing various functions in the CPU. Although, In the CPU, it is the major part that regulates the actual execution of code. It only works upon binary numbers. So, the compiler of the CPU changed the user-friendly language to binary language. After that, operations implementation and processing are done. After this, the output again converted from binary language to user-friendly language. In this way, both input and output work combined. If the value of Input gets changed, then the resulting output value also gets changed. Although, the Arithmetic Logic Unit is a diverse topic of computer science. The whole internal structure of the CPU is dependent upon ALU.