aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-19 12:08:33 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-19 12:08:33 +0200
commita131ab5138f7a8bea69b4ff9434f287e77ef6f10 (patch)
tree6d42a2d52374ccfe946783fa8d31781bc9da558c
parent8fb42ce39ad5392557b281fa3d607bb7c6d79c5e (diff)
downloadghdl-a131ab5138f7a8bea69b4ff9434f287e77ef6f10.tar.gz
ghdl-a131ab5138f7a8bea69b4ff9434f287e77ef6f10.tar.bz2
ghdl-a131ab5138f7a8bea69b4ff9434f287e77ef6f10.zip
synth-oper: handle std_logic_arith_mul_uns_sgn_sgn. For #1239
-rw-r--r--src/synth/synth-oper.adb34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index c87a61235..758ca6b06 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -995,6 +995,21 @@ package body Synth.Oper is
Set_Location (N, Expr);
return Create_Value_Net (N, Rtype);
end;
+ when Iir_Predefined_Ieee_Std_Logic_Arith_Mul_Uns_Sgn_Sgn =>
+ -- "*" (unsigned, signed)
+ declare
+ W : constant Width := Left.Typ.W + 1 + Right.Typ.W;
+ Rtype : Type_Acc;
+ L, R : Net;
+ N : Net;
+ begin
+ L := Synth_Uresize (Left, W, Left_Expr);
+ R := Synth_Sresize (Right, W, Right_Expr);
+ Rtype := Create_Vec_Type_By_Length (W, Left.Typ.Vec_El);
+ N := Build_Dyadic (Build_Context, Id_Smul, L, R);
+ Set_Location (N, Expr);
+ return Create_Value_Net (N, Rtype);
+ end;
when Iir_Predefined_Ieee_Numeric_Std_Div_Uns_Uns
| Iir_Predefined_Ieee_Numeric_Std_Div_Uns_Nat =>
@@ -1142,30 +1157,31 @@ package body Synth.Oper is
return Synth_Compare_Int_Sgn (Id_Sle, Expr_Typ);
when Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Uns
- | Iir_Predefined_Ieee_Std_Logic_Unsigned_Gt_Slv_Slv
- | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Uns =>
+ | Iir_Predefined_Ieee_Std_Logic_Unsigned_Gt_Slv_Slv
+ | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Uns =>
-- ">" (Unsigned, Unsigned) [resize]
return Synth_Compare_Uns_Uns (Id_Ugt, Expr_Typ);
when Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Nat
- | Iir_Predefined_Ieee_Std_Logic_Unsigned_Gt_Slv_Int
- | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Nat =>
+ | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Nat
+ | Iir_Predefined_Ieee_Std_Logic_Unsigned_Gt_Slv_Int =>
-- ">" (Unsigned, Natural)
return Synth_Compare_Uns_Nat (Id_Ugt, Expr_Typ);
when Iir_Predefined_Ieee_Numeric_Std_Gt_Nat_Uns
- | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Nat_Uns =>
+ | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Nat_Uns =>
-- ">" (Natural, Unsigned) [resize]
return Synth_Compare_Nat_Uns (Id_Ugt, Expr_Typ);
when Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Sgn
- | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Sgn
- | Iir_Predefined_Ieee_Std_Logic_Arith_Gt_Sgn_Sgn =>
+ | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Sgn
+ | Iir_Predefined_Ieee_Std_Logic_Arith_Gt_Sgn_Sgn =>
-- ">" (Signed, Signed) [resize]
return Synth_Compare_Sgn_Sgn (Id_Sgt, Expr_Typ);
when Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Int
- | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Int =>
+ | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Int
+ | Iir_Predefined_Ieee_Std_Logic_Arith_Gt_Sgn_Int =>
-- ">" (Signed, Integer)
return Synth_Compare_Sgn_Int (Id_Sgt, Expr_Typ);
when Iir_Predefined_Ieee_Numeric_Std_Gt_Int_Sgn
- | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Int_Sgn =>
+ | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Int_Sgn =>
-- ">" (Integer, Signed)
return Synth_Compare_Int_Sgn (Id_Sgt, Expr_Typ);