Altera_Forum
Honored Contributor
12 years agoComparison of numeric_std.unsigned fails
Hi,
I've just started learning VHDL and already experience the first "unsolveable" problems, Although I've done some research I wasn't able to solve this question myself, please don't be harsh even in case it is a complete newbie-question. I would like to compare two "unsigned" vectors, however using quartus I always get: Error (10327): VHDL error at census.vhd(31): can't determine definition of operator ""<"" -- found 0 possible definitionsLIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.all;
ARCHITECTURE rtl OF comptest IS
FUNCTION cmp_line(center : UNSIGNED(7 downto 0))
RETURN UNSIGNED IS
BEGIN
RETURN center < to_unsigned(2, 8); -- probably will require cast when comparison-operator can be resolved
END cmp_census_line;
BEGIN
.... Another thing i noticed, is that I do not need to specify the bit-count of the unsigned for parameter and return types in the function. Will those be inferred from the caller or will some (1?) default value be used instead? Thank you in advance, Reggi