mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-02 09:45:18 +00:00
Combine floating point test documentation
This commit is contained in:
parent
6d21e272d0
commit
9363379b55
@ -1,56 +0,0 @@
|
||||
Procedure for Runnning SoftFloat/TestFloat with Wally
|
||||
|
||||
1.) First, compile SoftFloat and TestFloat by going to the addins
|
||||
directory and finding the specific build directory (e.g.,
|
||||
Linux_x86_64-GCC. Currently, we are using v3e of
|
||||
SoftFloat/TestFloat. I am not sure of the order, but I always compile
|
||||
SoftFloat first as I believe TestFloat uses the static library
|
||||
SoftFloat creates.
|
||||
|
||||
2.) Once compiled both, go to the tests/fp directory and run the
|
||||
create_vectors.sh Linux script. In the past, we have automated this,
|
||||
but I believe this has fallen into more of a manual state lately.
|
||||
|
||||
3.) Then, run remove_spaces.sh which will remove spaces from the
|
||||
output and put underscores between vectors (this helps differentiate
|
||||
the vectors that are generated). Again, this can be combined with
|
||||
Step 2.
|
||||
|
||||
4.) TestFloat is run from wally/cvw/sim and sim-testfloat-batch with
|
||||
its respective test. The format is ./sim-testfloat-add add. All of
|
||||
the tests are listed below. This can be augmented or added to for
|
||||
other FP tests given by the great SoftFloat/TestFloat output.
|
||||
|
||||
cvtint - test integer conversion unit (fcvtint)
|
||||
cvtfp - test floating-point conversion unit (fcvtfp)
|
||||
cmp - test comparison unit's LT, LE, EQ opperations (fcmp)
|
||||
add - test addition
|
||||
fma - test fma
|
||||
mul - test mult with fma
|
||||
sub - test subtraction
|
||||
div - test division
|
||||
sqrt - test square root
|
||||
all - test everything
|
||||
|
||||
4a.) Each test will test all its vectors - if you want to test a
|
||||
subset of the vectors (e.g., only binary16), you should modify the
|
||||
testfloat.do in the sim directory. Change the TEST_SIZE="all" to the
|
||||
specific test you want to run. For example, if you want to run only
|
||||
binary16, you should set this variable to TEST_SIZE="HP".
|
||||
|
||||
4b.) If you want to turn off the generation of wlf files while running
|
||||
sim-testfloat-batch, you can modify testfloat.do in the sim
|
||||
directory. Inside this DO file, modify the WAV file to 0 --> i.e.,
|
||||
set "quietly set WAV 0;"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,27 +1,58 @@
|
||||
james.stine@okstate.edu 14 Jan 2022
|
||||
jcarlin@hmc.edu Sept 2024
|
||||
|
||||
These are the testvectors (TV) to test the floating-point unit using
|
||||
Berkeley TestFloat written originally by John Hauser. TestFloat
|
||||
requires both TestFloat and SoftFloat.
|
||||
## TestFloat for CVW
|
||||
|
||||
The locations of these tools at time of this README is found here:
|
||||
TestFloat-3e: http://www.jhauser.us/arithmetic/TestFloat.html
|
||||
SoftFloat-3e: http://www.jhauser.us/arithmetic/SoftFloat.html
|
||||
The CVW floating point unit is tested using testvectors from the Berkeley TestFloat suite, written originally by John Hauser.
|
||||
|
||||
These tools have been compiled on a x86_64 environment by going into
|
||||
their respective build/Linux-x86_64-GCC directories and running make.
|
||||
TestFloat and SoftFloat can be found as submodules in the addins directory, and are linked here:
|
||||
- TestFloat: https://github.com/ucb-bar/berkeley-testfloat-3
|
||||
- SoftFloat: https://github.com/ucb-bar/berkeley-softfloat-3
|
||||
|
||||
The makefile in the vectors subdirectory of this directory will generate TV
|
||||
for each rounding mode and operation. It also puts an underscore between each
|
||||
vector instead of a space to allow SystemVerilog readmemh to read correctly.
|
||||
### Compiling SoftFloat/TestFloat and Generating Testvectors
|
||||
|
||||
The makefile at the top level of this directory will compile SoftFloat and
|
||||
TestFloat and then generate all of the TVs. It also generates TVs for the
|
||||
combined integer floating-point divider.
|
||||
The entire testvector generation process can be performed by running make in this directory.
|
||||
|
||||
Although not needed, a case.sh script is included to change the case
|
||||
of the hex output. This is for those that do not like to see
|
||||
hexadecimal capitalized :P.
|
||||
```bash
|
||||
make --jobs
|
||||
```
|
||||
|
||||
This compiles SoftFloat for an x86_64 environment in its build/Linux-x86_64-GCC directory using the `SPECIALIZE_TYPE=RISCV` flag to get RISC-V behavior. TestFloat is then compiled in its build/Linux-x86_64-GCC directory using this SoftFloat library.
|
||||
|
||||
The Makefile in the vectors subdirectory of this directory is then called to generate testvectors for each rounding mode and operation. It also puts an underscore between each vector instead of a space to allow SystemVerilog `$readmemh` to read correctly.
|
||||
|
||||
Testvectors for the combined integer floating-point divider are also generated.
|
||||
|
||||
Although not needed, a `case.sh` script is included to change the case of the hex output. This is for those that do not like to see hexadecimal capitalized :P.
|
||||
|
||||
### Running TestFloat Vectors on Wally
|
||||
|
||||
TestFloat is run using the standard Wally simulation commands.
|
||||
|
||||
To run all TestFloat tests on many different derived configurations of Wally, use
|
||||
```bash
|
||||
regression-wally --testfloat
|
||||
```
|
||||
|
||||
To run a single test, use
|
||||
```bash
|
||||
wsim <config> <test> --tb testbench_fp
|
||||
```
|
||||
The choices for `<test>` are as follows:
|
||||
|
||||
>cvtint - test integer conversion unit (fcvtint)
|
||||
cvtfp - test floating-point conversion unit (fcvtfp)
|
||||
cmp - test comparison unit's LT, LE, EQ opperations (fcmp)
|
||||
add - test addition
|
||||
fma - test fma
|
||||
mul - test mult with fma
|
||||
sub - test subtraction
|
||||
div - test division
|
||||
sqrt - test square root
|
||||
|
||||
Any config that includes floating point support can be used. Each test will test all its vectors for all precisions supported by the given config.
|
||||
|
||||
### Testvector Count
|
||||
|
||||
46464 185856 836352 f16_add_rd.tv
|
||||
46464 185856 836352 f16_add_rne.tv
|
||||
|
Loading…
Reference in New Issue
Block a user