ALU Design
ALU Design
(ALU)
CHAPTER 1: INTRODUCTION
An arithmetic logic unit (ALU) is a key component of a computer’s central processor unit.
The ALU performs all arithmetic and logic operations that must be performed on instruction
words. The ALU is split into two parts in some microprocessor architectures: the AU and the LU.
In the computer system, ALU is a main component of the central processing unit, which
stands for arithmetic logic unit and performs arithmetic and logic operations. It is also known as
an integer unit (IU) that is an integrated circuit within a CPU or GPU, which is the last component
to perform calculations in the processor. It has the ability to perform all processes related to
arithmetic and logic operations such as addition, subtraction, and shifting operations, including
Boolean comparisons (XOR, OR, AND, and NOT operations). Also, binary numbers can accomplish
mathematical and bitwise operations. The arithmetic logic unit is split into AU (arithmetic unit)
and LU (logic unit). The operands and code used by the ALU tell it which operations have to
perform according to input data. When the ALU completes the processing of input, the
information is sent to the computer's memory
The calculations needed by the CPU are handled by the arithmetic logic unit (ALU); most of the
operations among them are logical in nature. If the CPU is made more powerful, which is made
on the basis of the ALU is designed. Then it creates more heat and takes more power or energy.
Therefore, it must be moderation between how complex and powerful ALU is and not be more
costly. This is the main reason the faster CPUs are more costly; hence, they take much power and
destroy more heat.
Although the ALU is a major component in the processor, the ALU's design and function may be
different in the different processors. For case, some ALUs are designed to perform only integer
calculations, and some are for floating-point operations. Some processors include a single
arithmetic logic unit to perform operations, and others may contain numerous ALUs to complete
calculations.
In this project we have taken basic operations we have used 8-bit accumulator along with
8- bit auxiliary register as inputs and 8-bit output register along with the 9-bit of status register
(The size of the inputs and output are user defined). The status register has the following flag bits
in order of 4-bit overflow falg, carry flag, barrow flag, zero flag, done flag for shifter block and
done flag for code converter block. Here in general zero flag will be affected when ever the output
result of any operation is all zeros.
Zero Flag - 1- indicates the result is all zeros.
0- indicates the result is non-zero.
Status register:
Status Register Bit Position Flag
0 Code Convertion Done
1 Shifting Done
2 Zero Flag
3 Barrow Flag
4 Carry Flag
5 Over Flow 0
6 Over Flow 1
7 Over Flow 2
8 Over Flow 3
CHAPTER 2: DESIGN BLOCKS
Our design comprises of 7 basic sections.
1. Opcode Decoder
2. Arithmetic Block
3. Logical Block
4. Comparator Block
5. Shifter Block
6. Code Conversion Block
7. Result Fetching Block
Section 2 to 6 having one dedicated output register each for output as well as for status. At
any point of time, although multiple operations may be issued to the ALU in parallel,
simultaneously only those operations may execute that run on independent block sections of the
ALU. Thus, on the basis of the issued operation, the respective output is fetched from the sectional
output register and delivered to the final 8bit result register. It is recomended to reset all the
registers before starting of any operations.
1. Adder 0001
2. Subtractor 0010
3. Multiplier 0011
4. Divider 0100
5. AND 0101
6. OR 0110
7. NOT 0111
8. NANAD 1000
9. NOR 1001
2.2.2 Subtractor:
Here the substraction between two 8-bit numbers will be performed. The result difference
is of 8-bit length along with the barrow (ba) flag bit. After the substraction operation the status
register [3] bit – barrow flag will be affected. Barrow flag 1- indicates there is a barrow while
substratcion operation and 0- indicates there is no barrow.
Eg: 1st input (8-bit) A= 0111 1111
2nd input (8-bit) B= 1111 1111
The difference between the above two numbers is A-B=1000 0000 and Barrow is
1.
Eg2: accumulator=11001011(203), auxilary_register=10101010(170), opcode=0010(2), output
=00100001( 33), status register=000000000( 0)
2.2.3 Multiplier:
Here the multiplication of two 4-bit numbers will be performed. The result is of 8-bit width.
If width of the product is more than 8- bits (if the width of multiplier & multiplicant is more than
4-bit), the lsb 8- bits of product will be stored in the output register and Overflow 3 bit of- (MSB
of status register) status register will be active high, which represents that the multiplication
product is having more than 8-bit length.
Eg: accumulator=11001011(203), auxilary_register=10101010(170), output
=11001110(206), status register=100000000(256) , here status msb bit indicates that the
product is more than 8- bit width.
1 Shifting Done
2 Zero Flag
3 Barrow Flag
4 Carry Flag
5 Over Flow 0
6 Over Flow 1
7 Over Flow 2
Multiplication product is having more width than
output register and the LSB 8-bits of product are in
8 output register.
2.2.4 Divider:
The division operation takes the input of two 8-bit numbers as divisor & divident and
results the 8-bit quotient of integer type only. As we are dealing with the integer type only. It is
recomended to use integer type data only. In this regard, we have not taken any flag bits to change
except the Zero flag, when the division operation is performed and the quotient is 0 then the zero
flag will be set to 1 otherwise set to 0. The result is taken floor value of quotient.
Eg: accumulator=11001011(203), auxilary_register=10101010(170),
output=00000001( 1), status register=000000000(0)
2.3.2 OR operation:
The bitwise OR operation will be performed between two 8- bit operands and the result
is 8-bit output register and the flag bit – zero flag (status register[2] bit) will be affected by this
operation.
Eg: The bitwise OR operation between (1111 0101) & (0000 1101) results – output
y=1111 1101 and status register=000000000.
Zero Flag=1 – the result consists of all zeros
Zero Flag=0 – the result is non-zero
CHAPTER 3
BLOCK DIAGRAM
The all blocks are integrated and the whole block diagram is as follows:
CHAPTER 4: CONCLUSIONS & ENHANCEMENTS
The ALU is designed based on the specifications given. By using this ALU we can
perform arithmatic operations like addition, substration, multiplication, division,with data size
of 8-bit, logical operations of bitwise-AND, bitwise-OR, bitwise-NOT, bitwise-NAND, bitwise-
NOR & bitwise-XOR operations, comparision of two 8- bit numbers, shifting/rotation
operations, converting the 4-bit binary number into Gray code, XS-3 code,XS-5 code,BCD code.
This ALU has some limitations. This ALU will give only integer type values when
division operation is performed. This design has flexibility that the bit size can be increased as
per the user perception. In this design the input registers and output registers are of same bit
width and for status register has one bit extra as compared to the remaining input & output
registers.
This design may be enhansed to perform floating point operations (division) with
considerable changes. As we have taken status bit to recover the previous value, it has got
protection from unexpected reset due to init signal. But limitation is that only previously
performed operation output is recovered. All the operations are combinational in nature. We may
introduce sequential elements like memories to enhance the speed of operation, size of the data
processed. The opcodes other than specified in code conversion block and shifter block may be
used for future specific operations.
REFERENCE:
EDA LINK: https://edaplayground.com/x/LcSQ