SV 队列位宽的定义

来源:互联网 发布:淘宝链接二维码 编辑:程序博客网 时间:2024/06/06 00:46

tranction中对数据的定义

rand    bit [31:0]   mon_maddr_o;rand    bit  [2:0]     mon_mcmd_o;rand    bit     mon_sresp_last_i; rand      logic [127:0]  mon_sdata_i;

组件monitor对数据的定义1

`uvm_component_utils(ocp_fc_mon) bit    mon_sresp_last_i_que[$]; bit    mon_sdata_i_que[$]; bit    mon_maddr_o_que[$]; bit     mon_mburst_length_o_que[$];

后来相互之间的赋值操作

tr.mon_mcmd_o = mcmd_que[0:2];mcmd_que = mcmd_que[3:$];tr.mon_maddr_o = mon_maddr_o_que[0:31];mon_maddr_o_que =  mon_maddr_o_que[32:$];tr.mon_mburst_length_o = mon_mburst_length_o_que[0:4];mon_mburst_length_o_que = mon_mburst_length_o_que[5:$];

这样会报错的

    Error-[ICTA] Incompatible complex type          ../agent/ocp_mon/ocp_fc_mon.sv, 98  Incompatible complex type assignment  Type of source expression is incompatible with type of target expression.  Mismatching types cannot be used in assignments, initializations and  instantiations. The type of the target is 'bit[2:0]', while the type of the  source is 'bit$[$]'.  Source Expression: this.mcmd_que[0:2]

后来在monitor中队数据重新定义

 bit  [2:0]        mcmd_que[$]; bit    mon_sresp_last_i_que[$]; bit [127:0]  mon_sdata_i_que[$]; bit [31:0]   mon_maddr_o_que[$]; bit  [4:0]  mon_mburst_length_o_que[$];

并用下面的赋值操作完成赋值,正确

                 tr.mon_mcmd_o = mcmd_que[0];                 mcmd_que = mcmd_que[1:$];                       tr.mon_maddr_o = mon_maddr_o_que[0];                 mon_maddr_o_que =  mon_maddr_o_que[1:$];                 tr.mon_mburst_length_o = mon_mburst_length_o_que[0];                  mon_mburst_length_o_que = mon_mburst_length_o_que[1:$];
0 0
原创粉丝点击