Mar 5, 2013 #1 S 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
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
Mar 5, 2013 #2 D dave_59 Advanced Member level 3 Joined Dec 15, 2011 Messages 841 Helped 366 Reputation 736 Reaction score 360 Trophy points 1,353 Location Fremont, CA, USA Activity points 7,390 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++)
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++)
Mar 5, 2013 #3 S shparekh Newbie Joined Mar 5, 2013 Messages 4 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,303 Super. I knew there had to be a way. Thx.