Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

SystemVerilog: Question about array of packed struct

Status
Not open for further replies.

likewise

Newbie level 5
Joined
Jun 22, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,369
Hello all,

Suppose I have the following in SystemVerilog (intended to synthesize).

typedef packed struct begin
logic a;
logic b;
end mytype_t;

mytype_t myarray [1:100];


Is it possible to set field 'a' of all array members with a single assignment?

I understood from studying SV books it is possible to set a single dimension within a multidimensional array, and I would consider a field in a structure to be one dimension of my array.

I would expect something like this:

myarray.a <= 0;
myarray[].a <= 0;
myarray[0:100].a <= 0;

Regards,

Leon.
 

dave_59

Advanced Member level 3
Joined
Dec 15, 2011
Messages
812
Helped
361
Reputation
726
Reaction score
354
Trophy points
1,353
Location
Fremont, CA, USA
Activity points
6,271
No, you can't select an array of selects. The most concise way to do what you want is

foreach (myarray) myarray.a <= 0;
 

likewise

Newbie level 5
Joined
Jun 22, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,369
No, you can't select an array of selects. The most concise way to do what you want is
foreach (myarray) myarray.a <= 0;


Thank you for your help, and the proposed solution.

Regards,

Leon.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top