Arithmetic Logic Unit Technical Memo
Arithmetic Logic Unit Technical Memo
Technical Memo
Prepared by
Christy Christy
8584799
Introduction
My name is Christy and I work in your company as Hardware Engineer, When I was going through the
projects list for outsourcing I saw one project called “16 bit ALU using Verilog code” and the expense
that can incur to our company I strongly felt to write this document to you.
16 bit ALU using Verilog code is not a complex design to be implemented and I have already done a
design work which passes almost all conditions of your proposed test bench. In this document I will
explain all the procedures and difficulties I faced when I was implementing this design.
What is ALU?
The Arithmetic Logic Unit is the fundamental central processing unit that performs tasks like addition,
subtraction, division, multiplication and logical operations like INVERT,AND,OR,XOR,SHIFT LEFT,SHIFT
RIGHT,ROTATE LEFT etc. Generally, all mathematical and logical operations for the processor occur in
this hardware.
DESIGN OBJECTIVE/PURPOSE
There is two 16 bit data buses ABUS and BBUS and one select line which is of 4 bits ,according to the
input at select line desired operation is performed between two inputs ABUS and BBUS
There are total 4 Inputs ABUS,BBUS,FSEL,CIN in this FSEL is a 4 bit variable which selects different
operations to perform for the ALU.CIN is the Carry in.
V-Overflow flag Asserted when the ALU output has been overflowed
We need to save these flags in registers so that the previous state of the flags are stored can be utilized
with efficiency.
Each operation is having a 4 bit value and the 4 bit value is assigned to different variables as follows
TSA =4'b0000,
INC =4'b0001,
DEC=4'b0010,
ADD=4'b0011,
SUB=4'b0100,
AND=4'b0101,
OR=4'b0110,
XOR=4'b0111,
NOT=4'b1000
SHL=4'b1001,
SHR=4'b1010,
ASR=4'b1011,
RLC=4'b1100,
RRC=4'b1101,
RSV1=4'b1110,
RSV2=4'b1111
These functions can be implemented by using a case statement by checking FSEL value
According to the FSEL value different operations will be performed and stored in a temporary variable
temp.
When the program comes out of case statement value at temp is assigned to FOUT.
Implementation Method
I will be using model sim 10.5 version to design and simulate the code.
There is a test bench which checks all the functions which is to be implemented and also displays the
failed operations and passed operations. This can also be checked by using a FPGA kit.
Software check is the most efficient way as it checks all the operations at a time.
I run the code and it passes all the conditions for the test bench and works perfect.
Reading the output at first was difficult and the use of temporary variable helped in this.
Use of case statement was very efficient as the code readability and program speed has also been
increased.
Rotate left with carry and ,Rotate right with carry was bit difficult to implement as it was not a direct
operation a bit of thinking and logic was required here.
Resources and reference section
https://conestoga.desire2learn.com/d2l/le/content/325226/viewContent/6785687/View
https://conestoga.desire2learn.com/d2l/le/content/325226/viewContent/6785686/View
https://www.researchgate.net/publication/271646895_Simulation_of_Arithmetic_Logic_Unit_and_Impl
ementation_using_FPGA
https://forums.xilinx.com/t5/General-Technical-Discussion/rotate-right-in-verilog/td-p/755517
http://robotics.ee.uwa.edu.au/courses/design/examples/example_design.pdf
http://www.ijeast.com/papers/30-34,TESMA302,IJEAST.pdf