1 |
11 |
bro |
OpenFPU64
|
2 |
|
|
============================
|
3 |
|
|
Peter Hüwe
|
4 |
|
|
V.0.1, Januar 2009, License: CC-by-sa
|
5 |
|
|
:author initials: PH
|
6 |
|
|
:email: peterhuewe@gmx.d
|
7 |
|
|
:license: CC-by-sa
|
8 |
2 |
bro |
|
9 |
11 |
bro |
About OpenFPU64
|
10 |
|
|
---------------
|
11 |
|
|
OpenFPU64 is a free and open source implementation of a double precision floating point unit.
|
12 |
|
|
|
13 |
|
|
The openFPU64 currently features:
|
14 |
|
|
* double precision
|
15 |
|
|
* Addition/Subtraction
|
16 |
|
|
* Multiplication
|
17 |
|
|
* rounding (to nearest even)
|
18 |
|
|
* subnormals/denormals
|
19 |
|
|
* validated against IEEE754 using TestFloat (http://www.jhauser.us/arithmetic/TestFloat.html)
|
20 |
|
|
* Compatible with Avalon Bus
|
21 |
|
|
* Wishbone interface will be provided soon
|
22 |
|
|
|
23 |
|
|
The openFPU is tested with a Cyclone II and a CycloneIII fpga.
|
24 |
|
|
|
25 |
|
|
Usage in QuartusII SOPC (tm)
|
26 |
|
|
----------------------------
|
27 |
|
|
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.
|
28 |
|
|
(alternative: 'make quartus_distribution' and copy everything in openfpu64_quartus/ to the root directory of your Quartus II project)
|
29 |
|
|
|
30 |
|
|
Then open the QuartusII and from Quartus launch the SOPC Builder.
|
31 |
|
|
|
32 |
|
|
In SOPC Builder click new component in the left pane and select
|
33 |
|
|
File -> open and open the openfpu64_hw.tcl file.
|
34 |
|
|
|
35 |
|
|
By clicking on finish, the openFPU64 is added to your library.
|
36 |
|
|
|
37 |
|
|
Now add openFPU64 to your SOPC-design by double clicking on it, click Generate as usual.
|
38 |
|
|
In some rare cases your have to assign new Base and End Adresses,
|
39 |
|
|
clicking "System->Auto-Assign Base Adresses" does resolve this.
|
40 |
|
|
|
41 |
|
|
Now click Generate as usual, close SOPC Builder afterwards and compile your design as usual using Quartus.
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
Driver/Libary in NiosII:
|
46 |
|
|
------------------------
|
47 |
|
|
add the openfpu64.c and openfpu64.h files (in nios-driver)to your NiosII Project.
|
48 |
|
|
To use this library/driver, add the fpu.[ch] files to your application
|
49 |
|
|
and add these linker flags.
|
50 |
|
|
Click right on your application, choose properties, C/C++ Build
|
51 |
|
|
-> Linker -> General and type
|
52 |
|
|
"-Wl,--wrap,__adddf3,--wrap,__subdf3,--wrap,__muldf3"
|
53 |
|
|
For each implemented function, add another --wrap,__functioname
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
Development:
|
58 |
|
|
------------
|
59 |
|
|
If you'd like to do some development on openFPU64, you can use the Makefile together with GHDL (http://ghdl.free.fr/)
|
60 |
|
|
|
61 |
|
|
You can create several different testbenches by issuing one of these commands:
|
62 |
|
|
* empty_testsuite
|
63 |
|
|
* addsub_testsuite
|
64 |
|
|
* custom_testsuite
|
65 |
|
|
* add_testsuite
|
66 |
|
|
* sub_testsuite
|
67 |
|
|
* mul_testsuite
|
68 |
|
|
|
69 |
|
|
The custom_testsuite contains several hand crafted testsuites for ADD/SUB/MUL, the others are quite big (45k,95k testcases) and generated using TestFloat.
|
70 |
|
|
|
71 |
|
|
The testbench is made up of openfpu64_tb.head.vhd, openfpu64_tb.tail.vhd and the testscases in tests/.
|
72 |
|
|
|
73 |
|
|
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.
|
74 |
|
|
|
75 |
|
|
The empty testsuite is for 'resetting' the openfpu64_tb to be committed to svn.
|
76 |
|
|
Please use make empty_testsuite before checking your sources in.
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
Note:
|
81 |
|
|
-----
|
82 |
|
|
QuartusII, Nios, Cyclone, QuartusII SOPC Builders are registered Trademarks of Altera Corporation, 101 Innovation Drive, San Jose, California 95134, USA. All rights reserved.
|
83 |
|
|
|
84 |
2 |
bro |
Meanwhile, for questions contact me at peterhuewe@gmx.de and I'm glad to help you out
|