Relative Content

Tag Archive for system-verilog

Setting a starting position for the constraint random solver

class square; rand bit arr [3][3]; function void pre_randomize(); arr[0][1] = 1; $display (“%p”,arr); endfunction constraint ab_c { foreach (arr[i,j]) { if (arr[i][j] == 1) { if (i > 0 && j > 0 && j < 2 && i < 2) { arr[i+2][j-1] == 1; } else arr[i][j] == 0; } } } I […]

Classes method execution and systemverilog regions

I want to know when does any class method be executed, is it in active region set or re-active region set.
I’m Trying to understand more the time that the design receive the input values from the environment, when the driver toggles the interface signals, is this process happens in the active or re-active region, and also when the monitor samples the DUT signals is this process happens at active or re-active region.

Program Block in Systemverilog

From Systemverilog LRM:
Program variables can only be assigned using blocking assignments. Non-program variables can only be assigned using nonblocking assignments. Using nonblocking assignments with program variables or blocking assignments with design (non-program) variables shall be an error. References to program variables from outside any program block shall be an error.

How to write constraints in systemverilog

typedef struct packed { logic [3:0] A; logic [3:0] B; } pkt; rand pkt [10] p; How to write constraints to systemverilog so that they are executed simultaneously: A and B had unique combinations A and B had repeatable data a random number of times. For example: A in the range 0-1 B in the […]