Berkeley HardFloat is a free, high-quality Verilog encoding of digital hardware modules for binary floating-point arithmetic. HardFloat fully conforms to the IEEE Standard for Floating-Point Arithmetic, supporting all required rounding modes, exception flags, and special values, including subnormals. These operations are implemented:
A wide range of floating-point sizes is supported, with modules taking
parameters that independently determine the widths of the exponent and
The set of possible formats includes the standard IEEE ones of
HardFloat converts IEEE-format floating-point inputs into a more convenient recoded format for its arithmetic operations. However, the results computed by HardFloat modules are always the exact values dictated by the IEEE Standard, just represented in the recoded format. Computed results can be converted back to a standard IEEE format at any time.
HardFloat is written for the 2001 standard for Verilog.
Different floating-point specializations are provided to customize the
arithmetic appropriately for Intel x86, Arm, or
Berkeley HardFloat is currently in its inaugural release,
The following archive contains all source code and documentation for
The HardFloat package includes testbenches that require either a Verilog simulator or Verilator. A Verilog simulator that may be used is Icarus Verilog:
|Icarus Verilog is a free Verilog simulator supporting the 2005 Verilog Standard.|
|Verilator is a free tool that converts a subset of Verilog or SystemVerilog into equivalent C++ code.|
HardFloat’s simulation testbenches depend on the
testfloat_gen program from Berkeley TestFloat.
TestFloat in turn depends on Berkeley SoftFloat.
To perform these tests, the SoftFloat and TestFloat packages must be obtained
and built separately:
|Berkeley SoftFloat is a free software implementation of binary floating-point that conforms to the IEEE Standard for Floating-Point Arithmetic.|
|Berkeley TestFloat is a small collection of programs for testing that an implementation of binary floating-point conforms to the IEEE Standard for Floating-Point Arithmetic.|
Berkeley HardFloat was written by me, John R. Hauser. Funding for the development of HardFloat was provided indirectly by portions of grants to the University of California, Berkeley, from Microsoft, Intel, DARPA, Nokia, NVIDIA, Oracle, Samsung, Google, Futurewei, Seagate, Siemens, and SK Hynix, and by a portion of a U.C. Discovery Grant. The HardFloat documentation has more details.
Bugs in HardFloat and other comments can be reported to me at