Shift a byte in a queue/array of 32 bit width

Hi All,
How can i shift a byte in a queue/ array of width 32 bits.
For example- Input array

 
//Assuming size of array 3 for example
bit [31:0] inp_arr[3] = {32'habcd01fb, 32'h01234567 ,32'h89abcdef};
bit [31:0] out_arr[3];
// Result by shifting i want- 
out_arr= {32'h67abcd01,32'hef012345,32'h0089abcd};//last byte becomes 8'h00

Thanks

In reply to saurabh_s:

It helps to have an intermediate array of bytes

  bit [7:0] bb[];

  bb=  {<<32 {inp_arr}}; // unpack words into bytes ordered for shifting
  out_arr = {<<32{8'b0,bb[0:$-1]}}; // pack shifted bytes back to words 

In reply to dave_59:

Hi Dave,
I think there is a typo in the above code. It should be



bit [7:0] bb[$];
 
  bb=  {<<32 {inp_arr}}; // unpack words into bytes ordered for shifting
  out_arr = {<<32{8'b0,bb[0:$-1]}}; // pack shifted bytes back to words

In reply to rag123:

It doesn’t matter functionally if the intermediate variable is a dynamic array or queue of bytes. Dynamic arrays are more efficient than queues until you need to push/pop elements of them.

In reply to dave_59:

Thanks for the solution Dave!!!

In reply to dave_59:

Could it be used something like that in Verilog?

In reply to alexlevor:

Verilog does not have the streaming operator. You would have to use nested for loops.