|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
这是一个双向端口的代码
我总共定义了7个双向端口,为了方便我定义了自己的类型
type LINKBUS is array (7 downto 1) of std_logic_vector(7 downto 0); --Gary add
使用的package方式,可以综合的时候出错,
请问各位大侠 有没有好的解决方法?
谢谢
红色这一行出错,应该是package调用的问题,可是不知道如何修改
Error (10482): VHDL error at BidirPort.vhd(15): object "std_logic" is used but not declared
代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
package MyDef is
type LINKBUS is array (7 downto 1) of std_logic_vector(7 downto 0); --Gary add
end MyDef;
use work.MyDef.all;
entity BidirPort is
port(
Dir : in std_logic;
Sel : in std_logic_vector(2 downto 0);
Dbus : inout std_logic_vector(7 downto 0);
Din : in LINKBUS;
Dout : out LINKBUS
);
end BidirPort;
architecture BidirPort_a of BidirPort is
begin
process( Sel,Dbus,Dir,Din)
begin
if (Dir = '1') then -- Dbus out
if (Sel = "000") then
for n in 1 to 7 loop
Dout(n)<= Dbus;
end loop;
elsif(Sel <= "111") then
Dout(CONV_INTEGER(Sel)) <= Dbus;
end if;
Dbus <= (others => 'Z');
else
if (Sel >= "001" and Sel <= "111") then
Dbus <= Din(CONV_INTEGER(Sel));
end if;
for n in 1 to 7 loop
Dout(n) <= (others => 'Z');
end loop;
end if;
end process;
end BidirPort_a;
[ 本帖最后由 smattershi 于 2007-5-5 01:46 编辑 ] |
|