Features inquiry: Add support for (true) anonymous aggregate data types & packed union with different size members

Hello all,

I don’t know if that’s the right for inquiries, but I would like to see support for (true) anonymous aggregate data types (à-la C++), and packed union with different size members. For example, an AMBA CHI’s RSP flit would look like:


struct packed {
    ...
    union packed {
        logic       data_pull;
        chi_state_t fwd_state;
    }; // Anonymous union, namely speaking.
    ...
} chi_rsp_flit_t;

This would permit to have more readable, complex structures. Fields can share the same set of bits on buses to save space, but this isn’t done in the first place. That is, designer sometimes do a first iteration without common fields, then do a second round packing as much as what can be. With current SystemVerilog’s specification, such structure would look like this:


struct packed {
    ...
    union packed {
        struct packed {
            logic[$bits(chi_state_t)- 1:1] res0;
            logic                          data_pull;
        } alt1;
        struct packed {
            chi_state_t                    fwd_state;
        } alt0;
    } cf0;
    ...
} chi_rsp_flit_t;

which is difficult to read and not scalable, especially when implementing common fields as a second step, as described before. Indeed, when moving from flat to common fields, not only shall the structure definition be modified, but also all the RTL and verification code that instance this structure. With anonymous aggregate data types, this code won’t have to be touched. And with packed union supporting members with different size, there is no need to create an extra layer in the hierarchy.

I know there is a revision of the SystemVerilog standard being written. Do you think that would be possible to incorporate such features? If that’s not the right place to ask, please redirect me to the correct one.

P.-S. This question may have been already asked. I apologize if that’s the case.

In reply to hdecharnes:

There is a proposal in development for the next revision of the IEEE 1800 SystemVerilog LRM that addresses this.

https://accellera.mantishub.io/view.php?id=5299

In reply to dave_59:

Hello Dave,

Thank you for your answer. As I can see, the ticket only addresses half of the inquiry. Is there any one for (true) anonymous aggregate types? If not, would it be possible to open it?

Best regards,
Hugo Décharnes