plusargs in systemverilog

Master the Power of Plusargs in SystemVerilog: Must-Know Tips

Plus args are command-line switches supported by the simulator. Usually, they are application-specific. As per SystemVerilog LRM, arguments beginning with the ‘+’ character will be available using the $test$plusargs and $value$plusargs PLI APIs. Plus args are very useful in controlling many things in your environment, such as controlling your debug mode, setting a value like…

Ifdef Vs plusargs:

A difference between ifdef and plusarg is that ifdef removes/adds code in compilation itself, while plusarg will compile the entire code suite. While using ifdef, one needs to re-compile in order to change the macro argument. On the other hand, the plusarg code is compiled irrespective of the command line argument

Constraint Override in System Verilog:

Here in this overriding of constraint if we will have the same constraint name in the parent class as well as child class then we can say that our constraint is overridden in the child class. Let us understand through an example: In the above example, you can observe that the EDA tool will try…

randomize() Vs std::randomize()

The built-in class randomize method operates exclusively on class member variables. Using classes to model the data to be randomized is a powerful mechanism that enables the creation of generic, reusable objects containing random variables and constraints that can be later extended, inherited, constrained, overridden, enabled, disabled, and merged with or separated from other objects….

Functional Coverage Options in System Verilog

Functional Coverage is very important in Test Bench Development. It always gives us confidence in covered items listed on the verification plan. Usually, the goal of a verification engineer is to ensure that the design behaves correctly in its real environment according to specifications. Defining a coverage model is very important for any test bench…

Generate randc behavior from rand variable:

It’s easy to get the first cycle of random numbers by pushing values on a list in post_randomize() and adding a constraint that keeps the values in the list excluded from the next solution. The real problem is knowing when to start the cycle over by clearing the list. If the exact number of possible…

Immediate Vs Concurrent Assertions

Immediate assertions use expressions and are executed like a statement in a procedural block. They are not temporal in nature and are evaluated immediately when executed. Immediate assertions are used only in dynamic simulations. Following is an example of a simple immediate assertion that checks “if x and y are always equal”: Concurrent assertions are temporal…

How to generate an array of unique random values

Nowadays in many verification scenarios, it requires to create a set of random instructions or addresses with each unique value or we can say that no repeating values, usually represented as elements in a dynamic array.  Earlier versions of SystemVerilog required you to use either nested foreach loops to constraint all combinations of array elements…

Generate the array of unique values without using random and constraints

Without using Random variable and constraint, you can generate array of random unique values using below code, but it is not fully random.

System Verilog rand_mode() and constraint_mode()

rand_mode(): Variables who is having random nature declared as rand or randc can be turned on or off dynamically by using an in-built method called rand_mode(). It can be called either function or task. In the below example, you can see that how rand_mode we are going to use to disabled and enabled all variables….