Version 3.8 of SVUnit, just released, improves support and usability for people unit testing UVM components.
XtremeEDA, are responsible for adding and testing the version 3.8 features. That makes Colleen and Dave the newest active contributors to SVUnit!But before we talk about new features, I want to mention that the cool part of this release… for me anyway… is that I didn’t have to do anything! Colleen Piercey and Dave Read, colleagues of mine from
As far as new 3.8 features, people can now use create_unit_test.pl to generate a UVM specific test case template. The template gives test writers placeholders for connectivity in an auto-generated UUT wrapper. It also inserts file includes, package imports and required function calls in the setup and teardown to avoid people having to do it themselves. Importantly, the new UVM test case template compiles and runs with UVM as-generated so you start writing tests from a known good state.
To create the new test template, Colleen and Dave added a ‘-uvm’ switch to the create_unit_test.pl. So, for example, if you’re writing unit tests for a UVM component called blah, you would generate a test case template with…
>create_unit_test.pl -uvm blah.sv
That’ll give you a test case template in blah_unit_test.sv. At the top of the test case template, you’ll see a wrapper defined for blah called blah_uvm_wrapper. The wrapper looks like this…
The connect phase in that wrapper becomes the right place for any light unit test infrastructure that’s missing from the default test case template, if required. For me, this has been stuff like TLM FIFOs or stub connections to analysis ports that your UVM component would typically interact with in a real testbench arrangement. Of course the wrapper gives you the opportunity to also add any for-test-only logic that helps you isolate and test behaviour in blah. If you have no connectivity or extra considerations, there’s nothing required in that wrapper; it’s just there for convenience.
As for the other boilerplate code that’s included in the UVM test case template, you’ll see most of that in the build, setup and teardown tasks (note the activate/deactivate and test_start/test_finish function calls)…
Having to insert all those function calls was annoying the way I had it in the default test case template, admittedly, so I’m glad the new template takes care of them.
Thanks again to Colleen and Dave for the new UVM support in 3.8! Makes my life easier. Same for anyone else using SVUnit to unit test UVM components :).
PS: Heads-up that Dave is currently working on additional support for UVM1.2. For teams using UVM1.2, Dave should have that figured out in the next couple weeks at which time we’ll do a version 3.9.
One thought on “SVUnit Improves Support for UVM”