🔒
Leading Research Platform
Serving Researchers Since 2012

Design And Implementation of A 32-Bit Risc-V Processor with A Switchable Floating Point Alu

DOI : 10.5281/zenodo.24839066
Download Full-Text PDF Cite this Publication

Text Only Version

Design And Implementation of A 32-Bit Risc-V Processor with A Switchable Floating Point Alu

Dr. Ravi L S

Dept. of ECE, Rajeev Institute of Technology, Hassan-573201, Visveswaraya Technological University, Belagavi, Karnataka, India.

Varshitha M R

UG Scholar, Department of ECE, Rajeev Institute of Technology, Hassan, Visvesvaraya Technological University, Belagavi, India

Inchara R

UG Scholar, Department of ECE, Rajeev Institute of Technology, Hassan, Visvesvaraya Technological University, Belagavi, India

Hema H C

UG Scholar, Department of ECE, Rajeev Institute of Technology, Hassan, Visvesvaraya Technological University, Belagavi, India

Janice Pearl Dcosta

UG Scholar Department of ECE, Rajeev Institute of Technology, Hassan, Visvesvaraya Technological University, Belagavi, India

Abstract – Modern embedded, signal-processing and real- time systems need processors that handle both integer and floating-point arithmetic without paying the power and area cost of a floating-point unit (FPU) for every instruction. This paper presents the design of a 32-bit RISC-V processor based on the RV32I base integer set and the RV32F single-precision extension, organised as a five-stage pipeline (IF, ID, EX, MEM, WB). A decoder- controlled selection mechanism directs each instruction to either the integer ALU or the floating-point ALU, and a result multiplexer returns the selected result to the write- back path. Data forwarding and pipeline stalling are used for hazard handling. The design is described in Verilog HDL, simulated with Cadence Xcelium and SimVision, and synthesised with Cadence Genus. The synthesised top module, riscv_top, maps to 309 standard cells with a total cell area of 5541.782 (library units) and a reported total leakage power of 214.615 nW. The simulation waveforms show sequential program-counter operation, pipeline- register transfers and a stall signal with the floating-point path enabled and disabled. A power saving relative to an always-on FPU is not claimed, because no baseline comparison was performed.

