aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-static_oper.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-13 18:41:53 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-13 18:41:53 +0100
commit2143539b0943bc0917cb485c4571b8f9efe9df7f (patch)
tree557010d8ca34ef24f47fcdb2be78512decb64220 /src/synth/synth-static_oper.adb
parent8b062ed9ee5107400d176d703dd8bb22eaf0138e (diff)
downloadghdl-2143539b0943bc0917cb485c4571b8f9efe9df7f.tar.gz
ghdl-2143539b0943bc0917cb485c4571b8f9efe9df7f.tar.bz2
ghdl-2143539b0943bc0917cb485c4571b8f9efe9df7f.zip
synth: handle static sub uns/nat.
Diffstat (limited to 'src/synth/synth-static_oper.adb')
-rw-r--r--src/synth/synth-static_oper.adb17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/synth/synth-static_oper.adb b/src/synth/synth-static_oper.adb
index 30169c8a4..251e25693 100644
--- a/src/synth/synth-static_oper.adb
+++ b/src/synth/synth-static_oper.adb
@@ -294,6 +294,21 @@ package body Synth.Static_Oper is
end;
end Synth_Sub_Uns_Uns;
+ function Synth_Sub_Uns_Nat (L, R : Value_Acc; Loc : Syn_Src)
+ return Value_Acc
+ is
+ pragma Unreferenced (Loc);
+ L_Arr : Std_Logic_Vector (1 .. Natural (L.Arr.Len));
+ R_Val : constant Uns64 := Uns64 (R.Scal);
+ begin
+ To_Std_Logic_Vector (L, L_Arr);
+ declare
+ Res_Arr : constant Std_Logic_Vector := Sub_Uns_Nat (L_Arr, R_Val);
+ begin
+ return To_Value_Acc (Res_Arr, L.Typ.Vec_El);
+ end;
+ end Synth_Sub_Uns_Nat;
+
function Synth_Mul_Uns_Uns (L, R : Value_Acc; Loc : Syn_Src)
return Value_Acc
is
@@ -640,6 +655,8 @@ package body Synth.Static_Oper is
when Iir_Predefined_Ieee_Numeric_Std_Sub_Uns_Uns =>
return Synth_Sub_Uns_Uns (Left, Right, Expr);
+ when Iir_Predefined_Ieee_Numeric_Std_Sub_Uns_Nat =>
+ return Synth_Sub_Uns_Nat (Left, Right, Expr);
when Iir_Predefined_Ieee_Numeric_Std_Mul_Uns_Uns =>
return Synth_Mul_Uns_Uns (Left, Right, Expr);