我的程序代码如下:
.
.
ad:inout std_logic_vector(2 downto 0);
.
.
process(clk,reset)
begin
if reset='0' then
ad_out<="101";
elsif clk='1' and clk'event then
if ce='0' then
ad_in<=ad;
elsif ce='1' then
ad<=ad_out;
end if;
end if;
end process;
这是我写的测试inout型信号的程序,在仿真图中发现,ad总线只是相当于out型,这句ad<=ad_out功能实现了,这句ad_in<=ad没有起作用。我分为两个进程,但还是不行,应该怎么办啊?
library ieee;
use ieee.std_logic_1164.all;
entity tbus is
port(datab:inout std_logic_vector(7 downto 0);
din:in std_logic_vector(7 downto 0);
doutut std_logic_vector(7 downto 0);
rd:in std_logic;
ce:in std_logic);
end tbus;
architecture a_tbus of tbus is
begin
datab<=din when ce='0' and rd='0' else (others=>'1');
dout<=datab when ce='0' and rd='1' else (others=>'1');
end a_tbus;
上面的这段程序在max plus2 中编译可以通过,仿真时在datab【inout std_logic_vector(7 downto 0)】上信号是不确定的。
如果用modelsim仿真可以得到正确地结果
到底是程序的问题还是软件的问题?????????????????????????????????????????????????????????????????????????
library ieee;
use ieee.std_logic_1164.all;
entity tbus is
port(datab:inout std_logic_vector(7 downto 0);
din:in std_logic_vector(7 downto 0);
doutut std_logic_vector(7 downto 0);
rd:in std_logic;
ce:in std_logic);
end tbus;
architecture a_tbus of tbus is
begin
datab<=din when ce='0' and rd='0' else (others=>'z'); //改为z
dout<=datab when ce='0' and rd='1' else (others=>'1');
end a_tbus;