Design_and_Implementation_of_Single_PrecisionFloatingPointArithmeticLogicUnitforRISCProcessoronFPGA
Design_and_Implementation_of_Single_PrecisionFloatingPointArithmeticLogicUnitforRISCProcessoronFPGA
net/publication/372170624
CITATION READS
1 778
3 authors, including:
SEE PROFILE
All content following this page was uploaded by Mohamed Muftah Eljhani on 16 July 2023.
1st Noor Alhuda Saad Adela 2nd Amani Najeeb Ben Yousuf 3rd Mohamed Muftah Eljhani
Department of Computer Engineering Department of Computer Engineering Department of Computer Engineering
University of Tripoli University of Tripoli University of Tripoli
Tripoli, Libya Tripoli, Libya Tripoli, Libya
[email protected] [email protected] [email protected]
Abstract— The main purpose of conducting this research is to based on a 32-bit general-purpose four-stage pipeline processor
design and implement a single precision floating-point arithmetic equipped with a floating-point unit. The processor includes a
logic unit (ALU) that considered as a part of the math coprocessor. comprehensive collection of instructions, programs, and data
The main advantage of floating-point representation is that it can memory, general-purpose registers, and an arithmetic logic unit
support more values than fixed-point and integer representations. that can perform single-precision floating-point arithmetic
Summation, Subtraction, multiplication and division are calculations [4]. Designing high-performance arithmetic
arithmetic functions in these calculations. In this floating-point hardware has always been a sought-after challenge because
unit, input must be provided in IEEE-754 format, which is 32 microprocessors and signal processors are widely used. The
single precision floating point values. The application of This
Arithmetic and Logic Unit, which controls the speed of
arithmetic unit is located in the math coprocessor. Commonly
processor operations, is a crucial component of microprocessors.
referred to as reduced instruction set computation (RISC)
processor. In this processor, for a signal processing, a value with Simple arithmetic calculations are performed by standalone
high accuracy is required and as it is an iterative process, the circuitry on modern CPUs. Adding on-chip memory or cache to
calculation should be as fast as possible. A fixed-point and integer fast arithmetic hardware allows processors to reduce latency
central processing unit (CPU) can't meet the requirements. The associated with data access from main memory, resulting in a
floating-point representation can calculate very large or very significant boost in performance [5]. CPUs and GPUs nowadays
small process quickly and accurately. The system designed, come equipped with processors that can accommodate multiple
verified and implemented with Verilog hardware description and robust ALUs. Typically, the ALU is responsible for
language using Intel Altera software tools. performing various mathematical, logical, and decision-making
computations as part of the final processing stage by the
Keywords—: Floating point, IEEE-754, ALU, FPGA Design, processor. Arithmetic operations such as addition, subtraction,
Verilog Hardware Description Language and incrementing, as well as logic operations like AND, OR,
XOR, and NOT, are all executed by the ALU[6]Floating point
I. INTRODUCTION operations are widely utilized in various sectors due to their wide
RISC is a microprocessor design approach that emphasizes dynamic range, simple operation rules, and high precision.
simplicity and ease of use. While it may not be as efficient for There is an increasing need for high-speed hardware floating
complex calculations that require a single, complicated point arithmetic units to fulfill the demand for high-speed data
instruction to execute, it excels at tasks that can be broken down signal processing and scientific procedures. Additionally, the
into multiple simple operations. This makes RISC processors use of floating-point arithmetic operations is increasing in
ideal for use in pipelining applications[1] [2]. With the commercial, financial, and internet-based applications [7]. The
increasing complexity of devices, integrated microprocessors floating point representation is a widely used method to
must provide high performance, while still maintaining low represent real numbers in scientific notation. It uses a sliding
power consumption and a small form factor. This has become window mechanism to adjust the precision according to the
essential for daily activities, as computers and mobile phones number's scale, making it capable of representing extremely
have become indispensable tools. However, with the growing large or small numbers, ranging from 1,000,000,000,000 to
complexity of these products, there is a greater need for 0.000000000000001. To implement floating point arithmetic on
processing power while still maintaining battery life. Recent reconfigurable hardware, such as FPGAs, is challenging due to
trends have shown that RISC processors have overtaken CISC the complex algorithms. Therefore, we aim to construct a
processor architecture. The advantage of RISC is that it can floating-point arithmetic unit or DSP processor for high-
execute instructions quickly due to the simplicity of the accuracy scientific tasks using Verilog HDL and Altera Quartus
instructions [3]. A RISC microprocessor is characterized by its II. The module includes arithmetic operations such as addition,
limited number of instructions and ability to perform millions of subtraction, multiplication, and division [8].
instructions per second. This article discusses a CPLD which is
D. Arthimetic Block
This block is used to perform arithmetic operations such as
addition, subtraction and multiplication. The accumulator and
auxiliary register b provide input to this block, as shown in
“Fig. 2”.
B. Opcode Decoder
The proposed design consists of a main opcode decoder Fig. 2. Pipelined RISC Architecture
that activates the corresponding function block based on the
instruction opcode executed by the processor and passed to the 1. Integer Addition/Subtraction
ALU block. The corresponding output lines will provide the
activation currents of the respective function blocks. The Fast addition is crucial in various digital systems, and
decoder is 6 to 43 bits, it takes a 6-bit opcode as input and it it's important to note that subtraction and addition are
turn activates the corresponding function block to perform the essentially the same operation. The only difference is that in
desired operation. subtraction, the second operand's sign is reversed. With this
understanding, it's easy to execute integer subtraction using any
C. Selected Instructions integer adder. To make the adder compatible with both
The ALU that was designed requires a clock signal, two 32- operations, slight modifications are necessary to perform
bit operands, and a 6-bit opcode as its inputs. The instructions addition and subtraction of integers, a logic must be set up. If
that have been implemented in the ALU can be found in subtraction is selected, the B operand needs to undergo a two's
TABLE I. complement conversion, while for addition, B should remain
the same. There are two ways to achieve this: using an inverter
“Table. I”. show the complete list of the implemented and a per-bit multiplexer or by using an XOR gate. In the XOR
instructions, and “Table. II”. show the Floating-Point: Special gate method, one bit is associated with control, and the other is
Cases. linked with the corresponding bit of B.
.
Identify applicable funding agency here. If none, delete this text box.
131
Authorized licensed use limited to: International Islamic University Malaysia. Downloaded on July 11,2023 at 23:09:29 UTC from IEEE Xplore. Restrictions apply.
2. Integer Multiplication shifted by adding the shift symbol. In logical shifting, the empty
bit positions in the shift are filled with zeros like in “Fig.4” [9].
Multiplication is a commonly used operation that has
various applications, including scientific calculations and
signal processing. It is also essential for performing division.
Integer coefficients can be implemented through different
methods, with typical implementations being change and add.
When performing multiplication, both registers are utilized to
produce a 64-bit output. as in “Fig.3”
132
Authorized licensed use limited to: International Islamic University Malaysia. Downloaded on July 11,2023 at 23:09:29 UTC from IEEE Xplore. Restrictions apply.
Fig. 5. Single-Precision IEEE 754 Format
Operation OP Code
Addition 00
Subtraction 01
Multiplication 10
1. Floating-Point Adder/Subtractor
133
Authorized licensed use limited to: International Islamic University Malaysia. Downloaded on July 11,2023 at 23:09:29 UTC from IEEE Xplore. Restrictions apply.
K. Hardware Test Environment
Our team has developed a comprehensive EDA (Electronic
Design Automation) printed circuit board system to enable
efficient and thorough testing and validation of the floating
point ALU in hardware. This system is intended to facilitate the
use of more advanced FPGA development tools as shows in
“Fig.8”.
IV. CONCLUSION
The goal of this project is to create an architecture for an
arithmetic logic unit and floating-point unit that can handle all
arithmetic and logical operations for a RISC processor. The
design should be flexible enough to scale up to 32 bits. The
project uses Verilog language and utilizes software tools like
ModelSim 10.1 and Quartus II 12.1 for simulation and testing.
Fig.8. PCB with Cyclone FPGA The techniques utilized in this project provide a distinct
approach to design, test, and verify the system. The design
was done using electronic design automation tools.
III. SIMULATION AND RESULTS
REFERENCES
To confirm the proper functioning of each arithmetic block
and floating-point implementation, they were programmed
using Verilog hardware descriptive language. In ModelSim, test [1] C. Hamacher, Z. Vranesic and S. Zaky, Computer Organizationn
benches were created and executed to validate their performance fifth edition, 2002.
as shows in “Fig.9”, “Fig.10”, and “Fig.11”. [2] Mohamed M. Eljhani, Veton Z. Kepuska, Reduced Instruction
Set Computer Design on FPGA. 2021 IEEE 1st International
Maghreb Meeting of the Conference on Sciences and Techniques
of Automatic Control and Computer Engineering MI-STA, 25-27
May 2021, Tripoli-Libya
[3] J. Poornima, G. V. Ganesh, M. Jyothi, M. Shanti and A. Jhansi,
"Design and implementation of pipelined 32-bit Advanced RISC
processor for various D.S.P Application," Proceedings of
International Journal of Computer Science And Information
Technology, June 2012.
[4] R. P. Colwell, C. Y. Hitchcock, E. D. Jensen, H. M. Brinkley
Sprung and C. P. Kollar, "Instruction sets and beyond: computers,
complexity, and controversy,," IEEE Computer, 1986.
[5] A. Athihrii, M. Stephen and S. Kumar, "Design and
Fig.9. FPU Adder implementation of 32-bit ALU using verilog," 02 June 2016.
[6] D. Malik and R. S. Rathore, "32-bit Arithmetic Logical Unit
(ALU) using VHDL," vol. 1, no. 1, 26 NOV 2013.
[7] R. Cherian, N. Thomas and Y. Shyju, "Implementation of Binary
to Floating Point Converter using HDL," no. 461-64, 2013.
[8] R. Payal, "Simulation and Synthesis Model for the Addition of
Single Precision Floating Point Numbers Using Verilog," vol. 02,
no. 09, Sep 2013.
[9] K. Garg, M. Garg, S. Mehta and S. Vashist, "n-Bit Arithmetic &
Logical Unit (ALU)," 2015.
134
Authorized licensed use limited to: International Islamic University Malaysia. Downloaded on July 11,2023 at 23:09:29 UTC from IEEE Xplore. Restrictions apply.