Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

32-bit Floating Point ALU (IEEE-754) – Verilog Implementation

Project Overview

This project implements a 32-bit Floating Point Arithmetic Logic Unit (FP-ALU) using Verilog HDL, compliant with the IEEE-754 single-precision format. The design supports core arithmetic operations including:

  • Addition
  • Multiplication
  • Division

The architecture is modular, synthesizable, and verified using a self-checking testbench.


Architecture

Top Module: fp_alu_top

The top-level module integrates three independent floating-point units:

  • fp_adder
  • fp_multiplier
  • fp_divider

All units operate in parallel, and a multiplexer selects the output based on the operation code.

Operation Encoding:

op_code Operation
00 Addition
01 Multiplication
10 Division

Module Descriptions

1. Floating Point Adder (fp_adder)

  • FSM-based multi-cycle design

  • Stages:

    • Operand alignment
    • Addition/Subtraction
    • Normalization
  • Handles:

    • NaN
    • Infinity
    • Zero
  • Limitations:

    • No rounding logic
    • Incomplete normalization for subtraction

2. Floating Point Multiplier (fp_multiplier)

  • 3-stage FSM design:

    • Initialization
    • Mantissa multiplication
    • Normalization
  • Uses 24×24-bit multiplication

  • Handles special cases:

    • NaN
    • Infinity × Zero
  • Limitations:

    • No rounding (truncation used)
    • No denormal handling

3. Floating Point Divider (fp_divider)

  • Multi-cycle FSM with restoring division

  • Performs iterative mantissa division (24 cycles)

  • Handles:

    • Divide-by-zero
    • NaN
    • Infinity
  • Limitations:

    • Incomplete normalization
    • No rounding support
    • Denormals not supported

Data Flow

  1. Inputs (op_a, op_b) are fed to all units in parallel
  2. Each unit computes independently
  3. Output is selected using op_code
  4. Results are registered for timing stability

Exception Flags

Bit Description
0 Invalid Operation
1 Divide by Zero
2 Overflow
3 Underflow
4 Inexact

Testbench (fp_alu_top_tb)

Features:

  • Self-checking testbench
  • Task-based stimulus generation
  • Automatic PASS/FAIL reporting
  • Waveform dumping (VCD)

Test Coverage:

  • Basic arithmetic operations
  • Zero handling
  • Infinity operations
  • NaN propagation
  • Overflow conditions
  • Sign combinations

Timing Constraints

SDC constraint used:

create_clock -period 10.000 -name clk -waveform {0 5} [get_ports clk]
  • Clock frequency: 100 MHz
  • Duty cycle: 50%

Tools Used

  • Verilog HDL
  • AMD Vivado (Simulation & Synthesis)

Design Characteristics

Feature Description
Data Width 32-bit IEEE-754
Architecture Modular FSM-based
Execution Type Multi-cycle
Parallel Units Yes
Output Register Yes

Applications

  • DSP systems
  • Scientific computation
  • Embedded processors
  • Hardware accelerators

Conclusion

This project demonstrates a modular and scalable floating-point ALU design using Verilog, covering key arithmetic operations with FSM-based control. While functionally correct for most standard cases, further enhancements are required for full IEEE-754 compliance and high-performance applications.


About

Design and implementation of an IEEE-754 single-precision Floating-Point ALU using Verilog HDL

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages