Append logic vector to vector

In reply to Ken Tsang:

x +: N, The start position of the vector is given by x and you count up from x by N
x -: N, in this case, the start position is x and you count down from x by N
N is a constant and x is an expression that can contain iterators

this is an example from LRM, I think your mess up this syntax


logic [31: 0] a_vect;
logic [0 :31] b_vect;
logic [63: 0] dword;
integer sel;
a_vect[ 0 +: 8] // == a_vect[ 7 : 0]
a_vect[15 -: 8] // == a_vect[15 : 8]
b_vect[ 0 +: 8] // == b_vect[0 : 7]
b_vect[15 -: 8] // == b_vect[8 :15]
dword[8*sel +: 8] // variable part-select with fixed width

if you want to append in_data (with in_data_offset) to out_data (at position out_data_pos)
it should be like this


function void slice(ref logic[255:0] data, ref logic[255:0] out_data, input shortint in_data_offset, input shortint out_data_pos);
    out_data = in_data<<in_data_offset; // shift in_data
    out_data <<= out_data_pos; // start from this position
endfunction