openpower-cores / a2i

Other
244 stars 37 forks source link

Setup GitHub Actions to ensure VHDL correctness of all code updates #40

Closed LarsAsplund closed 3 years ago

LarsAsplund commented 3 years ago

The purpose of this PR is to address some of the previously discussed issues related to code correctness. For example #1, #2, and #8. This is done by setting up a GitHub Action (GHA) to verify that the code can be compiled and, if VHDL testbenches are added to the project, that all tests pass before new code is merged.

The PR has 4 commits. The details for these commits are in their descriptions but the short story is

  1. GHDL is used for compilation and this issue fixes some syntactical issues that GHDL found. GHDL is rather strict when it comes to following the VHDL standard. That's a good property for a project like this since it increases the change of the code working with many simulators.
  2. The project use UNIMACRO for which there is no VHDL code which prevents the code from compiling with GHDL. This commit creates VHDL mocks for these macros to workaround the problem
  3. Creates a VUnit run script that automates the process of dependency scanning, code compilation, test execution, and result reporting. Now that there are no testbenches it will report a pass as long as the code compiles correctly.
  4. Setup of GHA to run VUnit/GHDL on every push and PR and report pass/fail status.

For this to work you will probably have to enable GHA in the settings first. You can have a look at my fork to see what a GHA run looks like: https://github.com/LarsAsplund/a2i/runs/2250157508?check_suite_focus=true#step:5:662

openpowerwtf commented 3 years ago

Thanks! I am looking at integrating your changes. I haven't tried GHDL yet. It's unfortunate we don't have standard compilers yet. The unit tests look like a great addition!

LarsAsplund commented 3 years ago

GHDL does well when compared to other commercial tools. I also compiled the project with Modelsim and it passed without changing the recursive_synthesis. However, in this case I think GHDL is correct to consider the current use to be illegal VHDL.

There are discussions in the community about having a standard implementation of each new VHDL feature. GHDL is the best bet for becoming that standard implementation.

LarsAsplund commented 3 years ago

Reopened because I mixed up this PR with one in another project. Sorry! Please go ahead and review and merge.

LarsAsplund commented 3 years ago

@openpowerwtf Need any help with this PR?