Keywords: RISC-V, RV32I, RV32F, floating-point ALU, five-stage pipeline, Verilog HDL, Cadence Genus, low-power design.

  1. INTRODUCTION

    Efficient computation is central to digital signal processing, machine learning, embedded control and real-time systems. These applications mix integer and floating-point operations. Floating-point arithmetic needs exponent alignment, significand operations, normalisation and rounding, so it is more complex and power-hungry than integer arithmetic [1]. If the FPU stays active when only integer instructions are executing, power and hardware resources are wasted.

    RISC-V is an open, modular instruction set architecture (ISA) that began at the University of California, Berkeley, and

    allows designers to add only the extensions they need [3], [4]. The base integer set RV32I can be combined with the single- precision floating-point extension RV32F. Pipelining raises instruction throughput by overlapping the execution of several instructions [2].

    This work combines these ideas in a 32-bit RISC-V processor with a five-stage pipeline and a switchable floating-point ALU. Here, switchable means that the decoded instruction selects the execution unit to be used; it does not mean the processor changes its word size. The objectives are to design the processor in Verilog HDL, implement the five-stage pipeline, develop an integer ALU and a floating-point ALU, implement a control-based mechanism that selects between them, and verify the design by simulation and synthesis reports.

  2. LITERATURE REVIEW

    Goldberg [1] gives the theoretical basis of IEEE 754 floating- point arithmetic, including rounding and error analysis, but notes that compliant FPUs cost area, delay and power. Hennessy and Patterson [2] cover pipelining, hazards and instruction-level parallelism in general terms, without RISC-V or FPGA specifics. Waterman [3] and Patterson and Asanovi

    1. describe the RISC-V ISA and its modular, open design, while Poli et al. [5] show that a RISC-V processor can be synthesised and tested on an FPGA, though mainly with integer support and limited hazard handling.

      Earlier RISC processors include a 32-bit MIPS-based design [6], a 32-bit multiplication and division ALU [7], and a comparison of 16-bit and 32-bit RISC processors [8]. Mala et al. [9] designed a 32-bit ALU with Cadence tools, and Samanth et al. [10] a 32-bit functional unit; both address individual blocks rather than a complete pipelined processor. Soundari et al. [11] targeted Network-on-Chip communication, and Kourav and Shah [12] built a 64-bit ALU on FPGA, noting the area and power cost of a wider datapath and the lack of switching between operation types. Sathish et al. [13] study clock gating in RISC-V microarchitectures to reduce power, at the price of added control complexity.

      Across these works, the common gaps are the absence of floating-point support, limited discussion of pipeline hazards, and no mechanism to select between integer and floating-point execution units. This paper addresses these gaps.

  3. PROPOSED SYSTEM

    1. Architecture Overview

      The processor is organised into an instruction flow path, a data path and a control path. The instruction flow path contains the program counter, address generation, program memory and the 32-bit instruction fetch. The data path contains the register bank and the ALUs. The control path generates the mode-select and write-enable signals that coordinate operation and choose the execution unit. External inputs are the clock, control inputs p0 and p1, and data.

    2. Instruction Set Support

      The design combines RV32I with the RV32F subset. RV32I provides 32 general-purpose 32-bit registers (x0 hard-wired to zero), a load-store architecture and fixed 32-bit instruction formats (R, I, S, B, U and J types). RV32F adds single- precision operations such as FADD.S, FMUL.S and FDIV.S. In the IEEE 754 binary32 format a value has one sign bit, eight exponent bits (bias 127) and 23 fraction bits.

    3. Five-Stage Pipeline

        • Instruction Fetch (IF): the program counter addresses the instruction memory and is updated to the next address or a branch/jump target.

        • Instruction Decode (ID): the control unit decodes the opcode and function fields, reads source operands and generates immediates and control signals.

        • Execute (EX): the selected ALU performs the operation; branch targets and effective addresses are also computed.

        • Memory Access (MEM): load and store instructions access data memory; other results pass through.

        • Write Back (WB): the result is written to the destination register when write enable is asserted.

      Pipeline registers (IF/ID, ID/EX, EX/MEM and MEM/WB) hold data and control information between stages.

      Fig. 1: Five-stage RISC-V pipeline architecture

    4. Switchable ALU Mechanism

      During decode, the control unit identifies the instruction class. Integer instructions (for example ADD, SUB, AND, OR, XOR and comparisons) select the integer ALU. Floating-point instructions (FADD.S, FMUL.S, FDIV.S) select the floating- point unit. A multiplexer then chooses the valid result for the write-back path, and the destination register and write enable are set consistently with the instruction class. Because a

      floating-point operation may need more cycles than an integer one, the pipeline control must stall or otherwise track completion so that a depenent instruction never reads an unavailable result. A state-based control concept is also used for precision selection (single or half precision), execution, result storage and error handling, after which the unit returns to idle.

      Fig. 2: Floating-point precision selection and execution control concept

      The ALU selection and result multiplexing are visible in the RTL structure of the 32-bit ALU (Fig. 3). Comparison, logic and arithmetic blocks feed a result multiplexer controlled by the operation select input, and the same structure is reused for the 16-bit block identified in the reference design.

      Fig. 3: RTL structure of the 32-bit ALU

    5. Hazard Handling

    Read-after-write data hazards are reduced by forwarding, which passes a result directly from a later stage to an earlier stage that needs it. When forwarding cannot supply the value in time, stalling inserts a bubble until the operand is available. Control hazards arise at branches and jumps, and structural hazards arise when two operations need the same resource. Register renaming is not part of this design.

    Fig. 4 shows the timing of dependent instructions in the pipeline: the result of the first instruction is needed by the following instructions before it is written back, which forwarding or a stall must resolve.

    Fig. 4: Pipeline timing for dependent instructions

  4. METHODOLOGY AND IMPLEMENTATION

    The design flow starts with the RV32I and RV32F requirements, then defines the block diagram and data path, the five pipeline stages, the integer and floating-point execution blocks, the instruction-based selection logic, and the

    hazard-handling requirements. Each module (program counter, instruction memory, decode and control, register bank, integer ALU, floating-point unit, result multiplexer, data memory interface and pipeline registers) is written separately in Verilog HDL and integrated in a top-level module, riscv_top.

    The tools used are Xilinx 14.7 and Cadence NC Launch/Xcelium for compilation and simulation, SimVision for waveform inspection, and Cadence Genus for RTL synthesis. After the design and testbench are compiled and run, the waveforms are inspected, and the synthesis area, gate and power reports are used to evaluate hardware cost.

    The overall methodology, from requirement analysis to performance analysis, is summarised in Fig. 5.

    Fig. 5: Flow chart of the design methodology

    4.1 Inputs and Outputs

    The processor is driven by a clock (clk), a reset (rst), the program loaded in instruction memory, and a floating-point enable control (dbg_fp_enable). The observed outputs are the debug signals that expose each pipeline stage. Table 1 lists the signals used in the simulations.

    Table 1: Input and output signals

    Signal

    Type

    Description

    clk

    Input

    Clock; synchronises all operations

    rst

    Input

    Initialises the processor

    dbg_fp_enable

    Input

    1: floating-point ALU enabled; 0: disabled (integer mode)

    dbg_pc

    Output

    Program counter, increments by 4 per instruction

    dbg_instruction

    Output

    Instruction being executed

    dbg_if_id_instruction

    Output

    Instruction in the IF/ID stage

    dbg_id_ex_alu_result

    Output

    ALU result in the Execute stage

    ex_mem_alu_result

    Output

    Result passed to the Memory stage

    dbg_mem_wb_result

    Output

    Result passed to Write Back

    dbg_stall

    Output

    Pipeline stall indicator

  5. RESULTS AND DISCUSSION

    1. Simulation Results

      The processor was simulated and the waveforms were inspected in SimVision. The signals observed were the clock (clk), reset (rst), program counter (dbg_pc), instruction (dbg_instruction), IF/ID instruction (dbg_if_id_instruction), ID/EX ALU result (dbg_id_ex_alu_result), EX/MEM ALU result (ex_mem_alu_result), MEM/WB result (dbg_mem_wb_result), the stall indicator (dbg_stall) and the floating-point enable (dbg_fp_enable). With dbg_fp_enable = 1 the floating-point ALU is enabled; with dbg_fp_enable = 0 it is disabled and the processor executes integer instructions. In both cases the program counter increases by 4 for each instruction, showing sequential execution, and the pipeline- register signals show results moving through the stages. The dbg_stall signal indicates when the pipeline is paused by a hazard.

      Fig. 6 shows the waveform with the floating-point ALU enabled. Figs. 7 to 9 show the processor with the floating- point ALU disabled, executing integer instructions; the clock toggles continuously, reset releases after initialisation, and the program counter keeps incrementing by 4.

      Fig. 6: Simulation waveform with dbg_fp_enable = 1

      Fig. 7: Simulation waveform with dbg_fp_enable = 0

      Fig. 8: Simulation waveform in integer mode

      Fig. 9: Simulation waveform, integer instructions continue

    2. Synthesis Results

      The design was synthesised with Cadence Genus. The top module is riscv_top, with 14 modules in the hierarchy, 309 standard cells and 948 nets.

      Fig. 10: Synthesised schematic of riscv_top (Cadence Genus)

      Fig. 11: Synthesis area report

      Parameter

      Reported value

      Total cell count

      309

      Cell area

      5541.782

      Net area

      0.000

      Total area

      5541.782

      Logic cells (area share)

      92%

      Buffers (area share)

      7.7%

      Table 2: Synthesis area report

      Fig. 12: Synthesis gate report

    3. Power Results

      Fig. 13 shows the power details report generated by Genus, and Table 3 lists the reported totals.

      Fig. 13: Synthesis power report

      Table 3: Synthesis power report

      Power component

      Reported value

      Leakage power

      214.615 nW

      Internal power

      118724.664 nW

      Net power

      96185.914 nW

      Switching power

      214910.578 nW

    4. Discussion

    The results show that the processor with an integer/floating- point selection path can be simulated and synthesised to a compact netlist. Several limits should be noted. The reported power figures describe a single synthesised configuration, so they do not show how much power is saved by disabling the floating-point path. A saving of that kind would have to be measured against a design in which the FPU is always active, and it depends on the RTL, clocking strategy and technology. Likewise, maximum clock frequency and FPGA resource use (LUTs, DSP blocks) are evaluation goals but are not reported here.

    The mapped cells include AND, AOI, MUX, NAND, NOR, inverter and buffer types.

  6. CONCLUSION

    A 32-bit RISC-V processor with a five-stage pipeline and a switchable floating-point ALU has been designed in Verilog HDL. The decoder-controlled selection of the integer or floating-point execution unit supports both integer and floating-point arithmetic, and simulation and synthesis results show sequential operation and give the area and power of the synthesised design.

    REFERENCES

    1. D. Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic, ACM Computing Surveys, vol. 23, no. 1, pp. 548, Mar. 1991.

    2. J. L. Hennessy and D. A. Patterson, Computer Architecture: A Quantitative Approach, 6th ed. Morgan Kaufmann, 2017.

    3. A. Waterman, Design of the RISC-V Instruction Set Architecture, Ph.D. dissertation, University of California, Berkeley, 2016.

    4. D. A. Patterson and K. Asanovi, The RISC-V Instruction Set Manual, Volume I: Base User-Level ISA, Tech. Rep. UCB/EECS-2011-62, University of California, Berkeley, 2011.

    5. L. Poli, S. Saha, X. Zhai, and K. D. McDonald-Maier, Design and Implementation of a RISC-V Processor on FPGA, in Proc. 17th Int. Conf. Mobility, Sensing and Networking (MSN), 2021, pp. 161166. doi: 10.1109/MSN53354.2021.00037.

    6. S. Patra, S. B. Kumar, S. Verma, and A. S. S. Kumar, Design and Implementation of 32-bit MIPS-Based RISC Processor, Lecture Notes in Electrical Engineering, vol. 587, pp. 747757, 2020. doi: 10.1007/978-981-32-9775-3_68.

    7. K. Yi and Y. Ding, 32-bit Multiplication and Division ALU Design Based on RISC Structure, in Proc. First IITA Int. Joint Conf. Artificial Intelligence, Hainan Island, China, Apr. 2009. doi: 10.1109/JCAI.2009.159.

    8. A. Kulshreshtha, A. Moudgil, A. Chaurasia, and B. Bhushan, Analysis of 16-Bit and 32-Bit RISC Processors, in Proc. 7th Int. Conf. Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 2021, pp. 13181324. doi: 10.1109/ICACCS51430.2021.9441873.

    9. S. Mala, C. Reddy, G. M. L., M. K. N. M., and M. S. B., Design of a 32- Bit ALU Using Cadence Tools, in Proc. 4th Int. Conf. Mobile Networks and Wireless Communications (ICMNWC), Tumakuru, India, 2024.

    10. R. Samanth, A. Amin, and S. G. Nayak, Design and Implementation of 32-bit Functional Unit for RISC Architecture Applications, in Proc. 5th Int. Conf. Devices, Circuits and Systems (ICDCS), 2020, pp. 4648. doi: 10.1109/ICDCS48716.2020.243545.

    11. D. V. Soundari, M. K. Shanker Ganesh, I. Raman, and R. Karthick, Enhancing Network-on-Chip Performance by 32-bit RISC Processor Based on Power and Area Efficiency, Materials Today: Proceedings, vol. 45, part 2, pp. 27132720, 2021. doi: 10.1016/j.matpr.2020.11.550.

    12. S. Kourav and S. Shah, Design and Implementation of 64-Bit Arithmetic Logic Unit on FPGA Using VHDL, International Journal of Algorithms Design and Analysis.

    13. K. Sathish, R. Kumar, and M. Prasad, Clock-Gating Techniques for Power Optimization in RISC-V Microarchitectures, in Proc. IEEE Int. Conf. VLSI Design, 2022.

    14. Dr. Ravi L S, Dr. Vishwanath B R, Somashekar L A, Keerthana Y U, Shashanka M R, Chandana A R, 2026, Plant Disease Prediction System using Raspberry PI and Image Processing, INTERNATIONAL JOURNAL OF ENGINEERING RESEARCH & TECHNOLOGY (IJERT) Volume 15, Issue 05 , May 2026.

    15. Ravi L.S Sushma C,Harsha H L, T Kavya Flame detection using image processing techniques IJERT proceedings on National Conference on Communication and Data Science, GSSSIETW, on July 2020.