S
Shawn Miller
Guest
I'm working on a SystemVerilog package, and I'm trying to define and
initialize a packed array. I'm having an issue using named
concatenation to initialize the array. I'd like to assign each
element of the array explicitly - see example below:
----------------------------------------------------------------------------------
//Type for the configuration of each slave
typedef struct packed {
bit [1:8] [7:0] Name;
logic [23:0] Addr;
} slaveT;
parameter num_slaves = 3;
parameter slaveT [num_slaves-1:0] slave_array = //array of slave
configurations
// Individually define the configuration of each slave
{
0: {Name: "SLV0 ",
Addr: 24'hFE_0000
},
1: {Name: "SLV1 ",
Addr: 24'hFF_0000
},
2: {Name: "SLV2 ",
Addr: 24'hE0_0000
}
};
----------------------------------------------------------------------------------
What I've found is that I can't do this explicit, named concatenation
to a packed array. It works fine with an unpacked array, but it's my
understanding that unpacked structures won't synthesize.
This also works if I remove the explicit element names, and just use a
simple concatenation based on the order of the elements inside the
curly brackets :
----------------------------------------------------------------------------------
parameter slaveT [num_slaves-1:0] slave_array = //array of slave
configurations
// Individually define the configuration of each slave
{
{"SLV0 ",
24'hFE_0000
},
{"SLV1 ",
24'hFF_0000
},
{"SLV2 ",
24'hE0_0000
}
};
----------------------------------------------------------------------------------
My question is, is there any way to do explicit assignment to elements
of a packed array? I'm trying to do this purely for cosmetic reasons,
but it's driving me nuts.
initialize a packed array. I'm having an issue using named
concatenation to initialize the array. I'd like to assign each
element of the array explicitly - see example below:
----------------------------------------------------------------------------------
//Type for the configuration of each slave
typedef struct packed {
bit [1:8] [7:0] Name;
logic [23:0] Addr;
} slaveT;
parameter num_slaves = 3;
parameter slaveT [num_slaves-1:0] slave_array = //array of slave
configurations
// Individually define the configuration of each slave
{
0: {Name: "SLV0 ",
Addr: 24'hFE_0000
},
1: {Name: "SLV1 ",
Addr: 24'hFF_0000
},
2: {Name: "SLV2 ",
Addr: 24'hE0_0000
}
};
----------------------------------------------------------------------------------
What I've found is that I can't do this explicit, named concatenation
to a packed array. It works fine with an unpacked array, but it's my
understanding that unpacked structures won't synthesize.
This also works if I remove the explicit element names, and just use a
simple concatenation based on the order of the elements inside the
curly brackets :
----------------------------------------------------------------------------------
parameter slaveT [num_slaves-1:0] slave_array = //array of slave
configurations
// Individually define the configuration of each slave
{
{"SLV0 ",
24'hFE_0000
},
{"SLV1 ",
24'hFF_0000
},
{"SLV2 ",
24'hE0_0000
}
};
----------------------------------------------------------------------------------
My question is, is there any way to do explicit assignment to elements
of a packed array? I'm trying to do this purely for cosmetic reasons,
but it's driving me nuts.