OpenFPU64
|
OpenFPU64
|
============================
|
============================
|
Peter Hüwe
|
Peter Hüwe
|
V.0.1, Januar 2009, License: CC-by-sa
|
V.0.1, Januar 2009, License: CC-by-sa
|
:author initials: PH
|
:author initials: PH
|
:email: peterhuewe@gmx.d
|
:email: peterhuewe@gmx.de
|
:license: CC-by-sa
|
:license: CC-by-sa
|
|
|
About OpenFPU64
|
About OpenFPU64
|
---------------
|
---------------
|
OpenFPU64 is a free and open source implementation of a double precision floating point unit.
|
OpenFPU64 is a free and open source implementation of a double precision floating point unit.
|
|
|
The openFPU64 currently features:
|
The openFPU64 currently features:
|
* double precision
|
* double precision
|
* Addition/Subtraction
|
* Addition/Subtraction
|
* Multiplication
|
* Multiplication
|
* rounding (to nearest even)
|
* rounding (to nearest even)
|
* subnormals/denormals
|
* subnormals/denormals
|
* validated against IEEE754 using TestFloat (http://www.jhauser.us/arithmetic/TestFloat.html)
|
* validated against IEEE754 using TestFloat (http://www.jhauser.us/arithmetic/TestFloat.html)
|
* Compatible with Avalon Bus
|
* Compatible with Avalon Bus
|
* Wishbone interface will be provided soon
|
* Wishbone interface will be provided soon
|
|
|
The openFPU is tested with a Cyclone II and a CycloneIII fpga.
|
The openFPU64 is tested with a Cyclone II and a CycloneIII fpga.
|
|
|
|
|
|
Overview
|
|
--------
|
|
The openFPU64 consists of several parts:
|
|
* openfpu64.vhd - contains the bus logic for the avalon bus, instantiate your own algorithms here
|
|
* fpu_package.vhd - global constants and defines
|
|
* fpu_add.vhd - Add/Sub algorithms
|
|
* fpu_mul.vhd - Multiplication Algorithm with several embedded Multipliers
|
|
* fpu_mul_single.vhd - Multiplication Algorithm with only one embedded Multiplier (currently in development, has some bugs)
|
|
|
|
To use it in the NiosII environment you have to use the driver/library in
|
|
* nios-driver
|
|
|
|
The testbench needs also
|
|
* openfpu64_tb.vhd - Testframework, consists of openfpu64_tb.head.vhd, openfpu64_tb.tail.vhd and the actual testcases which reside in tests/ (untar tests.tar.bz2)
|
|
* eis_helpers.vhd - some nice conversion functions for std_logic_vectors, provided by Prof. Dr. Gundolf Kiefer.
|
|
|
|
|
Usage in QuartusII SOPC (tm)
|
Usage in QuartusII SOPC (tm)
|
----------------------------
|
----------------------------
|
In order to use openFPU64 copy all VHDL files (*.vhd) and the TCL file (openfpu64_hw.tcl) to the root directory of your QuartusII Project.
|
In order to use openFPU64 copy all VHDL files (*.vhd) and the TCL file (openfpu64_hw.tcl) to the root directory of your QuartusII Project.
|
(alternative: 'make quartus_distribution' and copy everything in openfpu64_quartus/ to the root directory of your Quartus II project)
|
(alternative: 'make quartus_distribution' and copy everything in openfpu64_quartus/ to the root directory of your Quartus II project)
|
|
|
Then open the QuartusII and from Quartus launch the SOPC Builder.
|
Then open the QuartusII and from Quartus launch the SOPC Builder.
|
|
|
In SOPC Builder click new component in the left pane and select
|
In SOPC Builder click new component in the left pane and select
|
File -> open and open the openfpu64_hw.tcl file.
|
File -> open and open the openfpu64_hw.tcl file.
|
|
|
By clicking on finish, the openFPU64 is added to your library.
|
By clicking on finish, the openFPU64 is added to your library.
|
|
|
Now add openFPU64 to your SOPC-design by double clicking on it, click Generate as usual.
|
Now add openFPU64 to your SOPC-design by double clicking on it, click Generate as usual.
|
In some rare cases your have to assign new Base and End Adresses,
|
In some rare cases your have to assign new Base and End Adresses,
|
clicking "System->Auto-Assign Base Adresses" does resolve this.
|
clicking "System->Auto-Assign Base Adresses" does resolve this.
|
|
|
Now click Generate as usual, close SOPC Builder afterwards and compile your design as usual using Quartus.
|
Now click Generate as usual, close SOPC Builder afterwards and compile your design as usual using Quartus.
|
|
|
|
|
|
|
Driver/Libary in NiosII:
|
Driver/Libary in NiosII:
|
------------------------
|
------------------------
|
add the openfpu64.c and openfpu64.h files (in nios-driver)to your NiosII Project.
|
add the openfpu64.c and openfpu64.h files (in nios-driver)to your NiosII Project.
|
To use this library/driver, add the fpu.[ch] files to your application
|
To use this library/driver, add the fpu.[ch] files to your application
|
and add these linker flags.
|
and add these linker flags.
|
Click right on your application, choose properties, C/C++ Build
|
Click right on your application, choose properties, C/C++ Build
|
-> Linker -> General and type
|
-> Linker -> General and type
|
"-Wl,--wrap,__adddf3,--wrap,__subdf3,--wrap,__muldf3"
|
"-Wl,--wrap,__adddf3,--wrap,__subdf3,--wrap,__muldf3"
|
For each implemented function, add another --wrap,__functioname
|
For each implemented function, add another --wrap,__functioname
|
|
|
|
|
|
|
Development:
|
Development:
|
------------
|
------------
|
If you'd like to do some development on openFPU64, you can use the Makefile together with GHDL (http://ghdl.free.fr/)
|
If you'd like to do some development on openFPU64, you can use the Makefile together with GHDL (http://ghdl.free.fr/)
|
|
|
You can create several different testbenches by issuing one of these commands:
|
You can create several different testbenches by issuing one of these commands:
|
* empty_testsuite
|
* empty_testsuite
|
* addsub_testsuite
|
* addsub_testsuite
|
* custom_testsuite
|
* custom_testsuite
|
* add_testsuite
|
* add_testsuite
|
* sub_testsuite
|
* sub_testsuite
|
* mul_testsuite
|
* mul_testsuite
|
|
|
The custom_testsuite contains several hand crafted testsuites for ADD/SUB/MUL, the others are quite big (45k,95k testcases) and generated using TestFloat.
|
The custom_testsuite contains several hand crafted testsuites for ADD/SUB/MUL, the others are quite big (45k,95k testcases) and generated using TestFloat.
|
|
|
The testbench is made up of openfpu64_tb.head.vhd, openfpu64_tb.tail.vhd and the testscases in tests/.
|
The testbench is made up of openfpu64_tb.head.vhd, openfpu64_tb.tail.vhd and the testscases in tests/.
|
|
|
If you want to change the testbench structure please DO NOT change openfpu64_tb.vhd but rather openfpu64_tb.head.vhd, otherwise your changes will be overwritten by make *_testsuite.
|
If you want to change the testbench structure please DO NOT change openfpu64_tb.vhd but rather openfpu64_tb.head.vhd, otherwise your changes will be overwritten by make *_testsuite.
|
|
|
The empty testsuite is for 'resetting' the openfpu64_tb to be committed to svn.
|
The empty testsuite is for 'resetting' the openfpu64_tb to be committed to svn.
|
Please use make empty_testsuite before checking your sources in.
|
Please use make empty_testsuite before checking your sources in.
|
|
|
|
|
|
|
Note:
|
Note:
|
-----
|
-----
|
QuartusII, Nios, Cyclone, QuartusII SOPC Builders are registered Trademarks of Altera Corporation, 101 Innovation Drive, San Jose, California 95134, USA. All rights reserved.
|
QuartusII, Nios, Cyclone, QuartusII SOPC Builders are registered Trademarks of Altera Corporation, 101 Innovation Drive, San Jose, California 95134, USA. All rights reserved.
|
|
|
|
|
|
|
|
Todo:
|
|
-----
|
|
Of course there is still a lot to do, e.g. adding more documentation.
|
Meanwhile, for questions contact me at peterhuewe@gmx.de and I'm glad to help you out
|
Meanwhile, for questions contact me at peterhuewe@gmx.de and I'm glad to help you out
|
|
|