aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-09-03 06:01:56 +0200
committerTristan Gingold <tgingold@free.fr>2019-09-03 06:33:39 +0200
commitdac322e43b97e0d3bfd9cdf0e98f1a7c458501cb (patch)
tree6c703ed50ed33ac0fe00c3377bdf795d21f26c8c
parent473bc44fdeee10d3d3de650a1f76af83c1aa19ce (diff)
downloadghdl-dac322e43b97e0d3bfd9cdf0e98f1a7c458501cb.tar.gz
ghdl-dac322e43b97e0d3bfd9cdf0e98f1a7c458501cb.tar.bz2
ghdl-dac322e43b97e0d3bfd9cdf0e98f1a7c458501cb.zip
synth: subtype conversion before compare.
-rw-r--r--src/synth/synth-expr.adb9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 8320f2897..bfaef8f17 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -946,9 +946,14 @@ package body Synth.Expr is
function Synth_Compare (Id : Compare_Module_Id) return Value_Acc
is
N : Net;
+ L, R : Value_Acc;
+ Typ : Type_Acc;
begin
- N := Build_Compare (Build_Context, Id,
- Get_Net (Left), Get_Net (Right));
+ pragma Assert (Left_Type = Right_Type);
+ Typ := Get_Value_Type (Syn_Inst, Left_Type);
+ L := Synth_Subtype_Conversion (Left, Typ, Expr);
+ R := Synth_Subtype_Conversion (Right, Typ, Expr);
+ N := Build_Compare (Build_Context, Id, Get_Net (L), Get_Net (R));
Set_Location (N, Expr);
return Create_Value_Net (N, Boolean_Type);
end Synth_Compare;