I am designing a ring counter with 8 bit input. I was successful in design and verifying it through a testbench module. Now I am asked to do the auto correction and self checking of the test bench. Can anyone help me with understanding the basics of a self checking testbench? Are there any good materials or PDFs available online to give you a fundamental idea of building a self checking test bench?


A self-checking test bench runs a series of tests on the DUT and checks if the results are what is expected. This is in contrast to the designer looking at the waveforms and declaring that 'it all works'. Often to test the functionality the TB needs the equivalent code of the DUT to generate the expected outcome.

Although there is no uniform template, as the each test bench is tailored to what it is testing, most of them follow the principle that you provide control signals and data for the DUT and at the same time provide an expected result. Then the expected result is compared against the actual result. To line the two up a FIFO or memory can be very useful.

Writing a test bench for your own module is fraught with the danger that you test what you have implemented, not what you should have implemented. Therefore ideally the test bench should be written by an independent party from the specification of the DUT.

There was a question recently about testing a FIFO which I replied to. That might give you some idea of what to test: Corner Cases to Verify Synchronous FIFO

From experience:
Most of the time you will find that the test bench turns out to be much bigger then the DUT code itself. Also you often find that the first round of errors are in your test bench not your DUT.

I'll have to stop here because I can keep writing for some more hours about test benches.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.