aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-30 14:44:05 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-30 14:44:05 +0200
commitf87d2b70f2056193af833629cb37368798f36e8b (patch)
treecc0b712afaf3b1a6849c73581c1e039dba4725ff /src
parentfdad6f32d73f5207b999e7cebe8f1c25d33ade09 (diff)
downloadghdl-f87d2b70f2056193af833629cb37368798f36e8b.tar.gz
ghdl-f87d2b70f2056193af833629cb37368798f36e8b.tar.bz2
ghdl-f87d2b70f2056193af833629cb37368798f36e8b.zip
synth: handle more comparisons.
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-expr.adb40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index fdbccadaa..45e065a26 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -611,16 +611,6 @@ package body Synth.Expr is
No_Bound);
end Synth_Compare_Uns_Nat;
- function Synth_Compare_Uns_Uns (Id : Compare_Module_Id)
- return Value_Acc is
- begin
- return Create_Value_Net
- (Build_Compare (Build_Context, Id,
- Get_Net (Left, Ltype),
- Get_Net (Right, Rtype)),
- No_Bound);
- end Synth_Compare_Uns_Uns;
-
function Synth_Vec_Dyadic (Id : Dyadic_Module_Id) return Value_Acc
is
L : constant Net := Get_Net (Left, Ltype);
@@ -649,6 +639,20 @@ package body Synth.Expr is
Rtype);
end Synth_Dyadic_Uns;
+ function Synth_Compare_Uns_Uns (Id : Compare_Module_Id)
+ return Value_Acc
+ is
+ L : constant Net := Get_Net (Left, Ltype);
+ R : constant Net := Get_Net (Right, Rtype);
+ W : constant Width := Width'Max (Get_Width (L), Get_Width (R));
+ begin
+ return Create_Value_Net
+ (Build_Compare (Build_Context, Id,
+ Synth_Uresize (L, W),
+ Synth_Uresize (R, W)),
+ No_Bound);
+ end Synth_Compare_Uns_Uns;
+
function Synth_Dyadic_Uns_Nat (Id : Dyadic_Module_Id) return Value_Acc
is
L : constant Net := Get_Net (Left, Ltype);
@@ -704,6 +708,13 @@ package body Synth.Expr is
end if;
end if;
return Synth_Compare (Id_Eq);
+ when Iir_Predefined_Enum_Inequality =>
+ if Is_Bit_Type (Ltype) then
+ pragma Assert (Is_Bit_Type (Rtype));
+ -- TODO
+ raise Internal_Error;
+ end if;
+ return Synth_Compare (Id_Ne);
when Iir_Predefined_Array_Equality =>
-- TODO: check size, handle non-vector.
@@ -727,10 +738,17 @@ package body Synth.Expr is
return Synth_Compare_Uns_Nat (Id_Eq);
when Iir_Predefined_Ieee_Numeric_Std_Eq_Uns_Uns
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Eq_Slv_Slv =>
- -- "=" (Unsigned, Unsigned)
+ -- "=" (Unsigned, Unsigned) [resize]
return Synth_Compare_Uns_Uns (Id_Eq);
when Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Nat =>
+ -- "<" (Unsigned, Natural)
return Synth_Compare_Uns_Nat (Id_Ult);
+ when Iir_Predefined_Ieee_Std_Logic_Unsigned_Lt_Slv_Slv =>
+ -- "<" (Unsigned, Unsigned) [resize]
+ return Synth_Compare_Uns_Uns (Id_Ult);
+ when Iir_Predefined_Ieee_Std_Logic_Unsigned_Le_Slv_Slv =>
+ -- "<=" (Unsigned, Unsigned) [resize]
+ return Synth_Compare_Uns_Uns (Id_Ule);
when Iir_Predefined_Array_Element_Concat =>
declare
L : constant Net := Get_Net (Left, Ltype);