Streaming 32-bit to 8-bit

In reply to Robert.Lanier:

We don’t know the byte ordering you want. It would help if you gave some sample values and showed how you wanted data to be streamed. For example

module top;
  bit [31:0] queue[$] = {32'h01234567,32'h89ABCDEF};
  bit[7:0]   data;

  initial 
    foreach(queue[i]) 
      for (int j=0; j<4; j++) begin
        data = queue[i][j*8+:8];
        $displayh(data);
      end
endmodule

Displays

# 67
# 45
# 23
# 01
# ef
# cd
# ab
# 89
1 Like