aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-03 20:41:14 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-03 20:41:14 +0200
commit8dee86c299dce882d5ee670f851915d6717dd334 (patch)
tree0a2f201a2307526bb329fc06227317bde43b18df /src
parent69f8848564646a368708d109b99a2400fb4e4f8e (diff)
downloadghdl-8dee86c299dce882d5ee670f851915d6717dd334.tar.gz
ghdl-8dee86c299dce882d5ee670f851915d6717dd334.tar.bz2
ghdl-8dee86c299dce882d5ee670f851915d6717dd334.zip
synth-oper: convert type of unary operation operand.
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-expr.adb2
-rw-r--r--src/synth/synth-oper.adb12
-rw-r--r--src/synth/synth-oper.ads2
3 files changed, 12 insertions, 4 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 545f6ba62..aa743c5e3 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -1557,7 +1557,7 @@ package body Synth.Expr is
or else Def in Iir_Predefined_IEEE_Explicit
then
return Synth_Monadic_Operation
- (Syn_Inst, Def, Get_Operand (Expr), Expr);
+ (Syn_Inst, Imp, Get_Operand (Expr), Expr);
else
Error_Unknown_Operator (Imp, Expr);
raise Internal_Error;
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index 92508f36d..acb637918 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -751,10 +751,16 @@ package body Synth.Oper is
end Synth_Dyadic_Operation;
function Synth_Monadic_Operation (Syn_Inst : Synth_Instance_Acc;
- Def : Iir_Predefined_Functions;
+ Imp : Node;
Operand_Expr : Node;
Loc : Node) return Value_Acc
is
+ Def : constant Iir_Predefined_Functions :=
+ Get_Implicit_Definition (Imp);
+ Inter_Chain : constant Node :=
+ Get_Interface_Declaration_Chain (Imp);
+ Oper_Type : constant Node := Get_Type (Inter_Chain);
+ Oper_Typ : constant Type_Acc := Get_Value_Type (Syn_Inst, Oper_Type);
Operand : Value_Acc;
function Synth_Bit_Monadic (Id : Monadic_Module_Id) return Value_Acc
@@ -787,7 +793,9 @@ package body Synth.Oper is
return Create_Value_Net (N, Operand.Typ.Vec_El);
end Synth_Vec_Reduce_Monadic;
begin
- Operand := Synth_Expression (Syn_Inst, Operand_Expr);
+ Operand := Synth_Expression_With_Type (Syn_Inst, Operand_Expr, Oper_Typ);
+ Operand := Synth_Subtype_Conversion (Operand, Oper_Typ, False, Loc);
+
case Def is
when Iir_Predefined_Error =>
return null;
diff --git a/src/synth/synth-oper.ads b/src/synth/synth-oper.ads
index 69fbb232d..3f8e09bee 100644
--- a/src/synth/synth-oper.ads
+++ b/src/synth/synth-oper.ads
@@ -33,7 +33,7 @@ package Synth.Oper is
Expr : Node) return Value_Acc;
function Synth_Monadic_Operation (Syn_Inst : Synth_Instance_Acc;
- Def : Iir_Predefined_Functions;
+ Imp : Node;
Operand_Expr : Node;
Loc : Node) return Value_Acc;
end Synth.Oper;