Skip to content

Building VUnit's verification components and OSVVMLibraries at the same time #767

@umarcor

Description

@umarcor

This is an spin-off coming from #754. That issue is about using OSVVMLibraries in VUnit, after compiling them externally (using OSVVM's .pro files, GHDL's vendor scripts or any other solution). It also covers builting OSVVMLibraries in a run.py script, while disabling (not building) VUnit's verification components. This one is a complementary issue to discuss how to actually build VUnit's verification components and OSVVMLibraries at the same time.

#754 (comment)
@umarcor What happens if we have the latest OSVVM as a submodule and that is included with add_osvvm or add_verification_components and then just the rest are compiled manually. Wouldn't that work?

@LarsAsplund, that's an interesting question. Yes, it needs to work, meaning it is technically possible and not complex to achieve for someone experienced with both VUnit and OSVVM. However, it is not easy to understand for an arbitrary newcomer.

  • VUnit master is using OSVVM 2021.09, because I bumped it some days ago: d1956b0.
  • In OSVB, I am installing OSVVM using three different approaches:
    • GHDL's vendor scripts (bash).
    • OSVVM's .pro files (tclsh).
    • A VUnit run.py file (python).

OSVVM's .pro files and VUnit's run.py file can handle OSVVM 2021.09, but GHDL's vendor scripts were not updated yet, so they require OSVVM 2021.06 (see ghdl/ghdl#1900). Therefore, the default CI in OSVB is using OSVVM 2021.06 at the moment: https://github.com/umarcor/osvb/tree/main/mods. In that context, mixing VUnit's OSVVM core (2021.09) with the submoduled OSVVMLibraries (2021.06) is likely to crash. Hence, I had to do several modifications:

  • Ensure that the checked out version of OSVVMLibraries is matching the version of OSVVM submoduled in VUnit. There is no programmatic procedure to achieve it. The user needs to read VUnit's changelog to find it out. It is possible to know the commit sha of the OSVVM core that VUnit is using, but that belongs to a submodule of OSVVMLibraries. I'm not sure you can find the commit in the "parent" that matches a bump of the "child". Therefore, it's mainly a manual step.
  • Do not use GHDL's vendor scripts.
  • Update the run.py script to add VU.add_verification_components() and not to add lib OSVVM manually.

This is the set of changes compared to the previous test: https://github.com/umarcor/osvb/compare/bump-osvvm?expand=1

The CI result is the same using this approach or the previous one.


As of today, the maintenance and usage burden is as follows:

  1. We need to bump vunit/vhdl/osvvm and keep _add_osvvm() in sync with the exceptions (*_Aldec.vhd, *_c.vhd) in OSVVM.
  2. We need to communicate which version of OSVVMLibraries do users need to download, in order to combine it with VUnit's OSVVM.
  3. We need to provide an snippet such as https://github.com/umarcor/osvb/blob/94c13835db33f20893661cc627c94f1728197f77/AXI4Stream/test/osvvm/run.py and keep it in sync with the exceptions in the version of OSVVMLibraries matching VUnit's OSVVM.

We can do better, in the sense of reducing our maintenance effort, and making it easier for users to consume VUnit and OSVVMLibraries together.

Option 1: let VUnit submodule OSVVMLibraries instead of OSVVM (avoiding 2). We can keep building OSVVMLibraries/osvvm alone in _add_osvvm() and maybe provide an additional _add_osvvm_libraries() (which would avoid 3). The advantage of this approach is the ease of transition from the current codebase (just change the submodule and add a function to VUnit's API). It would also make the VUnit-OSVVM collaboration very explicit. However, the disadvantage is scalability: we cannot follow this approach with all third-party projects, nor recommend it as a general solution for companies to extend VUnit with their own libraries.

Option 2: let VUnit check if library OSVVM was declared/added before executing add_verification_components. Users might use different approaches to actually install OSVVM:

Then, add_verification_components would be executed, which would not build the internal OSVVM, because it can see that the library name exists (either regular or external). The main advantage of this approach is that users can install any version of OSVVM they want; they can reuse a pre-compiled version, or they can build it per-script (as it is usual for VUnit's builtins). The main disadvantage is the same: users can install any version of OSVVM, which might not be compatible. However, I don't think this is critical, because VUnit does not have any strong dependency on any weird API feature of OSVVM; i.e. almost any OSVVM version should be valid for the random features required in VUnit.

From a technical point of view, the content of the run.py in Option 2 would be the same as the content of _add_osvvm() and _add_osvvm_libraries() in Option 1. That means we can have Option 2 implemented as a VUnit example. That would keep the snippet close to the VUnit repo, but not part of vunit_hdl codebase.

Option 3: the same as Option 2, but keeping the run.py snippet somewhere else (say OSVB or OSVVM), instead of the VUnit repo.


Overall, note that this is a particular case because VUnit depends on some OSVVM features, but not all of them. Therefore, we need to have a fallback solution that builds OSVVM's core automatically for less experienced users, while we want to allow flexibility for intermediate and advanced users. That's why I think that Options 2 or 3 are desirable.

I can help testing the approaches in ghdl/extended-tests, here and in OSVVM's CI. Each of them would test a different solution.

/cc @JimLewis @Paebbels

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions