Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How can I create a dynamic array with different random values in random size?

Status
Not open for further replies.

AaronYang

Newbie level 3
Joined
Jan 4, 2016
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
30
Interview question:
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:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top