aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-02 09:55:34 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-02 09:55:34 +0100
commitd13df4fd44358e070de5cc4d9c1e61f6ef8af56b (patch)
treee7ccd2d635c73cd4854f5edce72447c0aec241e6
parent49705e73b9907b2fe3ea1de8e9ad406892ceaf4b (diff)
downloadghdl-d13df4fd44358e070de5cc4d9c1e61f6ef8af56b.tar.gz
ghdl-d13df4fd44358e070de5cc4d9c1e61f6ef8af56b.tar.bz2
ghdl-d13df4fd44358e070de5cc4d9c1e61f6ef8af56b.zip
synth: fix to_string for character
-rw-r--r--src/simul/simul-vhdl_elab.adb3
-rw-r--r--src/synth/synth-vhdl_eval.adb10
2 files changed, 12 insertions, 1 deletions
diff --git a/src/simul/simul-vhdl_elab.adb b/src/simul/simul-vhdl_elab.adb
index eca3ac783..fed1c7d74 100644
--- a/src/simul/simul-vhdl_elab.adb
+++ b/src/simul/simul-vhdl_elab.adb
@@ -985,6 +985,9 @@ package body Simul.Vhdl_Elab is
when Iir_Kind_Package_Declaration =>
Gather_Processes_Decls
(Inst, Get_Declaration_Chain (N));
+ when Iir_Kind_Package_Instantiation_Declaration =>
+ Gather_Processes_Decls
+ (Inst, Get_Declaration_Chain (N));
when Iir_Kind_Configuration_Declaration =>
null;
when others =>
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