diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-06 15:41:15 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-06 15:41:15 +0200 |
commit | 1938ee7b5d0c65c46776ab3574cbb7716dbae2ea (patch) | |
tree | d4d6845a7d8ad25be1dc3248641b029ab5327ea3 /src | |
parent | dd00294b4e91f2f93c45e91d89be0223e74b94ea (diff) | |
download | ghdl-1938ee7b5d0c65c46776ab3574cbb7716dbae2ea.tar.gz ghdl-1938ee7b5d0c65c46776ab3574cbb7716dbae2ea.tar.bz2 ghdl-1938ee7b5d0c65c46776ab3574cbb7716dbae2ea.zip |
synth: handle /= with non-matching length. For #968
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-oper.adb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb index caa5b3742..fbd345be0 100644 --- a/src/synth/synth-oper.adb +++ b/src/synth/synth-oper.adb @@ -412,7 +412,6 @@ package body Synth.Oper is return Synth_Compare (Id_Ult); when Iir_Predefined_Array_Equality => - -- TODO: check size, handle non-vector. if Is_Const (Left) and then Is_Const (Right) then return Create_Value_Discrete (Boolean'Pos (Is_Equal (Left, Right)), Boolean_Type); @@ -425,12 +424,17 @@ package body Synth.Oper is end if; return Synth_Compare (Id_Eq); when Iir_Predefined_Array_Inequality => - -- TODO: check size, handle non-vector. - if Is_Vector_Type (Left_Type) then - return Synth_Compare (Id_Ne); - else - raise Internal_Error; + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete + (Boolean'Pos (not Is_Equal (Left, Right)), Boolean_Type); end if; + if not Is_Matching_Bounds (Left.Typ, Right.Typ) then + Warning_Msg_Synth + (+Expr, + "length of '/=' operands doesn't match, result is true"); + return Create_Value_Discrete (1, Boolean_Type); + end if; + return Synth_Compare (Id_Ne); when Iir_Predefined_Array_Greater => -- TODO: check size, non-vector. -- TODO: that's certainly not the correct operator. |