From d13df4fd44358e070de5cc4d9c1e61f6ef8af56b Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 2 Jan 2023 09:55:34 +0100 Subject: synth: fix to_string for character --- src/synth/synth-vhdl_eval.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/synth') diff --git a/src/synth/synth-vhdl_eval.adb b/src/synth/synth-vhdl_eval.adb index 31592bb59..2191e7a9c 100644 --- a/src/synth/synth-vhdl_eval.adb +++ b/src/synth/synth-vhdl_eval.adb @@ -27,6 +27,7 @@ with Grt.To_Strings; with Grt.Arith; with Grt.Fcvt; +with Vhdl.Std_Package; with Vhdl.Utils; with Vhdl.Evaluation; with Vhdl.Ieee.Std_Logic_1164; use Vhdl.Ieee.Std_Logic_1164; @@ -776,7 +777,14 @@ package body Synth.Vhdl_Eval is V := Read_Discrete (Param.Mem, Param.Typ); Lit := Get_Nth_Element (Enums, Natural (V)); Lit_Id := Get_Identifier (Lit); - if Is_Character (Lit_Id) then + + -- LRM08 5.7 String representations + -- - For a given value of type CHARACTER, the string representation + -- contains one element that is the given value. + if Etype = Vhdl.Std_Package.Character_Type_Definition then + C (1) := Character'Val (V); + return String_To_Memtyp (C, Res_Typ); + elsif Is_Character (Lit_Id) then C (1) := Get_Character (Lit_Id); return String_To_Memtyp (C, Res_Typ); else -- cgit v1.2.3