当前位置:   article > 正文

SystemVerilog生成随机矩阵_this.randomize

this.randomize

SystemVerilog生成随机矩阵

  1. // 1.first part: a systemvrilog program block. (this part can be omitted)
  2. class hello_str;
  3. string str = "Hello world";
  4. endclass
  5. class hello_martix;
  6. rand reg[(4+6):0] m[16][16];
  7. reg[10:0] col_sum[16];
  8. function void random_mat();
  9. assert(this.randomize() with{
  10. m[0].sum()<=128;
  11. m[1].sum()<=128;
  12. m[2].sum()<=128;
  13. m[3].sum()<=128;
  14. m[4].sum()<=128;
  15. m[5].sum()<=128;
  16. m[6].sum()<=128;
  17. m[7].sum()<=128;
  18. m[8].sum()<=128;
  19. m[9].sum()<=128;
  20. m[10].sum()<=128;
  21. m[11].sum()<=128;
  22. m[12].sum()<=128;
  23. m[13].sum()<=128;
  24. m[14].sum()<=128;
  25. m[15].sum()<=128;
  26. (m[0][ 0]+m[1][ 0]+m[2][ 0]+m[3][ 0]+m[4][ 0]+m[5][ 0]+m[6][ 0]+m[7][ 0]+m[8][ 0]+m[9][ 0]+m[10][ 0]+m[11][ 0]+m[12][ 0]+m[13][ 0]+m[14][ 0]+m[15][ 0])<=128;
  27. (m[0][ 1]+m[1][ 1]+m[2][ 1]+m[3][ 1]+m[4][ 1]+m[5][ 1]+m[6][ 1]+m[7][ 1]+m[8][ 1]+m[9][ 1]+m[10][ 1]+m[11][ 1]+m[12][ 1]+m[13][ 1]+m[14][ 1]+m[15][ 1])<=128;
  28. (m[0][ 2]+m[1][ 2]+m[2][ 2]+m[3][ 2]+m[4][ 2]+m[5][ 2]+m[6][ 2]
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号