2

When using typedef to declare a userdefine type, then both these forms are accepted by ModelSim:

typedef logic logic_7_0_t [7:0];
typedef logic [7:0] logic_7_0_t;

However, if doing something similar based on real type, then 2nd format fails:

typedef real real_3_0_t [3:0];
typedef real [3:0] real_3_0_t;  // Syntax error by ModelSim

Where to place the array indication, and why the difference between logic and real?

EquipDev
  • 5,573
  • 10
  • 37
  • 63

1 Answers1

1

Based on the references to duplicate answers, my conclusion is that:

typedef logic logic_7_0_t [7:0];  // Unpacked array of logic, which is OK
typedef logic [7:0] logic_7_0_t;  // Packed array of logic, which is OK

typedef real real_3_0_t [3:0];    // Unpacked array or real, which is OK
typedef real [3:0] real_3_0_t;    // Would be packed array of real, which is not illegal
EquipDev
  • 5,573
  • 10
  • 37
  • 63