[SOLVED] verilog: how to find max value in the bus

Status
Not open for further replies.

miskod

Newbie level 4
Joined
Sep 16, 2014
Messages
5
Helped
2
Reputation
4
Reaction score
2
Trophy points
3
Visit site
Activity points
44
Please help me...I'm fighting with following problem in the simulation testbench:
I have bus of 32*10bit values: ix_puldata[319:0]. I need to find maximum value in this bus. I use following code enclosed in the task:

integer j;
….
for(j=0;j<32;j=j+1)
if(top_inst.core.subsystem.ixpul_data[((j+1)*10)-1j*10)] > ix_pul_max)
ix_pul_max = top_inst.core.subsystem.ixpul_data[((j+1)*10)-1j*10)];

What I get is “Illegal operand for constant expression” everywhere I use “j” integer in array position.
I can imagine, that such code is not synthesizable, but I don’t see reason why it generate error in simulation.
Please, help me to find max value there...
 

Reactions: miskod

    miskod

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…