circt icon indicating copy to clipboard operation
circt copied to clipboard

[HW] Enum aliasing in SV output

Open mortbopet opened this issue 3 years ago • 0 comments

Currently, different enums with identical field names:

  hw.type_scope @fsm_enum_typedecls {
    hw.typedecl @M2_state_t : !hw.enum<A, B>
    hw.typedecl @M1_state_t : !hw.enum<A, B>
  }

Will export as:

typedef enum {A, B} M2_state_t;
typedef enum {A, B} M1_state_t;

wherein enum values alias.

Enum values should be emitted with additional pre/suffixing of the enum type name to avoid this, e.g.:

typedef enum {M2_state_A, M2_state_B} M2_state_t;
typedef enum {M1_state_A, M1_state_B} M1_state_t;

mortbopet avatar Aug 24 '22 09:08 mortbopet