SVUnit Upgrade
Being a relatively early adopter of svunit (for unit testing SystemVerilog code), I had a fair amount of code written to work with the early 0.X versions of svunit. The maintainers of svunit have made some good progress and are now on version 2.3 (as of writing this). My old tests don't work with the new version of the framework, but I figured out how to update them. Just in case anyone else is in the same predicament, I will share the steps I took to fix things:
- In the *_unit_test.sv file:
- remove typedef class c_<UUT>_unit_test
- keep the module <UUT>_unit_test declaration, but delete everything in the module except for the string name… and any interface declarations you may have added
- delete the c_<UUT>_unit_test class declaration
- add svunit_testcase svunit_ut; under the string name…
- Now that this is a module and not a class, tasks and functions declared in here might need to have the automatic keyword added to the declaration in order to behave the same
- change function new… to function void build();
- change super.new(name); to svunit_ut = new(name);
- inside task setup, change super.setup(); to svunit_ut.setup();
- inside task teardown, change super.teardown(); to svunit_ut.teardown();
- remove (<testname>) from all `SVTEST_END macros (it no longer takes an argument)
- change last line of file from endclass to endmodule
- remove typedef class c_<UUT>_unit_test
That should be it.
Comments