A structure (struct) is a collection of variables
grouped together under a single name. Each variable in the struct
is called a member and can have a different data type.
// Define a structure
typedef struct {
bit [31:0] addr;
bit [31:0] data;
bit write;
bit [3:0] id;
} transaction_t;
// Use the structure
transaction_t txn;
txn.addr = 32'h1000;
txn.data = 32'hDEADBEEF;
txn.write = 1;
txn.id = 4'hA;
$display("Transaction: addr=0x%h, data=0x%h, wr=%b, id=%h",
txn.addr, txn.data, txn.write, txn.id);
typedef is Your Friend
Always use typedef with structures to create a
reusable type name. The _t suffix is a common convention
to indicate a type definition.