I am trying assign value from dynamic array to my DUT but getting the following error :
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 ‘logic[31:0]’, while the type of
the source is ‘logic$[511:0]’.
Source Expression: this.array[0]
Dynamic array has been defined as
logic [511:0] array [] ;
. and DUT has data width of 32 bits
Below is the code
for(int i=0;i<16;i++)
begin
vif.wr_driv_cb.text_i<=array[0];
array[0]=array[0]<<32;
end
Please suggest where am I going wrong or if there is a better way to do it. I am sending 32-bit data at a time and doing that 16 times so that I can send 512-bit of data.
In reply to Spriyada29:
array[0] is 512 bits wide and text_i only 32 bits additionally the target is packed and the dyamic array is unpacked.
In reply to chr_sue:
Yeah I understand that but I am not sure how to implement this.It would be great if you can provide some suggestion on how to implement this.
How should I define my array if I can’t have it as 512 bits long?
I am having a string of 512 bits and I am putting that in an array. That array is passing signal to my DUT. Hence I am flexible in choosing my array type also.
Any suggestion would be great.
In reply to Spriyada29:
I don’t understand why you are getting a compiler error. It should take the 32 LSBs of array[0] and assign them to text_i (Which I assume is 32 bits). It should be the same as
vif.wr_driv_cb.text_i<=array[0][31:0];
But since you are shifting left, you should be using the 32 MSBs
vif.wr_driv_cb.text_i<=array[0][511:480];
A simpler way of writing this would be
for(int i=511;i>0;i=i-32)
vif.wr_driv_cb.text_i<=array[0][i-:32];
Also, I assume there is some clock edge to space the assignments out