aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorPepijn de Vos <pepijndevos@gmail.com>2019-05-28 19:06:48 +0200
committerTristan Gingold <tgingold@free.fr>2019-05-28 19:06:48 +0200
commit7619ac406427a30e2963e11ad67b43b6aae26ee5 (patch)
treef4e76290176d7ba88a1069f13e723b3254d8a890 /src/synth
parentddae75977eac872eecaa7c3f45003f6bb1ecd068 (diff)
downloadghdl-7619ac406427a30e2963e11ad67b43b6aae26ee5.tar.gz
ghdl-7619ac406427a30e2963e11ad67b43b6aae26ee5.tar.bz2
ghdl-7619ac406427a30e2963e11ad67b43b6aae26ee5.zip
synth: add support for constants.
Close #815
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-decls.adb2
-rw-r--r--src/synth/synth-expr.adb8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 576a90918..545e3b408 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -76,6 +76,8 @@ package body Synth.Decls is
-- Ignore default value.
Make_Object (Syn_Inst, Wire_Variable, Decl);
Create_Var_Wire (Syn_Inst, Decl, null);
+ when Iir_Kind_Constant_Declaration =>
+ null;
when Iir_Kind_Signal_Declaration =>
declare
Def : constant Iir := Get_Default_Value (Decl);
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 51e187f4f..147ce8a1b 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -25,6 +25,7 @@ with Vhdl.Ieee.Std_Logic_1164;
with Vhdl.Std_Package;
with Vhdl.Errors; use Vhdl.Errors;
with Simul.Execution;
+with Simul.Annotations; use Simul.Annotations;
with Grt.Types; use Grt.Types;
with Synth.Errors; use Synth.Errors;
@@ -522,6 +523,10 @@ package body Synth.Expr is
| Iir_Kind_Variable_Declaration
| Iir_Kind_Signal_Declaration =>
return Get_Value (Syn_Inst, Name);
+ when Iir_Kind_Constant_Declaration =>
+ return Create_Value_Lit(
+ Syn_Inst.Sim.Objects(Get_Info(Name).Slot),
+ Get_Type(Name));
when others =>
Error_Kind ("synth_name", Name);
end case;
@@ -840,7 +845,8 @@ package body Synth.Expr is
return Synth_Slice_Name (Syn_Inst, Expr);
when Iir_Kind_Character_Literal
| Iir_Kind_Integer_Literal
- | Iir_Kind_String_Literal8 =>
+ | Iir_Kind_String_Literal8
+ | Iir_Kind_Enumeration_Literal =>
return Create_Value_Lit
(Simul.Execution.Execute_Expression (Syn_Inst.Sim, Expr),
Get_Base_Type (Get_Type (Expr)));