Illegal attempt to resize random dynamic array

7 posts / 0 new
Last post
vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Illegal attempt to resize random dynamic array

I have a ethernet transaction in which I have a payload_data; the size of of which is constrained dependin gon the packet type (as in below).

 typedef enum {NORMAL,JUMBO} PKT_TYPE;
 typedef enum {GOOD,BAD} CRC_TYPE; 
 
  bit unsigned [6:0] [7:0] preamble; 
  bit [7:0] sfd;
  rand bit [5:0] [7:0] d_addr, s_addr;
  rand bit [1:0] [7:0] data_len;
  randc bit [7:0] payload_data[];
  bit [3:0] [7:0] crc;
 
  rand PKT_TYPE type_pkt;
  rand CRC_TYPE type_crc;
 
constraint eth_mac_frame_normal 
    {
      if (type_pkt == NORMAL) 
        {payload_data.size() inside {[46:1500]};
        payload_data.size() == data_len;}
    }
 
  constraint eth_mac_frame_jumbo 
    {
      if (type_pkt == JUMBO) 
      {payload_data.size() inside {[1501:9000]};
	payload_data.size() == data_len;}
    }

When I run the test, (I am using Questa 10.0) It gives me the following error :

 ** Error: (vsim-7020) eth_SEQ.sv(22): Illegal attempt to resize random dynamic array 'pkt.payload_data' to 8421 elements. (SolveArrayResizeMax=2000)
#    Time: 0 ps  Iteration: 37  Region: /uvm_pkg::uvm_sequence_base::start

eth_SEQ.sv(22) is where I am randomizing the transaction.

Can anyone please help why this error is coming? I searched over the net but i could'nt understand it clearly.

richedelman
Offline
Verification Forum Moderator
Joined: 03/15/2010
Posts: 28
Re: Illegal attempt to resize random dynamic array

Questa is setting a limit for the array size. You can change the that maximum limit using at least two methods:

1) Use an attribute on the randomize call:

    assert(p.randomize(* solvearrayresizemax = 0 *)() with {type_pkt == JUMBO;});

2) Use a Tcl variable

    vsim -c top -do "set SolveArrayResizeMax 0; run -all; quit -f"

Setting the limit to 0 means the size is unlimited. Please see the Questa User Guide for more information.

dave_59
Offline
Verification Forum Moderator
Joined: 03/10/2010
Posts: 976
Re: Illegal attempt to resize random dynamic array

By the way, hitting this limit is usually the indication of an improperly specified constraint. I noticed you had

randc bit [7:0] payload_data[];

I don’t know what you were expecting that to do. It won’t generate an array of unique numbers, and it may be too large an array to have cyclical values for each call to randomize()

__________________

Dave Rich
Mentor Graphics
http://go.mentor.com/drich

vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Re: Illegal attempt to resize random dynamic array

Hi Richedelman,
Thanks for the information, that solved my problem.

vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Re: Illegal attempt to resize random dynamic array

Hi Dave,

Actually its a typo, I was using rand only.

vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Re: Illegal attempt to resize random dynamic array

Hi, It worked... But when I am trying to pack this in to a bitstream (uvm_packer), I am not able to do it if there are more than 4095 bytes in total. ie, only a payload of 4070 is allowed. Is there any limit like the above for this also??

vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Re: Illegal attempt to resize random dynamic array

Got It...
vlog +define+UVM_MAX_STREAMBITS= top.sv