diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-disp_vhdl.adb | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/src/synth/synth-disp_vhdl.adb b/src/synth/synth-disp_vhdl.adb index 01046a297..f96a51494 100644 --- a/src/synth/synth-disp_vhdl.adb +++ b/src/synth/synth-disp_vhdl.adb @@ -368,27 +368,35 @@ package body Synth.Disp_Vhdl is elsif Is_Std_Logic_Array (Btype) then -- unsigned, signed or a compatible array. W := Typ.Abound.Len; - Put (" " & Pfx & " <= "); - -- 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 (");"); + Put (" " & Pfx); + if W = 1 then + Put ("(" & Pfx & "'left) <= "); + Disp_Out_Rhs (Mname, Off, W, Full); + Put_Line (";"); + else + Put (" <= "); + -- 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 (");"); + end if; else declare Bnd : Bound_Type renames Typ.Abound; |