ucb-bar / berkeley-hardfloat

Other
287 stars 87 forks source link

port test from makefile to Scalatest #51

Closed sequencer closed 4 years ago

sequencer commented 4 years ago

This PR gives a standard scalatest based test infrastructure for CI to replace original Makefile. With this PR, chisel generator codes and chisel test generator codes can be clearly separated. This PR is depend on #53

Although hardfloat runs perfectly without any bug during these years, it also need a CI to check contributor's PR, after this PR, it's more easy to invoke test by CI and add more test. After porting makefile to Scalatest, in my next PRs, I'll add a formal test with yosys to make tests of hardfloat more impeccable.

code changes

commit https://github.com/ucb-bar/berkeley-hardfloat/pull/51/commits/40a116c remove the redefine warning by GCC. It won't affect function but remove the GCC complains:

Before this patch:

hardfloat/target/scala-2.12/test-classes/includes/DivSqrtRecF64_div.h:4: warning: "ROUNDING_MODE" redefined
    4 | #define ROUNDING_MODE io_input_bits_roundingMode
      |
In file included from hardfloat/target/scala-2.12/test-classes/includes/DivSqrtRecF64_div.h:2,
                 from <command-line>:
hardfloat/target/scala-2.12/test-classes/includes/DivSqrtRecFN_div.h:4: note: this is the location of the previous definition
    4 | #define ROUNDING_MODE io_roundingMode
      | ardfloat.test.DivSqrtRecF64Spec 7s
In file included from <command-line>:
hardfloat/target/scala-2.12/test-classes/includes/DivSqrtRecF64_div.h:5: warning: "DETECT_TININESS" redefined
    5 | #define DETECT_TININESS io_input_bits_detectTininess
      |
In file included from hardfloat/target/scala-2.12/test-classes/includes/DivSqrtRecF64_div.h:2,
                 from <command-line>:
hardfloat/target/scala-2.12/test-classes/includes/DivSqrtRecFN_div.h:8: note: this is the location of the previous definition
    8 | #define DETECT_TININESS io_detectTininess
      |

benchmark

On the server:

CPU: Intel Xeon E5-2687W v4 @ 48x 3.5GHz [56.0°C]
RAM: 57017MiB / 515901MiB

After finish targe testfloat_gen and scala compiling, then run make Before this change: 65 seconds. After this change: 71 seconds.

Previously a fat jar is compiled by sbt assembly, multiple JVM was invoked to elaborate designs. scheduler is make. After this PR, only one JVM will be executed, and elaborate designs in a same time. scheduler is scalatest on jvm. scalatest is slight slower than make, I think it won't affect too much.