|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
问题是CASE 语句在仿真时,,当CIN为1或0时会执行第一个分支,但CIN不为1或0时并没有执行
others那个分支,为什么呢??好郁闷那,希望高手不吝赐教!!
library ieee ;
use ieee.std_logic_1164.all;
entity count8 is
port(result_o : out integer range 0 to 256:=0 ;
cin,sel,gate,clk: in std_logic;
cout: out std_logic);
end count8;
architecture count8_behav of count8 is
begin
process(clk,gate,cin)
variable counter:integer range 0 to 256:=0;
variable x :integer range 0 to 256:=0;
begin
if sel='1' then
if gate='1' then
case cin is --case 语句
when '1'|'0'=>
if((cin'event) and (cin='1') )then
counter:=counter+1;
x:=counter;
if counter=256 then
cout<='0'; ---creating a plus.
counter:=0;
x:=counter;
else
cout<='1';
end if;
end if;
when others => -----问题是cin不为‘1’或‘0’时,他为什么不执行下面的分支??
if((clk'event) and (clk='1' ) )then
counter:=counter+1;
x:=counter;
if counter=256 then ---creating a pulse.
cout<='0';
counter:=0;
x:=counter;
else
cout<='1';
end if;
end if;
end case;
else
result_o<=x;
counter:=0;
end if;
end if;
end process;
end count8_behav;
[ 本帖最后由 XMUSZQ 于 2007-5-13 15:12 编辑 ] |
|