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 two_number_split is
Port (number : in integer range 0 to 99;
position0 : out STD_LOGIC_VECTOR (3 downto 0);
position1 : out STD_LOGIC_VECTOR (3 downto 0));
end two_number_split;
architecture Behavioral of two_number_split is
signal pos0, pos1 : STD_LOGIC_VECTOR(3 downto 0);
begin
convert: process(number, pos0, pos1)
begin
pos1 <= number/10;
pos0 <= number mod 10;
position0 <= std_logic_vector(pos0);
position1 <= std_logic_vector(pos1);
end process convert;
end Behavioral;
ERROR:HDLCompiler:1638 - "C:\Users\XXX\Documents\SS\ISE_Ex\seven_segment\two_numbers.vhd" Line 19: found '0' definitions of operator "/", cannot determine exact overloaded matching definition for "/"
ERROR:HDLCompiler:1638 - "C:\Users\XXX\Documents\SS\ISE_Ex\seven_segment\two_numbers.vhd" Line 20: found '0' definitions of operator "mod", cannot determine exact overloaded matching definition for "mod"
我想我只是使用了错误的库。任何建议吗?我已经尝试了上面列出的库的所有组合,不知道发生了什么。
我知道一个逻辑向量是一个位数组。但我正在取一个十进制数并将其分成两个代表每个数字的位数组。 IE浏览器。 99的输入将使得pos0 1001和pos1 1001. – marshmallow 2014-09-10 22:56:01
如果你使用定义了除法和mod运算符的类型,就会发生这种情况。您有两种选择可以用我的答案中描述的标准库来完成这一任务。看起来您可能试图将其输出到七段显示器,在这种情况下,您可能希望使用不需要任何除法的双重算法转换为BCD。 – 2014-09-10 23:28:34