AaronYang
Newbie level 3
Interview question:
I have a systemverilog based class as following:
In this case 'n' is the size of the dynamic array arr. And the question is how to write a method to create the array so that all the elements in this array is different from each other.
P.S. The class is editable.
I have a systemverilog based class as following:
Code:
class A;
rand n;
constraint c:{n>=10 &&n<=15};
bit [31:0] arr[$];
randc [31:0] data;
endclass
In this case 'n' is the size of the dynamic array arr. And the question is how to write a method to create the array so that all the elements in this array is different from each other.
P.S. The class is editable.
Last edited: