How to declare Array in Typedef Struct

Whether we can declare a Array in typedef struct,I want to declare Payload array in typedef, array size changes according to type/length.

How to declare payload array in Typedef struct.

In reply to shiva kumar:

How does your payload array look like?
Is it a good approach to use a struct. If you are working with UVM a seq_item (transaction) might be the prefered construct.

In reply to chr_sue:

I am using Axi streaming operators to unpack data from queue.(I already packed completed ethernet packet data from interface to queue).By using typedef(by declaring Ethernet MAC fields) i have to unpack from queue.

In reply to shiva kumar:

This might help:
https://verificationacademy.com/cookbook/transaction/methods#do_pack_and_do_unpack

In reply to chr_sue:

can we directly tap data from interface by using Axi streaming operators
like this {>>{a, b, c, d}} = value;

In reply to shiva kumar:
Did you try it?
It should work. SV allows a concatenation on the LHS.

In reply to chr_sue:

I want to declare payload as array in typedef,then i want to use streaming operatoe to drive data into it.

is it possible to declare array in typedef

In reply to shiva kumar:

In a typedef you can use any SV/Verilog or customized data type.

In reply to chr_sue:

How to declare dynamic array in typedef

In reply to shiva kumar:
There is nothing magic but simply straight forward.
See the code example here:

module top;
  typedef struct {
     int a;
     bit b;
     string da [];
  } struct_t;

  struct_t x;
initial begin
  x.a = 12;
  x.b = 1'b1;
  x.da = new[10];
  x.da[0] = "max";
  x.da[1] = "min";

  $display("da has %0d entries", x.da.size());
  for (int i = 0; i <= x.da.size(); i++)
    $display("x.da[%0d] = %s", i, x.da[i]);
end

endmodule