SVUnit FAQ

Q. Why would I use SVUnit?

Good question. You’ll want to use SVUnit if you and your customers value defect free systemverilog code. Simple as that.

Q. What do I do with SVUnit?

The SVUnit framework allows you to easily isolate modules, classes and/or interfaces in your designs and testbenches so you can kill bugs at a granularity that is most productive: the unit test level. It’s good for design and verification engineers. It’s also great for test-driven development if you care enough to prevent defects in the first place.

Q. Why would I not use SVUnit?

A. If you love garbage code and irate customers, then SVUnit is not for you.

Q. How do I get SVUnit?

A. Instructions for downloading and using SVUnit are on the Getting Started page.

Q. It used to be that SVUnit was only available to early adopters. That still the case?

A. Nope… not any more. Now anyone can download SVUnit.

Q. What’s the best way to learn how to use SVUnit?

A. It’s best to start with the Getting Started page. The SVUnit Demo Series videos are also pretty decent.

Q. If I find a problem or have questions about SVUnit, what do I do?

A. Best to file a ticket on sourceforge at: https://sourceforge.net/p/svunit/tickets/. Or, you can send me an email at neil.johnson@agilesoc.com and I’ll do my best to help you out.

Q. Can anyone file a ticket against the project?

A. Yes… though you’ll have to be logged into sourceforge to do so.

Q. The SVUnit: Up and Running video says I need to use Git to obtain SVUnit? Is that still the case?

A. Nope. You can get SVUnit via the links on the Getting Started page.

Q. The SVUnit: Up and Running video shows you defining test methods in the unit test class and then invoking them in the run method. Should I do that, too?

A. Nope… you shouldn’t. The usage model has changes slightly since I posted that video. Instead, it is recommended to use the SVTEST(<testname>)/SVTEST_END(<testname>) macros. Like this…

`SVUNIT_TESTS_BEGIN

`SVTEST(first_test)
// test code
`SVTEST_END(first_test)

`SVTEST(second_test)
// test code
`SVTEST_END(second_test)

`SVUNIT_TESTS_END

Q. How do I use SVUnit with UVM?

A. Best to start by watching SVUnit: Unit Testing UVM Components and cross-referencing the video with the simple model example at svunit-code/examples/uvm/simple_model. Where there are minor differences in the video and example code, I’d recommend following the example code.

Q. I get this error when I try and unit test UVM components: “You’re running svunit with uvm without defining RUN_SVUNIT_WITH_UVM. Please add ‘+define+RUN_SVUNIT_WITH_UVM’ to your svunit.f file.”.  What’s going on?

A. Users need to tell SVUnit that they are testing UVM components. You do that by pasting this this line into your svunit.f file:

+define+RUN_SVUNIT_WITH_UVM

…or by pasting the equivalent line into your svunit.mk file:

SIM_ARGS += +define+RUN_SVUNIT_WITH_UVM

Q. In the SVUnit: Unit Testing UVM Components video, you call the svunit_uvm_test_start() and svunit_uvm_test_finish() methods in each test. Should I do that, too?

A. Nope. That would still work, but it’s best to relocate those method invocations to the setup and teardown methods instead so you don’t have to keep typing them!

Q. I hate makefiles. How do I avoid specifying files, etc in the svunit.mk?

A. I’ve added the option of specifying files, command line switches, etc in svunit.f. The svunit.f becomes simulator input automatically via ‘-file svunit.f’ so simply creating the file and adding content is enough.

Share/Bookmark

12 Responses to SVUnit FAQ

  1. LeRoss Calnek says:

    Can I run svunit with modelsim SE?

    If not what are the minimum software requirements.

    • nosnhojn says:

      I haven’t done it but I’m pretty sure the answer is yet… though I’d need to make some scripting updates. I don’t have a modelsim license, but if you’re willing to play guinea pig, we could make it work with a little back-and-forth trial-and-error. let me know if that works for you.

      -neil

      • LeRoss Calnek says:

        That works for me. I am a little tied up and the moment. Once I get started, I will let you know.

        • dhaines says:

          I’m interested in getting SVUnit running with modelsim also.

          Did you guys make any progress with it?

          If not, I’m willing to be the guinea pig as well.

          Dave.

  2. LeRoss Calnek says:

    Hi Dave,

    I have had a chance to check yet.

    I suspect that it will depend on the type of license you have.

    http://en.wedasoft.at/files/uploads/we_products/4/de_modelsim_comparisonfinal_pdf

    Neil, does SVUnit work with Icarus verilog?

  3. LeRoss Calnek says:

    According to eda playground modelsim will work (http://www.edaplayground.com/s/example/563)

    I am not sure what license eda playground is using.

    • nosnhojn says:

      dave, working with LeRoss on this a bit this morning… he’s got a command line that’s good with modelsim. now the ball is in my court to get a new modelsim makefile into a release and posted on sourceforge. I should be able to get to that this coming wednesday evening.

      -neil

      • leross calnek says:

        I needed to add a simulator argument, and I think that it is project specific.

        Since it is project specific, I don’t want to change SIM_ARGS in modelsim.mk. Currently modelsim.mk clears SIM_ARGS.

        Can we change SIM_ARGS to clear itself and then add something like SIM_ARGS_PRJ ?

        ie change
        SIM_ARGS :=
        to
        SIM_ARGS :=
        SIM_ARGS += SIM_ARGS_PRJ

  4. dhaines says:

    Thanks guys!

    I look forward to trying it out.

    Dave.

    • nosnhojn says:

      Dave. You should see support for modelsim in SVUnit 2.6 that I just posted to sourceforge. You can follow all the directions as is except where you see questa.mk, you can put modelsim.mk… or just keep questa.mk b/c both files are the same ;). LeRoss is running already. If we can go 2-for-2, I’d say we’re good with modelsim support.

      -neil

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>