1

I'm new to Verilog programming and would like to test the following module. Can someone please point me in the right direction as far as where to get started with this? Do I just have to write a bunch of for loops to simulate all possible values for the four inputs and then use some display statements to see the result?

module HW7P1( A1, A0, B1, B0, O );
  input A1, A0, B1, B0;
  wire O;
  assign O = (!A1 & B1) | (!A1 & !A0 & B0) | (!A0 & B1 & B0);
endmodule

1 Answer 1

1

Create a testbench module TB 101

Since the number of different inputs is small for you (16), you will be able to exhaustively check all of them.

You could sequentially step through all the input values with a for loop. It would be better to randomly assign the inputs ($urandom) in a loop.

You should create a checker module with a set of expected outputs for each input. Every time your input changes, you should check the actual output vs. your expected output. If they mismatch, you should $display an error message.

There are advanced verification methodologies available for doing this, such as UVM.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.