From 1f3162b29845bbe75bc0d3fac7d67e3eb60a24a7 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 27 Jul 2022 05:42:44 +0200 Subject: synth-disp_vhdl: improve output for unsigned. Fix #2139 --- src/synth/synth-disp_vhdl.adb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/synth/synth-disp_vhdl.adb') 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 (");"); -- cgit v1.2.3