|
我刚学VHDL语言,编写一个package包,然后调用,可是好多错误,请大侠指点;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
package dp16 is
function add( a : std_logic;
b : std_logic)
return std_logic;
end dp16;
package body dp16 is
function add(a:std_logic;
b:std_logic)
return std_logic is
variable tmp:std_logic;
begin
tmp := a + b;
return tmp;
end add;
end dp16;
这是我写的package,下面为顶层程序:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use work.dp16.all;
entity adder is
port(en:in std_logic;
a:in std_logic;
b:in std_logic;
cout:out std_logic
);
end adder;
architecture behav of adder is
begin
process(en)
begin
if en='1' then cout<=add(a,b);
--elsif en='0' then cout<='0';
else null;
end if;
end process;
end behav;
提示下面的错误
Error (10327): VHDL error at dp16.vhd(17): can't determine definition of operator ""+"" -- found 0 possible definitions |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|