• 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 3331
  • 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;

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
  • mahee424
    mahee424 over 7 years ago

    Hi,

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

    Thanks,

    Regards,

    Mahesh.

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

    Hi Mahesh.

    Firstly, Incisive is reaching the end of its life, it hasn't had new features added to it since the end of 2016 when Xcelium was launched to replace Incisive.

    Looking at your constraints, I think you'd be much better off if you only randomize the frame_height, frame_width and num_of_frames variables. Forcing the constraint solver to create the dynamic arrays the way you are is not efficient. Given that you already have a post_randomize, it would be more efficient to use $urandom to put random numbers into the array elements. If you're generating any realistic sized image frames then you should consider doing a frame at a time, or even a line at a time, to save wasting vast amounts of memory. You'll also waste less time on randomisation if you only generate items at the moment you need them. The following adaptation of your example should work better, but it's still not what I'd recommend for a real world testbench.

    program main();

        class base;

           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;}

     

      function void post_randomize();

      array_of_frames = new[no_of_frames];

       foreach (array_of_rames[frame]) begin

          array_of_frames[frame] = new[frame_height]; 

          foreach (array_of_frames[frame][line]) begin          

           array_of_frames[frame][line] = new[frame_width];

           foreach (array_of_frames[frame][line][pixel]) begin

                array_of_frames[frame][line][pixel] = $urandom;

                   $write("0x%x ", (array_of_frames[frame][line][pixel]) & 32'hFF));      

            end        

           $display(" ");  

         end      

       $display(" ");  

     end

    endfunction

    endclass

    base b0 = new();

    initial  

    void'(b0.randomize());

     endprogram

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

    Hi Stephen,

         Thanks a lot for the suggestion and i will try here to make use of xcelium quickly as possible.

    Thanks,

    Mahesh.

    • 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