diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-07-27 05:42:44 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-07-27 05:42:44 +0200 |
commit | 1f3162b29845bbe75bc0d3fac7d67e3eb60a24a7 (patch) | |
tree | ee251bc3f2ec78dadfe7dcc1f52c86082f6454ef | |
parent | 14ce9c64ec5e662366fa1c6456283e0704f729f4 (diff) | |
download | ghdl-1f3162b29845bbe75bc0d3fac7d67e3eb60a24a7.tar.gz ghdl-1f3162b29845bbe75bc0d3fac7d67e3eb60a24a7.tar.bz2 ghdl-1f3162b29845bbe75bc0d3fac7d67e3eb60a24a7.zip |
synth-disp_vhdl: improve output for unsigned. Fix #2139
-rw-r--r-- | src/synth/synth-disp_vhdl.adb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/synth/synth-disp_vhdl.adb b/src/synth/synth-disp_vhdl.adb index f7ef56c50..01046a297 100644 --- a/src/synth/synth-disp_vhdl.adb +++ b/src/synth/synth-disp_vhdl.adb @@ -369,8 +369,23 @@ package body Synth.Disp_Vhdl is -- unsigned, signed or a compatible array. W := Typ.Abound.Len; Put (" " & Pfx & " <= "); - Put (Name_Table.Image (Get_Identifier - (Get_Type_Declarator (Btype)))); + -- First the first non-anonymous parent type of the prefix. + -- We could directly use the base type, but: + -- * it is less intuitive + -- * vhdl2008 base type of 'unsigned' is 'unresolved_unsigned', + -- which is barely used and not defined in vhdl93 + declare + Pfx_Type : Node; + Type_Decl : Node; + begin + Pfx_Type := Ptype; + loop + Type_Decl := Get_Type_Declarator (Pfx_Type); + exit when Type_Decl /= Null_Node; + Pfx_Type := Get_Parent_Type (Pfx_Type); + end loop; + Put (Name_Table.Image (Get_Identifier (Type_Decl))); + end; Put ("("); Disp_Out_Rhs (Mname, Off, W, Full); Put_Line (");"); |