The for-loop is replicating the data; ie if data
is 1 you get 288 ones, if data
is 0 you get 288 zeros. What you want what is a shifter. data_tmp
shift the bits to the left or right depending on the order of the bit stream.
data_tmp<={data_tmp[286:0],data}; // shift and fill left
or
data_tmp<={data,data_tmp[287:1]}; // shift and fill right
Also, remember to assign flops with non-blocking (<=
). Blocking (=
) for assigning combinational logic.