diff options
-rw-r--r-- | python/libghdl/thin/vhdl/nodes.py | 216 | ||||
-rw-r--r-- | src/synth/synth-oper.adb | 292 | ||||
-rw-r--r-- | src/vhdl/vhdl-ieee-numeric.adb | 120 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 42 |
4 files changed, 482 insertions, 188 deletions
diff --git a/python/libghdl/thin/vhdl/nodes.py b/python/libghdl/thin/vhdl/nodes.py index 5fce2f2e8..ce31bcf20 100644 --- a/python/libghdl/thin/vhdl/nodes.py +++ b/python/libghdl/thin/vhdl/nodes.py @@ -1257,96 +1257,132 @@ class Iir_Predefined: Ieee_Numeric_Std_Ne_Sgn_Sgn = 274 Ieee_Numeric_Std_Ne_Sgn_Int = 275 Ieee_Numeric_Std_Ne_Int_Sgn = 276 - Ieee_Numeric_Std_Shl_Uns_Nat = 277 - Ieee_Numeric_Std_Shr_Uns_Nat = 278 - Ieee_Numeric_Std_Shl_Sgn_Nat = 279 - Ieee_Numeric_Std_Shr_Sgn_Nat = 280 - Ieee_Numeric_Std_Sll_Uns_Int = 281 - Ieee_Numeric_Std_Sll_Sgn_Int = 282 - Ieee_Numeric_Std_Srl_Uns_Int = 283 - Ieee_Numeric_Std_Srl_Sgn_Int = 284 - Ieee_Numeric_Std_Sla_Uns_Int = 285 - Ieee_Numeric_Std_Sla_Sgn_Int = 286 - Ieee_Numeric_Std_Sra_Uns_Int = 287 - Ieee_Numeric_Std_Sra_Sgn_Int = 288 - Ieee_Numeric_Std_Rol_Uns_Nat = 289 - Ieee_Numeric_Std_Ror_Uns_Nat = 290 - Ieee_Numeric_Std_Rol_Sgn_Nat = 291 - Ieee_Numeric_Std_Ror_Sgn_Nat = 292 - Ieee_Numeric_Std_Not_Uns = 293 - Ieee_Numeric_Std_Not_Sgn = 294 - Ieee_Numeric_Std_Abs_Sgn = 295 - Ieee_Numeric_Std_And_Uns_Uns = 296 - Ieee_Numeric_Std_And_Sgn_Sgn = 297 - Ieee_Numeric_Std_Or_Uns_Uns = 298 - Ieee_Numeric_Std_Or_Sgn_Sgn = 299 - Ieee_Numeric_Std_Nand_Uns_Uns = 300 - Ieee_Numeric_Std_Nand_Sgn_Sgn = 301 - Ieee_Numeric_Std_Nor_Uns_Uns = 302 - Ieee_Numeric_Std_Nor_Sgn_Sgn = 303 - Ieee_Numeric_Std_Xor_Uns_Uns = 304 - Ieee_Numeric_Std_Xor_Sgn_Sgn = 305 - Ieee_Numeric_Std_Xnor_Uns_Uns = 306 - Ieee_Numeric_Std_Xnor_Sgn_Sgn = 307 - Ieee_Numeric_Std_Neg_Uns = 308 - Ieee_Numeric_Std_Neg_Sgn = 309 - Ieee_Numeric_Std_Match_Log = 310 - Ieee_Numeric_Std_Match_Uns = 311 - Ieee_Numeric_Std_Match_Sgn = 312 - Ieee_Numeric_Std_Match_Slv = 313 - Ieee_Numeric_Std_Match_Suv = 314 - Ieee_Math_Real_Ceil = 315 - Ieee_Math_Real_Round = 316 - Ieee_Math_Real_Log2 = 317 - Ieee_Math_Real_Sin = 318 - Ieee_Math_Real_Cos = 319 - Ieee_Std_Logic_Unsigned_Add_Slv_Slv = 320 - Ieee_Std_Logic_Unsigned_Add_Slv_Int = 321 - Ieee_Std_Logic_Unsigned_Add_Int_Slv = 322 - Ieee_Std_Logic_Unsigned_Add_Slv_Sl = 323 - Ieee_Std_Logic_Unsigned_Add_Sl_Slv = 324 - Ieee_Std_Logic_Unsigned_Sub_Slv_Slv = 325 - Ieee_Std_Logic_Unsigned_Sub_Slv_Int = 326 - Ieee_Std_Logic_Unsigned_Sub_Int_Slv = 327 - Ieee_Std_Logic_Unsigned_Sub_Slv_Sl = 328 - Ieee_Std_Logic_Unsigned_Sub_Sl_Slv = 329 - Ieee_Std_Logic_Unsigned_Lt_Slv_Slv = 330 - Ieee_Std_Logic_Unsigned_Lt_Slv_Int = 331 - Ieee_Std_Logic_Unsigned_Lt_Int_Slv = 332 - Ieee_Std_Logic_Unsigned_Le_Slv_Slv = 333 - Ieee_Std_Logic_Unsigned_Le_Slv_Int = 334 - Ieee_Std_Logic_Unsigned_Le_Int_Slv = 335 - Ieee_Std_Logic_Unsigned_Gt_Slv_Slv = 336 - Ieee_Std_Logic_Unsigned_Gt_Slv_Int = 337 - Ieee_Std_Logic_Unsigned_Gt_Int_Slv = 338 - Ieee_Std_Logic_Unsigned_Ge_Slv_Slv = 339 - Ieee_Std_Logic_Unsigned_Ge_Slv_Int = 340 - Ieee_Std_Logic_Unsigned_Ge_Int_Slv = 341 - Ieee_Std_Logic_Unsigned_Eq_Slv_Slv = 342 - Ieee_Std_Logic_Unsigned_Eq_Slv_Int = 343 - Ieee_Std_Logic_Unsigned_Eq_Int_Slv = 344 - Ieee_Std_Logic_Unsigned_Ne_Slv_Slv = 345 - Ieee_Std_Logic_Unsigned_Ne_Slv_Int = 346 - Ieee_Std_Logic_Unsigned_Ne_Int_Slv = 347 - Ieee_Std_Logic_Unsigned_Conv_Integer = 348 - Ieee_Std_Logic_Signed_Add_Slv_Slv = 349 - Ieee_Std_Logic_Signed_Add_Slv_Int = 350 - Ieee_Std_Logic_Signed_Add_Int_Slv = 351 - Ieee_Std_Logic_Signed_Add_Slv_Sl = 352 - Ieee_Std_Logic_Signed_Add_Sl_Slv = 353 - Ieee_Std_Logic_Signed_Sub_Slv_Slv = 354 - Ieee_Std_Logic_Signed_Sub_Slv_Int = 355 - Ieee_Std_Logic_Signed_Sub_Int_Slv = 356 - Ieee_Std_Logic_Signed_Sub_Slv_Sl = 357 - Ieee_Std_Logic_Signed_Sub_Sl_Slv = 358 - Ieee_Std_Logic_Arith_Conv_Unsigned_Int = 359 - Ieee_Std_Logic_Arith_Conv_Unsigned_Uns = 360 - Ieee_Std_Logic_Arith_Conv_Unsigned_Sgn = 361 - Ieee_Std_Logic_Arith_Conv_Unsigned_Log = 362 - Ieee_Std_Logic_Arith_Conv_Integer_Int = 363 - Ieee_Std_Logic_Arith_Conv_Integer_Uns = 364 - Ieee_Std_Logic_Arith_Conv_Integer_Sgn = 365 - Ieee_Std_Logic_Arith_Conv_Integer_Log = 366 + Ieee_Numeric_Std_Match_Gt_Uns_Uns = 277 + Ieee_Numeric_Std_Match_Gt_Uns_Nat = 278 + Ieee_Numeric_Std_Match_Gt_Nat_Uns = 279 + Ieee_Numeric_Std_Match_Gt_Sgn_Sgn = 280 + Ieee_Numeric_Std_Match_Gt_Sgn_Int = 281 + Ieee_Numeric_Std_Match_Gt_Int_Sgn = 282 + Ieee_Numeric_Std_Match_Lt_Uns_Uns = 283 + Ieee_Numeric_Std_Match_Lt_Uns_Nat = 284 + Ieee_Numeric_Std_Match_Lt_Nat_Uns = 285 + Ieee_Numeric_Std_Match_Lt_Sgn_Sgn = 286 + Ieee_Numeric_Std_Match_Lt_Sgn_Int = 287 + Ieee_Numeric_Std_Match_Lt_Int_Sgn = 288 + Ieee_Numeric_Std_Match_Le_Uns_Uns = 289 + Ieee_Numeric_Std_Match_Le_Uns_Nat = 290 + Ieee_Numeric_Std_Match_Le_Nat_Uns = 291 + Ieee_Numeric_Std_Match_Le_Sgn_Sgn = 292 + Ieee_Numeric_Std_Match_Le_Sgn_Int = 293 + Ieee_Numeric_Std_Match_Le_Int_Sgn = 294 + Ieee_Numeric_Std_Match_Ge_Uns_Uns = 295 + Ieee_Numeric_Std_Match_Ge_Uns_Nat = 296 + Ieee_Numeric_Std_Match_Ge_Nat_Uns = 297 + Ieee_Numeric_Std_Match_Ge_Sgn_Sgn = 298 + Ieee_Numeric_Std_Match_Ge_Sgn_Int = 299 + Ieee_Numeric_Std_Match_Ge_Int_Sgn = 300 + Ieee_Numeric_Std_Match_Eq_Uns_Uns = 301 + Ieee_Numeric_Std_Match_Eq_Uns_Nat = 302 + Ieee_Numeric_Std_Match_Eq_Nat_Uns = 303 + Ieee_Numeric_Std_Match_Eq_Sgn_Sgn = 304 + Ieee_Numeric_Std_Match_Eq_Sgn_Int = 305 + Ieee_Numeric_Std_Match_Eq_Int_Sgn = 306 + Ieee_Numeric_Std_Match_Ne_Uns_Uns = 307 + Ieee_Numeric_Std_Match_Ne_Uns_Nat = 308 + Ieee_Numeric_Std_Match_Ne_Nat_Uns = 309 + Ieee_Numeric_Std_Match_Ne_Sgn_Sgn = 310 + Ieee_Numeric_Std_Match_Ne_Sgn_Int = 311 + Ieee_Numeric_Std_Match_Ne_Int_Sgn = 312 + Ieee_Numeric_Std_Shl_Uns_Nat = 313 + Ieee_Numeric_Std_Shr_Uns_Nat = 314 + Ieee_Numeric_Std_Shl_Sgn_Nat = 315 + Ieee_Numeric_Std_Shr_Sgn_Nat = 316 + Ieee_Numeric_Std_Sll_Uns_Int = 317 + Ieee_Numeric_Std_Sll_Sgn_Int = 318 + Ieee_Numeric_Std_Srl_Uns_Int = 319 + Ieee_Numeric_Std_Srl_Sgn_Int = 320 + Ieee_Numeric_Std_Sla_Uns_Int = 321 + Ieee_Numeric_Std_Sla_Sgn_Int = 322 + Ieee_Numeric_Std_Sra_Uns_Int = 323 + Ieee_Numeric_Std_Sra_Sgn_Int = 324 + Ieee_Numeric_Std_Rol_Uns_Nat = 325 + Ieee_Numeric_Std_Ror_Uns_Nat = 326 + Ieee_Numeric_Std_Rol_Sgn_Nat = 327 + Ieee_Numeric_Std_Ror_Sgn_Nat = 328 + Ieee_Numeric_Std_Not_Uns = 329 + Ieee_Numeric_Std_Not_Sgn = 330 + Ieee_Numeric_Std_Abs_Sgn = 331 + Ieee_Numeric_Std_And_Uns_Uns = 332 + Ieee_Numeric_Std_And_Sgn_Sgn = 333 + Ieee_Numeric_Std_Or_Uns_Uns = 334 + Ieee_Numeric_Std_Or_Sgn_Sgn = 335 + Ieee_Numeric_Std_Nand_Uns_Uns = 336 + Ieee_Numeric_Std_Nand_Sgn_Sgn = 337 + Ieee_Numeric_Std_Nor_Uns_Uns = 338 + Ieee_Numeric_Std_Nor_Sgn_Sgn = 339 + Ieee_Numeric_Std_Xor_Uns_Uns = 340 + Ieee_Numeric_Std_Xor_Sgn_Sgn = 341 + Ieee_Numeric_Std_Xnor_Uns_Uns = 342 + Ieee_Numeric_Std_Xnor_Sgn_Sgn = 343 + Ieee_Numeric_Std_Neg_Uns = 344 + Ieee_Numeric_Std_Neg_Sgn = 345 + Ieee_Numeric_Std_Match_Log = 346 + Ieee_Numeric_Std_Match_Uns = 347 + Ieee_Numeric_Std_Match_Sgn = 348 + Ieee_Numeric_Std_Match_Slv = 349 + Ieee_Numeric_Std_Match_Suv = 350 + Ieee_Math_Real_Ceil = 351 + Ieee_Math_Real_Round = 352 + Ieee_Math_Real_Log2 = 353 + Ieee_Math_Real_Sin = 354 + Ieee_Math_Real_Cos = 355 + Ieee_Std_Logic_Unsigned_Add_Slv_Slv = 356 + Ieee_Std_Logic_Unsigned_Add_Slv_Int = 357 + Ieee_Std_Logic_Unsigned_Add_Int_Slv = 358 + Ieee_Std_Logic_Unsigned_Add_Slv_Sl = 359 + Ieee_Std_Logic_Unsigned_Add_Sl_Slv = 360 + Ieee_Std_Logic_Unsigned_Sub_Slv_Slv = 361 + Ieee_Std_Logic_Unsigned_Sub_Slv_Int = 362 + Ieee_Std_Logic_Unsigned_Sub_Int_Slv = 363 + Ieee_Std_Logic_Unsigned_Sub_Slv_Sl = 364 + Ieee_Std_Logic_Unsigned_Sub_Sl_Slv = 365 + Ieee_Std_Logic_Unsigned_Lt_Slv_Slv = 366 + Ieee_Std_Logic_Unsigned_Lt_Slv_Int = 367 + Ieee_Std_Logic_Unsigned_Lt_Int_Slv = 368 + Ieee_Std_Logic_Unsigned_Le_Slv_Slv = 369 + Ieee_Std_Logic_Unsigned_Le_Slv_Int = 370 + Ieee_Std_Logic_Unsigned_Le_Int_Slv = 371 + Ieee_Std_Logic_Unsigned_Gt_Slv_Slv = 372 + Ieee_Std_Logic_Unsigned_Gt_Slv_Int = 373 + Ieee_Std_Logic_Unsigned_Gt_Int_Slv = 374 + Ieee_Std_Logic_Unsigned_Ge_Slv_Slv = 375 + Ieee_Std_Logic_Unsigned_Ge_Slv_Int = 376 + Ieee_Std_Logic_Unsigned_Ge_Int_Slv = 377 + Ieee_Std_Logic_Unsigned_Eq_Slv_Slv = 378 + Ieee_Std_Logic_Unsigned_Eq_Slv_Int = 379 + Ieee_Std_Logic_Unsigned_Eq_Int_Slv = 380 + Ieee_Std_Logic_Unsigned_Ne_Slv_Slv = 381 + Ieee_Std_Logic_Unsigned_Ne_Slv_Int = 382 + Ieee_Std_Logic_Unsigned_Ne_Int_Slv = 383 + Ieee_Std_Logic_Unsigned_Conv_Integer = 384 + Ieee_Std_Logic_Signed_Add_Slv_Slv = 385 + Ieee_Std_Logic_Signed_Add_Slv_Int = 386 + Ieee_Std_Logic_Signed_Add_Int_Slv = 387 + Ieee_Std_Logic_Signed_Add_Slv_Sl = 388 + Ieee_Std_Logic_Signed_Add_Sl_Slv = 389 + Ieee_Std_Logic_Signed_Sub_Slv_Slv = 390 + Ieee_Std_Logic_Signed_Sub_Slv_Int = 391 + Ieee_Std_Logic_Signed_Sub_Int_Slv = 392 + Ieee_Std_Logic_Signed_Sub_Slv_Sl = 393 + Ieee_Std_Logic_Signed_Sub_Sl_Slv = 394 + Ieee_Std_Logic_Arith_Conv_Unsigned_Int = 395 + Ieee_Std_Logic_Arith_Conv_Unsigned_Uns = 396 + Ieee_Std_Logic_Arith_Conv_Unsigned_Sgn = 397 + Ieee_Std_Logic_Arith_Conv_Unsigned_Log = 398 + Ieee_Std_Logic_Arith_Conv_Integer_Int = 399 + Ieee_Std_Logic_Arith_Conv_Integer_Uns = 400 + Ieee_Std_Logic_Arith_Conv_Integer_Sgn = 401 + Ieee_Std_Logic_Arith_Conv_Integer_Log = 402 Get_Kind = libghdl.vhdl__nodes__get_kind Get_Location = libghdl.vhdl__nodes__get_location diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb index 8f1a48011..c32099fd3 100644 --- a/src/synth/synth-oper.adb +++ b/src/synth/synth-oper.adb @@ -192,6 +192,7 @@ package body Synth.Oper is Right_Type : constant Node := Get_Type (Get_Chain (Inter_Chain)); Left_Typ : constant Type_Acc := Get_Value_Type (Syn_Inst, Left_Type); Right_Typ : constant Type_Acc := Get_Value_Type (Syn_Inst, Right_Type); + Expr_Typ : constant Type_Acc := Get_Value_Type (Syn_Inst, Expr_Type); Left : Value_Acc; Right : Value_Acc; @@ -205,7 +206,8 @@ package body Synth.Oper is return Create_Value_Net (N, Left.Typ); end Synth_Bit_Dyadic; - function Synth_Compare (Id : Compare_Module_Id) return Value_Acc + function Synth_Compare (Id : Compare_Module_Id; Res_Type : Type_Acc) + return Value_Acc is N : Net; begin @@ -213,11 +215,11 @@ package body Synth.Oper is N := Build_Compare (Build_Context, Id, Get_Net (Left), Get_Net (Right)); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Type); end Synth_Compare; - function Synth_Compare_Array (Id, Id_Eq : Compare_Module_Id) - return Value_Acc + function Synth_Compare_Array (Id, Id_Eq : Compare_Module_Id; + Res_Type : Type_Acc) return Value_Acc is pragma Unreferenced (Id_Eq); N : Net; @@ -229,7 +231,7 @@ package body Synth.Oper is N := Build_Compare (Get_Build (Syn_Inst), Id, Get_Net (Left), Get_Net (Right)); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Type); elsif Left.Typ.W < Right.Typ.W then -- TODO: truncate right, compare using id_eq. raise Internal_Error; @@ -242,37 +244,48 @@ package body Synth.Oper is end if; end Synth_Compare_Array; - function Synth_Compare_Uns_Nat (Id : Compare_Module_Id) - return Value_Acc + function Synth_Compare_Uns_Nat + (Id : Compare_Module_Id; Res_Type : Type_Acc) return Value_Acc is N : Net; begin N := Synth_Uresize (Right, Left.Typ.W, Expr); N := Build_Compare (Build_Context, Id, Get_Net (Left), N); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Type); end Synth_Compare_Uns_Nat; - function Synth_Compare_Sgn_Int (Id : Compare_Module_Id) - return Value_Acc + function Synth_Compare_Nat_Uns + (Id : Compare_Module_Id; Res_Type : Type_Acc) return Value_Acc + is + N : Net; + begin + N := Synth_Uresize (Left, Right.Typ.W, Expr); + N := Build_Compare (Build_Context, Id, Get_Net (Right), N); + Set_Location (N, Expr); + return Create_Value_Net (N, Res_Type); + end Synth_Compare_Nat_Uns; + + function Synth_Compare_Sgn_Int + (Id : Compare_Module_Id; Res_Typ : Type_Acc) return Value_Acc is N : Net; begin N := Synth_Sresize (Right, Left.Typ.W, Expr); N := Build_Compare (Build_Context, Id, Get_Net (Left), N); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Typ); end Synth_Compare_Sgn_Int; - function Synth_Compare_Int_Sgn (Id : Compare_Module_Id) - return Value_Acc + function Synth_Compare_Int_Sgn + (Id : Compare_Module_Id; Res_Typ : Type_Acc) return Value_Acc is N : Net; begin N := Synth_Sresize (Left, Right.Typ.W, Expr); N := Build_Compare (Build_Context, Id, N, Get_Net (Right)); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Typ); end Synth_Compare_Int_Sgn; function Synth_Vec_Dyadic (Id : Dyadic_Module_Id) return Value_Acc @@ -340,8 +353,8 @@ package body Synth.Oper is return Create_Value_Net (N, Rtype); end Synth_Dyadic_Sgn; - function Synth_Compare_Uns_Uns (Id : Compare_Module_Id) - return Value_Acc + function Synth_Compare_Uns_Uns + (Id : Compare_Module_Id; Res_Type : Type_Acc) return Value_Acc is W : constant Width := Width'Max (Left.Typ.W, Right.Typ.W); L1, R1 : Net; @@ -351,7 +364,7 @@ package body Synth.Oper is R1 := Synth_Uresize (Right, W, Expr); N := Build_Compare (Build_Context, Id, L1, R1); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Type); end Synth_Compare_Uns_Uns; function Synth_Dyadic_Uns_Nat (Id : Dyadic_Module_Id) return Value_Acc @@ -390,8 +403,8 @@ package body Synth.Oper is return Create_Value_Net (N, Create_Res_Bound (Right)); end Synth_Dyadic_Int_Sgn; - function Synth_Compare_Sgn_Sgn (Id : Compare_Module_Id) - return Value_Acc + function Synth_Compare_Sgn_Sgn + (Id : Compare_Module_Id; Res_Typ : Type_Acc) return Value_Acc is W : constant Width := Width'Max (Left.Typ.W, Right.Typ.W); L1, R1 : Net; @@ -401,7 +414,7 @@ package body Synth.Oper is R1 := Synth_Sresize (Right, W, Expr); N := Build_Compare (Build_Context, Id, L1, R1); Set_Location (N, Expr); - return Create_Value_Net (N, Boolean_Type); + return Create_Value_Net (N, Res_Typ); end Synth_Compare_Sgn_Sgn; begin Left := Synth_Expression_With_Type (Syn_Inst, Left_Expr, Left_Typ); @@ -478,22 +491,43 @@ package body Synth.Oper is return Synth_Bit_Eq_Const (Right, Left, Expr); end if; end if; - return Synth_Compare (Id_Eq); + return Synth_Compare (Id_Eq, Boolean_Type); when Iir_Predefined_Enum_Inequality => -- TODO: Optimize ? - return Synth_Compare (Id_Ne); + return Synth_Compare (Id_Ne, Boolean_Type); when Iir_Predefined_Enum_Less_Equal => - return Synth_Compare (Id_Ult); + return Synth_Compare (Id_Ult, Boolean_Type); + + when Iir_Predefined_Std_Ulogic_Match_Equality => + return Synth_Compare (Id_Eq, Logic_Type); + when Iir_Predefined_Std_Ulogic_Match_Inequality => + return Synth_Compare (Id_Ne, Logic_Type); + when Iir_Predefined_Std_Ulogic_Match_Less => + return Synth_Compare (Id_Ult, Logic_Type); + when Iir_Predefined_Std_Ulogic_Match_Less_Equal => + return Synth_Compare (Id_Ule, Logic_Type); + when Iir_Predefined_Std_Ulogic_Match_Greater => + return Synth_Compare (Id_Ugt, Logic_Type); + when Iir_Predefined_Std_Ulogic_Match_Greater_Equal => + return Synth_Compare (Id_Uge, Logic_Type); when Iir_Predefined_Array_Equality - | Iir_Predefined_Record_Equality => + | Iir_Predefined_Record_Equality => if not Is_Matching_Bounds (Left.Typ, Right.Typ) then Warning_Msg_Synth (+Expr, "length of '=' operands doesn't match, result is false"); return Create_Value_Discrete (0, Boolean_Type); end if; - return Synth_Compare (Id_Eq); + return Synth_Compare (Id_Eq, Boolean_Type); + when Iir_Predefined_Std_Ulogic_Array_Match_Equality => + if not Is_Matching_Bounds (Left.Typ, Right.Typ) then + Warning_Msg_Synth + (+Expr, + "length of '?=' operands doesn't match, result is '0'"); + return Create_Value_Discrete (0, Logic_Type); + end if; + return Synth_Compare (Id_Eq, Logic_Type); when Iir_Predefined_Array_Inequality | Iir_Predefined_Record_Inequality => if not Is_Matching_Bounds (Left.Typ, Right.Typ) then @@ -502,11 +536,19 @@ package body Synth.Oper is "length of '/=' operands doesn't match, result is true"); return Create_Value_Discrete (1, Boolean_Type); end if; - return Synth_Compare (Id_Ne); + return Synth_Compare (Id_Ne, Boolean_Type); + when Iir_Predefined_Std_Ulogic_Array_Match_Inequality => + if not Is_Matching_Bounds (Left.Typ, Right.Typ) then + Warning_Msg_Synth + (+Expr, + "length of '/=' operands doesn't match, result is '1'"); + return Create_Value_Discrete (1, Logic_Type); + end if; + return Synth_Compare (Id_Ne, Logic_Type); when Iir_Predefined_Array_Greater => - return Synth_Compare_Array (Id_Ugt, Id_Uge); + return Synth_Compare_Array (Id_Ugt, Id_Uge, Boolean_Type); when Iir_Predefined_Array_Less => - return Synth_Compare_Array (Id_Ult, Id_Ule); + return Synth_Compare_Array (Id_Ult, Id_Ule, Boolean_Type); when Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Nat | Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Int => @@ -628,111 +670,165 @@ package body Synth.Oper is return Create_Value_Net (N, Rtype); end; - when Iir_Predefined_Ieee_Numeric_Std_Eq_Uns_Nat => - -- "=" (Unsigned, Natural) - 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 => + | Iir_Predefined_Ieee_Std_Logic_Unsigned_Eq_Slv_Slv + | Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Uns => -- "=" (Unsigned, Unsigned) [resize] - return Synth_Compare_Uns_Uns (Id_Eq); - when Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Int => + return Synth_Compare_Uns_Uns (Id_Eq, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Eq_Uns_Nat + | Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Nat => + -- "=" (Unsigned, Natural) + return Synth_Compare_Uns_Nat (Id_Eq, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Eq_Nat_Uns + | Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Nat_Uns => + -- "=" (Natural, Unsigned) [resize] + return Synth_Compare_Nat_Uns (Id_Eq, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Int + | Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Int => -- "=" (Signed, Integer) - return Synth_Compare_Sgn_Int (Id_Eq); - when Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Sgn => + return Synth_Compare_Sgn_Int (Id_Eq, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Sgn => -- "=" (Signed, Signed) [resize] - return Synth_Compare_Sgn_Sgn (Id_Eq); - when Iir_Predefined_Ieee_Numeric_Std_Eq_Int_Sgn => + return Synth_Compare_Sgn_Sgn (Id_Eq, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Eq_Int_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Int_Sgn => -- "=" (Integer, Signed) - return Synth_Compare_Int_Sgn (Id_Eq); + return Synth_Compare_Int_Sgn (Id_Eq, Expr_Typ); when Iir_Predefined_Ieee_Numeric_Std_Ne_Uns_Uns - | Iir_Predefined_Ieee_Std_Logic_Unsigned_Ne_Slv_Slv => + | Iir_Predefined_Ieee_Std_Logic_Unsigned_Ne_Slv_Slv + | Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Uns => -- "/=" (Unsigned, Unsigned) [resize] - return Synth_Compare_Uns_Uns (Id_Ne); - when Iir_Predefined_Ieee_Numeric_Std_Ne_Uns_Nat => + return Synth_Compare_Uns_Uns (Id_Ne, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ne_Uns_Nat + | Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Nat => -- "/=" (Unsigned, Natural) - return Synth_Compare_Uns_Nat (Id_Ne); - when Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Sgn => + return Synth_Compare_Uns_Nat (Id_Ne, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ne_Nat_Uns + | Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Nat_Uns => + -- "/=" (Natural, Unsigned) [resize] + return Synth_Compare_Nat_Uns (Id_Ne, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Sgn => -- "/=" (Signed, Signed) [resize] - return Synth_Compare_Sgn_Sgn (Id_Ne); - when Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Int => + return Synth_Compare_Sgn_Sgn (Id_Ne, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Int + | Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Int => -- "/=" (Signed, Integer) - return Synth_Compare_Sgn_Int (Id_Ne); - when Iir_Predefined_Ieee_Numeric_Std_Ne_Int_Sgn => + return Synth_Compare_Sgn_Int (Id_Ne, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ne_Int_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Int_Sgn => -- "/=" (Integer, Signed) - return Synth_Compare_Int_Sgn (Id_Ne); + return Synth_Compare_Int_Sgn (Id_Ne, Expr_Typ); - when Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Nat => + when Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Nat + | Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Nat => -- "<" (Unsigned, Natural) if Is_Static (Right) and then Right.Scal = 0 then -- Always false. - return Create_Value_Discrete (0, Boolean_Type); + return Create_Value_Discrete (0, Expr_Typ); end if; - return Synth_Compare_Uns_Nat (Id_Ult); + return Synth_Compare_Uns_Nat (Id_Ult, Expr_Typ); when Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Uns - | Iir_Predefined_Ieee_Std_Logic_Unsigned_Lt_Slv_Slv => + | Iir_Predefined_Ieee_Std_Logic_Unsigned_Lt_Slv_Slv + | Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Uns => -- "<" (Unsigned, Unsigned) [resize] - return Synth_Compare_Uns_Uns (Id_Ult); - when Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Sgn => + return Synth_Compare_Uns_Uns (Id_Ult, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Lt_Nat_Uns + | Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Nat_Uns => + -- "<" (Natural, Unsigned) [resize] + return Synth_Compare_Nat_Uns (Id_Ult, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Sgn => -- "<" (Signed, Signed) [resize] - return Synth_Compare_Sgn_Sgn (Id_Slt); - when Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Int => + return Synth_Compare_Sgn_Sgn (Id_Slt, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Int + | Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Int => -- "<" (Signed, Integer) - return Synth_Compare_Sgn_Int (Id_Slt); - when Iir_Predefined_Ieee_Numeric_Std_Lt_Int_Sgn => + return Synth_Compare_Sgn_Int (Id_Slt, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Lt_Int_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Int_Sgn => -- "<" (Integer, Signed) - return Synth_Compare_Int_Sgn (Id_Slt); + return Synth_Compare_Int_Sgn (Id_Slt, Expr_Typ); when Iir_Predefined_Ieee_Numeric_Std_Le_Uns_Uns - | Iir_Predefined_Ieee_Std_Logic_Unsigned_Le_Slv_Slv => + | Iir_Predefined_Ieee_Std_Logic_Unsigned_Le_Slv_Slv + | Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Uns => -- "<=" (Unsigned, Unsigned) [resize] - return Synth_Compare_Uns_Uns (Id_Ule); - when Iir_Predefined_Ieee_Numeric_Std_Le_Uns_Nat => + return Synth_Compare_Uns_Uns (Id_Ule, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Le_Uns_Nat + | Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Nat => -- "<=" (Unsigned, Natural) - return Synth_Compare_Uns_Nat (Id_Ule); - when Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Sgn => + return Synth_Compare_Uns_Nat (Id_Ule, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Le_Nat_Uns + | Iir_Predefined_Ieee_Numeric_Std_Match_Le_Nat_Uns => + -- "<=" (Natural, Unsigned) [resize] + return Synth_Compare_Nat_Uns (Id_Ule, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Sgn => -- "<=" (Signed, Signed) - return Synth_Compare_Sgn_Sgn (Id_Sle); - when Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Int => + return Synth_Compare_Sgn_Sgn (Id_Sle, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Int + | Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Int => -- "<=" (Signed, Integer) - return Synth_Compare_Sgn_Int (Id_Sle); - when Iir_Predefined_Ieee_Numeric_Std_Le_Int_Sgn => + return Synth_Compare_Sgn_Int (Id_Sle, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Le_Int_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Le_Int_Sgn => -- "<=" (Integer, Signed) - return Synth_Compare_Int_Sgn (Id_Sle); + return Synth_Compare_Int_Sgn (Id_Sle, Expr_Typ); - when Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Nat => - -- ">" (Unsigned, Natural) - return Synth_Compare_Uns_Nat (Id_Ugt); when Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Uns - | Iir_Predefined_Ieee_Std_Logic_Unsigned_Gt_Slv_Slv => + | 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); - when Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Sgn => + return Synth_Compare_Uns_Uns (Id_Ugt, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Nat + | Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Nat => + -- ">" (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 => + -- ">" (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 => -- ">" (Signed, Signed) [resize] - return Synth_Compare_Sgn_Sgn (Id_Sgt); - when Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Int => + 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 => -- ">" (Signed, Integer) - return Synth_Compare_Sgn_Int (Id_Sgt); - when Iir_Predefined_Ieee_Numeric_Std_Gt_Int_Sgn => - -- ">=" (Integer, Signed) - return Synth_Compare_Int_Sgn (Id_Sgt); + 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 => + -- ">" (Integer, Signed) + return Synth_Compare_Int_Sgn (Id_Sgt, Expr_Typ); when Iir_Predefined_Ieee_Numeric_Std_Ge_Uns_Uns - | Iir_Predefined_Ieee_Std_Logic_Unsigned_Ge_Slv_Slv => + | Iir_Predefined_Ieee_Std_Logic_Unsigned_Ge_Slv_Slv + | Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Uns => -- ">=" (Unsigned, Unsigned) [resize] - return Synth_Compare_Uns_Uns (Id_Uge); - when Iir_Predefined_Ieee_Numeric_Std_Ge_Uns_Nat => + return Synth_Compare_Uns_Uns (Id_Uge, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ge_Nat_Uns + | Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Nat_Uns => + -- ">=" (Natural, Unsigned) [resize] + return Synth_Compare_Nat_Uns (Id_Uge, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ge_Uns_Nat + | Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Nat => -- ">=" (Unsigned, Natural) - return Synth_Compare_Uns_Nat (Id_Uge); - when Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Sgn => + return Synth_Compare_Uns_Nat (Id_Uge, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Sgn => -- ">=" (Signed, Signed) [resize] - return Synth_Compare_Sgn_Sgn (Id_Sge); - when Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Int => + return Synth_Compare_Sgn_Sgn (Id_Sge, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Int + | Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Int => -- ">=" (Signed, Integer) - return Synth_Compare_Sgn_Int (Id_Sge); - when Iir_Predefined_Ieee_Numeric_Std_Ge_Int_Sgn => + return Synth_Compare_Sgn_Int (Id_Sge, Expr_Typ); + when Iir_Predefined_Ieee_Numeric_Std_Ge_Int_Sgn + | Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Int_Sgn => -- ">=" (Integer, Signed) - return Synth_Compare_Int_Sgn (Id_Sge); + return Synth_Compare_Int_Sgn (Id_Sge, Expr_Typ); when Iir_Predefined_Array_Element_Concat => declare @@ -836,17 +932,17 @@ package body Synth.Oper is (+Expr, "non-constant exponentiation not supported"); return null; when Iir_Predefined_Integer_Less_Equal => - return Synth_Compare (Id_Sle); + return Synth_Compare (Id_Sle, Boolean_Type); when Iir_Predefined_Integer_Less => - return Synth_Compare (Id_Slt); + return Synth_Compare (Id_Slt, Boolean_Type); when Iir_Predefined_Integer_Greater_Equal => - return Synth_Compare (Id_Sge); + return Synth_Compare (Id_Sge, Boolean_Type); when Iir_Predefined_Integer_Greater => - return Synth_Compare (Id_Sgt); + return Synth_Compare (Id_Sgt, Boolean_Type); when Iir_Predefined_Integer_Equality => - return Synth_Compare (Id_Eq); + return Synth_Compare (Id_Eq, Boolean_Type); when Iir_Predefined_Integer_Inequality => - return Synth_Compare (Id_Ne); + return Synth_Compare (Id_Ne, Boolean_Type); when Iir_Predefined_Physical_Physical_Div => Error_Msg_Synth (+Expr, "non-constant division not supported"); return null; diff --git a/src/vhdl/vhdl-ieee-numeric.adb b/src/vhdl/vhdl-ieee-numeric.adb index 10aa92d53..990f74b5e 100644 --- a/src/vhdl/vhdl-ieee-numeric.adb +++ b/src/vhdl/vhdl-ieee-numeric.adb @@ -220,6 +220,114 @@ package body Vhdl.Ieee.Numeric is (others => (others => Iir_Predefined_None))); + Match_Eq_Patterns : constant Binary_Pattern_Type := + (Pkg_Std => + (Type_Unsigned => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Uns, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Nat, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Nat_Uns, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None), + Type_Signed => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Sgn, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Int, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Int_Sgn, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None)), + Pkg_Bit => + (others => + (others => Iir_Predefined_None))); + + Match_Ne_Patterns : constant Binary_Pattern_Type := + (Pkg_Std => + (Type_Unsigned => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Uns, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Nat, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Nat_Uns, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None), + Type_Signed => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Sgn, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Int, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Int_Sgn, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None)), + Pkg_Bit => + (others => + (others => Iir_Predefined_None))); + + Match_Lt_Patterns : constant Binary_Pattern_Type := + (Pkg_Std => + (Type_Unsigned => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Uns, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Nat, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Nat_Uns, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None), + Type_Signed => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Sgn, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Int, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Int_Sgn, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None)), + Pkg_Bit => + (others => + (others => Iir_Predefined_None))); + + Match_Le_Patterns : constant Binary_Pattern_Type := + (Pkg_Std => + (Type_Unsigned => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Uns, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Nat, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Nat_Uns, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None), + Type_Signed => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Sgn, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Int, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Int_Sgn, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None)), + Pkg_Bit => + (others => + (others => Iir_Predefined_None))); + + Match_Gt_Patterns : constant Binary_Pattern_Type := + (Pkg_Std => + (Type_Unsigned => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Uns, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Nat, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Nat_Uns, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None), + Type_Signed => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Sgn, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Int, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Int_Sgn, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None)), + Pkg_Bit => + (others => + (others => Iir_Predefined_None))); + + Match_Ge_Patterns : constant Binary_Pattern_Type := + (Pkg_Std => + (Type_Unsigned => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Uns, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Nat, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Nat_Uns, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None), + Type_Signed => + (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Sgn, + Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Int, + Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Int_Sgn, + Arg_Vect_Log => Iir_Predefined_None, + Arg_Log_Vect => Iir_Predefined_None)), + Pkg_Bit => + (others => + (others => Iir_Predefined_None))); + Neg_Patterns : constant Unary_Pattern_Type := (Pkg_Std => (Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Neg_Uns, @@ -645,6 +753,18 @@ package body Vhdl.Ieee.Numeric is Handle_Binary (Gt_Patterns); when Name_Op_Greater_Equal => Handle_Binary (Ge_Patterns); + when Name_Op_Match_Equality => + Handle_Binary (Match_Eq_Patterns); + when Name_Op_Match_Inequality => + Handle_Binary (Match_Ne_Patterns); + when Name_Op_Match_Less => + Handle_Binary (Match_Lt_Patterns); + when Name_Op_Match_Less_Equal => + Handle_Binary (Match_Le_Patterns); + when Name_Op_Match_Greater => + Handle_Binary (Match_Gt_Patterns); + when Name_Op_Match_Greater_Equal => + Handle_Binary (Match_Ge_Patterns); when Name_And => Handle_Binary (And_Patterns); when Name_Or => diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 1305632d7..c7bec2747 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -5553,6 +5553,48 @@ package Vhdl.Nodes is Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Int, Iir_Predefined_Ieee_Numeric_Std_Ne_Int_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Nat, + Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Nat_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Int, + Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Int_Sgn, + + Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Nat, + Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Nat_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Int, + Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Int_Sgn, + + Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Nat, + Iir_Predefined_Ieee_Numeric_Std_Match_Le_Nat_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Int, + Iir_Predefined_Ieee_Numeric_Std_Match_Le_Int_Sgn, + + Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Nat, + Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Nat_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Int, + Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Int_Sgn, + + Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Nat, + Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Nat_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Int, + Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Int_Sgn, + + Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Nat, + Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Nat_Uns, + Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Int, + Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Int_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Shl_Uns_Nat, Iir_Predefined_Ieee_Numeric_Std_Shr_Uns_Nat, Iir_Predefined_Ieee_Numeric_Std_Shl_Sgn_Nat, |