Skip to content

Commit

Permalink
synth: fix handling of std_logic_unsigned."-" for negative numbers.
Browse files Browse the repository at this point in the history
Fix #1951
  • Loading branch information
tgingold committed Jan 18, 2022
1 parent 25ccaf3 commit c22b2f1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/synth/synth-vhdl_oper.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1118,12 +1118,14 @@ package body Synth.Vhdl_Oper is
| Iir_Predefined_Ieee_Std_Logic_Arith_Add_Log_Sgn_Slv =>
-- "+" (Unsigned, Unsigned)
return Synth_Dyadic_Uns_Uns (Ctxt, Id_Add, Left, Right, Expr);
when Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Nat
| Iir_Predefined_Ieee_Std_Logic_Arith_Add_Uns_Int_Slv
| Iir_Predefined_Ieee_Std_Logic_Arith_Add_Uns_Int_Uns
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Int =>
when Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Nat =>
-- "+" (Unsigned, Natural)
return Synth_Dyadic_Uns_Nat (Ctxt, Id_Add, Left, Right, Expr);
when Iir_Predefined_Ieee_Std_Logic_Arith_Add_Uns_Int_Slv
| Iir_Predefined_Ieee_Std_Logic_Arith_Add_Uns_Int_Uns
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Int =>
-- "+" (Unsigned, Integer)
return Synth_Dyadic_Sgn_Int (Ctxt, Id_Add, Left, Right, Expr);
when Iir_Predefined_Ieee_Numeric_Std_Add_Nat_Uns
| Iir_Predefined_Ieee_Std_Logic_Arith_Add_Int_Uns_Uns
| Iir_Predefined_Ieee_Std_Logic_Arith_Add_Int_Uns_Slv
Expand Down Expand Up @@ -1184,12 +1186,14 @@ package body Synth.Vhdl_Oper is
| Iir_Predefined_Ieee_Std_Logic_Signed_Sub_Slv_Slv =>
-- "-" (Signed, Signed)
return Synth_Dyadic_Sgn_Sgn (Ctxt, Id_Sub, Left, Right, Expr);
when Iir_Predefined_Ieee_Numeric_Std_Sub_Uns_Nat
| Iir_Predefined_Ieee_Std_Logic_Arith_Sub_Uns_Int_Uns
| Iir_Predefined_Ieee_Std_Logic_Arith_Sub_Uns_Int_Slv
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Sub_Slv_Int =>
when Iir_Predefined_Ieee_Numeric_Std_Sub_Uns_Nat =>
-- "-" (Unsigned, Natural)
return Synth_Dyadic_Uns_Nat (Ctxt, Id_Sub, Left, Right, Expr);
when Iir_Predefined_Ieee_Std_Logic_Arith_Sub_Uns_Int_Uns
| Iir_Predefined_Ieee_Std_Logic_Arith_Sub_Uns_Int_Slv
| Iir_Predefined_Ieee_Std_Logic_Unsigned_Sub_Slv_Int =>
-- "-" (Unsigned, Integer)
return Synth_Dyadic_Sgn_Int (Ctxt, Id_Sub, Left, Right, Expr);
when Iir_Predefined_Ieee_Numeric_Std_Sub_Nat_Uns
| Iir_Predefined_Ieee_Std_Logic_Arith_Sub_Int_Uns_Uns
| Iir_Predefined_Ieee_Std_Logic_Arith_Sub_Int_Uns_Slv
Expand Down

0 comments on commit c22b2f1

Please sign in to comment.