Reputation: 461
Can I have groups inside a struct?
pseudo-code:
typedef struct {
input_group {
logic a;
}
output_group {
logic b;
}
} my_signals_list
Upvotes: 1
Views: 1332
Reputation: 7573
Short answer: no.
If you want to have signals grouped like this, why not create a struct for the input group and a struct for your output group?
typedef struct {
logic a;
} input_group_s;
typedef struct {
logic b;
} output_group_s;
typedef struct {
input_group_s input_group;
output_group_s output_group;
} my_signals_list;
As Greg points out in the comments, you can also have nested struct definitions inside the main struct:
typedef struct {
struct { logic a; } input_group;
struct { logic b; } output_group;
} my_signals_list;
If you want to specify signals for a module in a nice encapsulated fashion, I would suggest using an interface
, though.
Upvotes: 3