Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

Streaming Operators: Unpacking a Stream Back Into Variables

SystemVerilog Arrays

Runnable example from the SystemVerilog Streaming Operators tutorial (Unpacking a Stream Back Into Variables)

Open in IDE
testbench.sv
module tb;
  initial begin
    bit [31:0] stream = 32'h41424344;
    byte a, b, c, d;

    { >> { a, b, c, d } } = stream;

    $display("a = 0x%0h  b = 0x%0h  c = 0x%0h  d = 0x%0h", a, b, c, d);
  end
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.