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.

[SOLVED] System Verilog conditional parameter

Status
Not open for further replies.

shparekh

Newbie
Joined
Mar 5, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
Hi,

I have a following statement in my code -

Code:
genvar sliteIfIter_grp1
generate for (  sliteIfIter_grp1=0;
                  sliteIfIter_grp1<MAX_SLITE_GRP1;
                  sliteIfIter_grp1+=1)

The psuedo code to assign MAX_SLITE_GRP1 is

Code:
 if (SLITE_NUM > 4)
   localparam MAX_SLITE_GRP1 = 4
 else
   localparam MAX_SLITE_GRP1 = SLITE_NUM

SLITE_NUM is a parameter which can be overridden at the time instantiating the block.

Can you please suggest how I can write this in system verilog?

Thanks.
Best regards,
SP
 

Code:
localparam MAX_SLITE_GRP1 = (SLITE_NUM>4)? 4 : SLITE_NUM;
and the same generate block, or
Code:
genvar sliteIfIter_grp1;
for (  sliteIfIter_grp1=0;
                  sliteIfIter_grp1<( (SLITE_NUM>4)? 4 : SLITE_NUM);
                  sliteIfIter_grp1++)
 

Super. I knew there had to be a way.
Thx.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top