[SV]动态数组特性

动态数组的特性:

bit[7:0] d_array[];

d_array = new[4];

d_array ={0,1,2,3};

d_array = new[10];//原来的四个元素被清空

d_array = new[10](d_array);//原来的四个元素还存在
function void funcs();
      int pos[$] ;
    //   缩减操作 xor , or , and ,  xnor  , sum , product 等
    $display("the sum is %d ",array.sum());
    $display("the and is %d ",array.and());
    $display("the  or is %d ",array.or() );
    $display("the xor is %d ",array.xor());
    $display("the product is %d ",array.product());//乘积

endfunction
发布了89 篇原创文章 · 获赞 17 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/lbt_dvshare/article/details/103224476
今日推荐