阅读:1705回复:8
这inout端口有什么错?
大家帮我看看下面的程序,编译无错误,可综合,但是综合的时候会出现:
18705 WARNING: Design pin LAD Direction changed: OUT to OUT; 快疯掉了,就是搞不定inout类型的端口 library ieee; use ieee.std_logic_1164.all; entity testiopin is port(lad:inout std_logic; ads,lwrd,datain:in std_logic; dataout:out std_logic); end; architecture art of testiopin is begin process(ads) begin if(ads\'event and ads=\'0\')then dataout<=lad; elsif(ads\'event and ads=\'1\')then if(lwrd=\'0\')then lad<=datain; end if; end if; end process; end art; |
|
沙发#
发布于:2003-12-11 18:13
library ieee;
use ieee.std_logic_1164.all; entity testiopin is port( lad:inout std_logic; ads,lwrd,datain:in std_logic; dataout: out std_logic ); end; architecture art of testiopin is begin dataout<=lad; lad<=datain when (ads=\'1\' and lwrd=\'0\') else \'z\'; end art; [编辑 - 12/11/03 by link_bridge] |
|
板凳#
发布于:2003-12-11 18:48
我就从没用过高阻状态,真是太感谢了
|
|
地板#
发布于:2004-01-03 10:51
我对VHDL中的inout端口也整的不是很明白,不过我对上面版主的程序,
library ieee; use ieee.std_logic_1164.all; entity iopin is port( lad :inout std_logic; ads,lwrd,datain :in std_logic; dataout :out std_logic); end iopin; architecture arch of iopin is begin dataout<=lad; lad<=datain when ads=\'1\' and lwrd=\'0\' else \'Z\'; end arch; 在maxplus2中进行仿真,连编译也没通过,出现的错误为: Error:TRI or OPNDRN buffer \':27\' already drives a BIDIR pin \'lad\',it cannot also drive pin \'dataout\' 我所保存的是VHDL程序。 |
|
|
地下室#
发布于:2004-01-03 11:42
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity testiopin is port( lad:inout std_logic;-- ads:in std_logic; CP:in std_logic; datain:in std_logic; dataout: out std_logic ); end; architecture art of testiopin is begin lad<=datain when (ads=\'1\' ) else \'Z\'; process(CP) begin if cp\'event and cp=\'1\' then dataout<=lad\'; end if; end process; end art; [编辑 - 1/3/04 by link_bridge] |
|
5楼#
发布于:2004-01-04 16:13
版主:
谢谢你给的上面的程序,我在maxplus2中进行了编译没有问题,在仿真的时候,maxplus2自动将lad(inout)设置成了输入和输出两个端口(即输入lad和输出lad),在ads为高电平时lad作为输出lad<=datain ,但是仿真时由于存在输入lad,所以仿真结果在ads为高时lad输出与datain不等,而是‘X’; |
|
|
6楼#
发布于:2004-01-04 16:57
如果lad是作为输出的话,那么lad输入的哪个脚应该设置成X状态。
|
|
7楼#
发布于:2004-01-04 16:57
仿真的时候。
|
|
8楼#
发布于:2004-01-04 17:12
我将仿真波形考下来了,麻烦你看看。我到ALTER网站http://www.altera.com/support/examples/vhdl/v_bidir.html
它的双向端口程序,我拿来仿真也出现这种情况。 |
|
|