aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-02-11 18:30:15 +0100
committerTristan Gingold <tgingold@free.fr>2020-02-11 18:30:15 +0100
commit0605f04fb3a0dbbf7d78d6478a5652b890acec0f (patch)
treefdfccd3cc8a62f02ee81e44f2c65864b951d8757
parentd454b7ff9f4d930bddcf58e60933928e7446fc41 (diff)
downloadghdl-0605f04fb3a0dbbf7d78d6478a5652b890acec0f.tar.gz
ghdl-0605f04fb3a0dbbf7d78d6478a5652b890acec0f.tar.bz2
ghdl-0605f04fb3a0dbbf7d78d6478a5652b890acec0f.zip
synth-oper: handle add for (natural, unsigned). Fix #1132
-rw-r--r--src/synth/synth-oper.adb15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index 763c34c7e..7ed87de68 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -380,6 +380,18 @@ package body Synth.Oper is
return Create_Value_Net (N, Create_Res_Bound (Left));
end Synth_Dyadic_Uns_Nat;
+ function Synth_Dyadic_Nat_Uns (Id : Dyadic_Module_Id) return Value_Acc
+ is
+ R : constant Net := Get_Net (Right);
+ L1 : Net;
+ N : Net;
+ begin
+ L1 := Synth_Uresize (Left, Right.Typ.W, Expr);
+ N := Build_Dyadic (Build_Context, Id, L1, R);
+ Set_Location (N, Expr);
+ return Create_Value_Net (N, Create_Res_Bound (Right));
+ end Synth_Dyadic_Nat_Uns;
+
function Synth_Dyadic_Sgn_Int (Id : Dyadic_Module_Id) return Value_Acc
is
L : constant Net := Get_Net (Left);
@@ -613,6 +625,9 @@ package body Synth.Oper is
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Int =>
-- "+" (Unsigned, Natural)
return Synth_Dyadic_Uns_Nat (Id_Add);
+ when Iir_Predefined_Ieee_Numeric_Std_Add_Nat_Uns =>
+ -- "+" (Natural, Unsigned)
+ return Synth_Dyadic_Nat_Uns (Id_Add);
when Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Uns
| Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Log
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Sl