aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/synth/synth-expr.adb7
-rw-r--r--src/synth/synth-insts.adb3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index b30aa94ce..701724aa1 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -1573,6 +1573,13 @@ package body Synth.Expr is
Right := Synth_Expression_With_Type (Syn_Inst, Right_Expr, Typ);
Strip_Const (Right);
+ -- Return a static value if both operands are static.
+ -- Note: we know the value of left if it is not constant.
+ if Is_Const_Val (Left) and then Is_Const_Val (Right) then
+ Val := Get_Const_Discrete (Right);
+ return Create_Value_Discrete (Val, Boolean_Type);
+ end if;
+
N := Build_Dyadic (Build_Context, Id,
Get_Net (Left), Get_Net (Right));
Set_Location (N, Expr);
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index 411ddcd38..3665e8954 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -556,6 +556,8 @@ package body Synth.Insts is
Val := Synth_Subtype_Conversion (Val, Inter_Type, True, Assoc);
+ pragma Assert (Is_Const (Val));
+
Create_Object (Sub_Inst, Inter, Val);
Next_Association_Interface (Assoc, Assoc_Inter);
@@ -980,6 +982,7 @@ package body Synth.Insts is
Inter_Type := Get_Value_Type (Syn_Inst, Get_Type (Inter));
Val := Synth_Expression_With_Type
(Syn_Inst, Get_Default_Value (Inter), Inter_Type);
+ pragma Assert (Is_Const (Val));
Create_Object (Syn_Inst, Inter, Val);
end;
Inter := Get_Chain (Inter);