Setting up OSVVM

Setting up OSVVM

Introduction

This is the second installment in an on-going series of articles detailing my personal study of formal verification methods for VHDL based logic designs. In the last article I detailed installation of GHDL and GTKWave under Windows 10. This article describes the installation and pre-compilation of OSVVM using a GHDL environment under Windows. I had considered using both OSVVM and UVVM, however, getting UVVM up and running successfully using GHDL has turned out to be a painful process. GHDL using the mcode backend works, but LLVM does not work reliably. In the end, I’m likely to focus on using OSVVM. The OSVVM author, Jim Lewis, makes some very good points justifying a focus on OSVVM in this blog post. I am, however, still reserving judgment until I have some experience with both libraries. (Spoiler Alert: My experience, to date, with UVVM, in the context of GHDL, has been less than stellar, but I’m still trying hard to remain unbiased for now). I’ll probably roll back and get UVVM up and running at some point in the not too distant future, but for now… Rolling forward…

Clone the OSVVM Git Repo

Pick a good place to drop the OSVVM source repository on your machine. I use a directory called “distrib” for most source repositories.

  • Open a “MSYS2 MinGW 64-bit” shell.
  • “cd” to the directory where you want to store the OSVVM git repo clone
git clone --recursive htttp://github.com/OSVVM/OsvvmLibraries

This will recursively clone the OSVVM Utility library, the Common library, the Verification Components and the Script library. You’ll eventually need everything, and this makes it fairly easy.

Install Tcl/Tk Under MSYS2

You’ll need to install Tcl/Tk to run under the MSYS2 environment. This is necessary to regression test both the libraries and the verification IP. The build process for GHDL, in my opinion, is much easier if you use the GHDL installation scripts. These are a little broken, but we detail how to fix them in the next post.

From an MSYS2 MinGW 64-bit shell…

pacman -S mingw-w64-x86_64-tcl
pacman -S mingw-w64-x86_64-tk
pacman -S mingw-w64-x86_64-winpty

It’s possible that Tcl is already installed if you’ve installed gtkwave. You’ll also need winpty to handle bridging between a *nix “pty” and the windows console.

For future reference, tclsh runs from the MSYS2 shell using the following command line:

winpty tclsh

Set up the OSVVM Script Environment and Regression Testing

While we won’t be using the Tcl based OSVVM script environment for the immediate future, it’s not a bad idea to check it out at this point. Regression testing the libraries and verification IP is pretty straightforward using the provided Tcl scripts.

  • Change the working directory to the “OsvvmLibraries” directory created when the git repo was cloned above.
  • Create a directory called “sim”, and change to that directory. The name isn’t too important…
  • Start tclsh (“winpty tclsh“). The tclsh prompt (“%”) should be visible in the MSYS2 shell window.
  • Source the “StartUp” script to set up the osvvm scripting environment (“source ../Scripts/StartUp.tcl“)
  • Build the OSVVM libraries locally (“source ../OsvvmLibraries.pro“). This will run for a while.
  • Regression test the libraries and verification IP (“source ../RunAllTests_ghdl.pro“)
  • Once the regression test process finishes, you will find the results under ./sim/results

Build the Libraries

My preference (subject to change as I become more comfortable with the Tcl environment) is to use the GHDL shell script to install the OSVVM library. GHDL seems to have some issues with searching an arbitrary file path for libraries. This may be due to my inexperience with GHDL, but after spending some time digging in the GHDL sources, there may be a Windows path length limit issue. This is a common thing to be bitten by when using Windows.

The most straightforward way to get to a functional installation of OSVVM under GHDL (running under Windows 10 via MSYS2) is to run the installation script provided by GHDL. The install scripts for vendor libraries are found under /msys64/mingw64/lib/ghdl/vendors.

The command line I used to build/install OSVVM under GHDL is:

./compile-osvvm.sh -v --osvvm --output .. --source <osvvm source directory>

If you installed OSVVM as recommended, the source directory is NOT the directory of the cloned git repository. The correct directory is the “osvvm” directory under the “OsvvmLibraries” directory. In the example above, I’m running the script from the “vendors” directory.

NOTE: The above script may not work. If it fails, you may need to add a few files (MessageListPkg.vhd and ReportPkg.vhd) to the list of files in the script. The code snippet below shows the modified list of files. The compilation order is important.

# Library osvvm
# ==============================================================================
StructName="OSVVM_osvvm"
Files=(
	ResolutionPkg.vhd
	NamePkg.vhd
	NameStorePkg.vhd
	OsvvmGlobalPkg.vhd
	VendorCovApiPkg.vhd
	TranscriptPkg.vhd
	TextUtilPkg.vhd
	AlertLogPkg.vhd
	MessagePkg.vhd
	SortListPkg_int.vhd
	RandomBasePkg.vhd
	RandomPkg.vhd
	RandomProcedurePkg.vhd
	MessageListPkg.vhd
	CoveragePkg.vhd
	MemoryPkg.vhd
	ScoreboardGenericPkg.vhd
	ScoreboardPkg_slv.vhd
	ScoreboardPkg_int.vhd
	ResizePkg.vhd
	TbUtilPkg.vhd
	ReportPkg.vhd
	OsvvmContext.vhd
)

Once these two files are added, OSVVM should build successfully. Note that I’m using GHDL 2.0.0-dev (1.0.0.r895.g15b84d1fb) with an LLVM backend. The version of OSVVM that I’m using is 2021.11. Your mileage may vary.

Where to find the Documentation

OSVVM Documentation is found here: https://github.com/OSVVM/Documentation

GHDL Documentation is located here: https://ghdl.github.io/ghdl/

Conclusion

At this point I’ve installed GHDL and gotten OSVVM to a pre-compiled state as a vendor library under GHDL. OSVVM regression testing for both the libraries and the verification IP is largely running (there is a persistent issue with the AXI-Lite VIP, however, this seems to be a known issue under GHDL). The next post will introduce a basic FIFO core for use in OSVVM feature demonstration, and I’ll build a simple testbench using features from AlertLogPkg.