Trung tâm đào tạo thiết kế vi mạch Semicon


  • ĐĂNG KÝ TÀI KHOẢN ĐỂ TRUY CẬP NHIỀU TÀI LIỆU HƠN!
  • Create an account
    *
    *
    *
    *
    *
    Fields marked with an asterisk (*) are required.
wafer.jpg

GENERATE RANDC BEHAVIOR FROM RAND VARIABLE

E-mail Print PDF

It’s easy to get the first cycle of random numbers by pushing values on a list in post_randomize() and adding a constraint that keeps the values in the list excluded from the next solution.

class A;

   rand mytype_t myvar;

   mytype_t list[$];

   constraint cycle { unique {myvar,list};}

   function void post_randomize;

     list.push_back(myvar); //storing each myvar into list[$]

   endfunction 

endclass

 

The real problem is knowing when to start the cycle over by clearing the list. If the exact number of possible values for myvar is known, you can add a pre_randomize() method that deletes the list when hitting that limit.

function void pre_randomize;

 if (list.size() == limit) 

   list = {}; //delete queue

endfunction

 

Otherwise you will have to check the result of calling randomize() and assume it fails because it has exhausted the list of values.

Bạn Có Đam Mê Với Vi Mạch hay Nhúng      -     Bạn Muốn Trau Dồi Thêm Kĩ Năng

Mong Muốn Có Thêm Cơ Hội Trong Công Việc

Và Trở Thành Một Người Có Giá Trị Hơn

Bạn Chưa Biết Phương Thức Nào Nhanh Chóng Để Đạt Được Chúng

Hãy Để Chúng Tôi Hỗ Trợ Cho Bạn. SEMICON  

 

 

Related Articles

Chat Zalo