Size of Union in SystemVerilog

In reply to HemantP_8236:

Would $bits( UN_A ) work?

i.e.

localparam SIZE_UN_A = $bits( UN_A )

I don’t know all the rules for unions. I think packed unions should work; tagged unions have other rules (allowing dynamic types) - but then you made UN_B taggged and packed…

I’m actually not sure here, but it should be a quick test.