• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Multi Dimensional Dynamic Array Constraint support Issue...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 65
  • Views 4467
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multi Dimensional Dynamic Array Constraint support Issue in System Verilog/UVM

mahee424
mahee424 over 7 years ago

I've  the below example for multi dimensional dynamic array randomization;

    Class base extends uvm_sequence_item;

       ......

        rand integer array_of_frames[][][];

        rand int   frame_height;

        rand int frame_width;

        rand int no_of_frames;

       .................

        constraint no_of_frames_c { no_of_frames>1;no_of_frames<3;} 

        constraint frame_height_c { frame_height>10;frame_height<20;}

        constraint frame_width_c {frame_width>1;frame_width<100;} 

       ........

       function void  post_randomize();

           for(int i=0; i<array_of_frames.size; i++) begin
             for(int j=0; j<array_of_frames[i].size; j++) begin
                for(int k=0; k<array_of_frames[i][j].size; k++) begin
                        $write("0x%x ", (array_of_frames[i][j][k] & 32'hFF));
                end
                $display(" ");
             end
            $display(" ");
           end

       endfunction

    endclass 

   After calling the randomization on above item,IRUN throws the below error.

  Warning: The generated size 130953965 of the queue/dynamic array is extremely large in IRUN and also causing the randomization failure. 

   I've tried with the other tools and no issues found.

Please help and suggest a possible solution in NCSIM to allocate memory for above multi dimensional dynamic array?

Thanks,

Regards,

Mahesh.


 

  • Cancel
  • StephenH
    StephenH over 7 years ago

    Hello Mahesh.

    Dynamic arrays do not get allocated by randomisation, so based on the small snippet of code you've shared, the array_of_frames will still be empty after the randomize() call.

    I assume you are allocating the array before calling randomize(). What are the dimensions that you've set?

    You also appear to have missed some constraints on the size of array_of_frames, there is nothing linking that to the other rand variables in your constraints.

    If you can share a runnable example that show the error, it'll be a lot easier to help you. You should also state which simulator version you're using.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mahee424
    mahee424 over 7 years ago in reply to StephenH

    Hi Stephen,

         I've missed some logic in the previous post. Below is the complete example in system verilog;

    program main();

        class base;

           rand int array_of_frames[][][];

           rand int frame_height;

           rand int frame_width;

           rand int no_of_frames;

           constraint no_of_frames_c { no_of_frames>1;no_of_frames<3;}

           constraint frame_height_c { frame_height>10;frame_height<20;}

           constraint frame_width_c {frame_width>1;frame_width<100;}

           constraint array_of_frames_c {       

                 array_of_frames.size == no_of_frames;  

                 foreach (array_of_frames[i]) {           array_of_frames[i].size == frame_height;          }  

                foreach (array_of_frames[i,j]) {            array_of_frames[i][j].size == frame_width;      }  

          }

      function void post_randomize();

       for(int i=0; i<array_of_frames.size; i++) begin    

          for(int j=0; j<array_of_frames[i].size; j++) begin          

             for(int k=0; k<array_of_frames[i][j].size; k++) begin              

                   $write("0x%x ", (array_of_frames[i][j][k] & 32'hFF));      

            end        

           $display(" ");  

         end      

       $display(" ");  

     end

    endfunction

    endclass

    base b0 = new();

    initial  

    void'(b0.randomize());

     endprogram

    After simulation I've been observed the below message from irun.log;

     

    void'(b0.randomize());
    |
    ncsim: *W,SVRNDF (./multi_ddynamic_array.sv,53|19): The randomize method call failed.
    Observed simulation time : 0 FS + 1
    ncsim: *W,RNDOCS: These constraints contribute to the set of conflicting constraints:

    constraint frame_height_c { frame_height>10;frame_height<20;} (./multi_ddynamic_array.sv,19)
    foreach (array_of_frames[i]) { (./multi_ddynamic_array.sv,25)
    ncsim: *W,RNDOCS: These variables contribute to the set of conflicting constraints:

    rand variables:
    frame_height [./multi_ddynamic_array.sv, 11]

    I'm using the below NCSIM Version;

       /tools/icad/cadence_lnx/ius/141.014/tools/bin/irun

    Please help in this regard whether I've missed something on constraints. However the above code is working fine with the other tools.

    Thanks,

    Regards,

    Mahesh.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mahee424
    mahee424 over 7 years ago in reply to mahee424

    Hi,

       Does anyone tell me that the above issue will get resolved by using the latest IUS  version 15.20?

    Thanks,

    Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information