1

I've wasted hours on looking for a single working definition on ANY comparison operator: This is always the compiler answer (minus the varying operator) : "found '0' definitions of operator ">=", cannot determine exact overloaded matching definition for ">=""

Here's the tiny code:

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
--USE IEEE.NUMERIC_STD.ALL;

ENTITY dec IS
  PORT ( bin : IN std_logic_vector (9 DOWNTO 0);
       unary :OUT std_logic_vector (1022 DOWNTO 0));
END dec;

ARCHITECTURE rtl OF dec IS

BEGIN
  G: FOR i IN 0 TO 1022 GENERATE
    unary(i) <= ( bin >= i );
  END GENERATE G;
END rtl;

Changing everything for the libraries to the "bin" signal type to the ONLY relevant statement "unary(i) <= ( bin >= i )" (using casts, changing the operation (even though it's useless other than maybe for debugging), swapping operands, and so on). Even using any combination of those variations (all those I've tried so far - and there's a lot of them), none are an existing definition of any comparison operator.

Hopefully that question is clear enough, thanks.

1 Answer 1

2

First of all:
Don't use STD_LOGIC_ARITH and STD_LOGIC_UNSIGNED. These packages are obsolete.

Use NUMERIC_STD that's enough. It comes with an UNSIGNED and SIGNED type as well as operators for these types.

Secondly - like in every other language - a comparision operator returns a boolean value, no STD_LOGIC or BIT.

Last but not least: Arithmetic operators are only defined on 'arithmetic types' like UNSIGNED or SIGNED. So a cast is needed to compare a STD_LOGIC_VECTOR with an INTEGER.

Rewritten code:

gen : for i in unary'range generate
  unary(i) <= '1' when (unsigned(bin) >= i)) else '0';
end generate;
4
  • I did try both (because the situation is desperately disappointing). Don't worry, I know to normally use numeric_std... As for the boolean result, it have always been possible before to assign it to a std_logic (NOT std_logic_vector, where do you see that)... anyway, the function fails before assignment. Do you have any idea why something so mundane refuses to work ? Aug 21, 2015 at 0:22
  • Sorry, my answer was not complete. I needed to save it, so I could copy your code into my answer and edit the lines. (Writing via Android App)
    – Paebbels
    Aug 21, 2015 at 0:33
  • No the error message was correct :). There is no greater-equal operator for input types STD_LOGIC_VECTOR,INTEGER and the output type STD_LOGIC.
    – Paebbels
    Aug 21, 2015 at 0:37
  • @Whatever-toomuchtimewastedinBS When this answer solved your problem, please mark it as solved :).
    – Paebbels
    Aug 21, 2015 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.