|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
怎么把x1,x2,x3的值导出来,到输出端啊?赋值给x11,x22,x33?
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY wash IS
PORT
(
clk: in std_logic;
on_off,choice : IN STD_LOGIC;
hold : in std_logic;
x11,x22,x33,signout: out std_logic;
time_t ut std_logic_vector(4 downto 0);
count : OUT STD_LOGIC_vector(2 downto 0)
);
END wash;
ARCHITECTURE a OF wash IS
SIGNAL count_c : STD_LOGIC_vector(2 downto 0);
signal x1,x2,x3: std_logic;
signal sign :std_logic;
signal time :std_logic_vector(4 downto 0);
BEGIN
PROCESS (choice)
variable xa:std_logic:=x1;
variable xb:std_logic:=x2;
variable xc:std_logic:=x3;
BEGIN
IF (choice'event and choice='1') THEN
IF on_off='0' THEN
count_c<="000";
ELSIF
count_c="101" THEN
count_c<="001";
ELSE
count_c<=count_c+1;
END IF;
END IF;
case count_c is
when "000" => xa:='0';xb:='0';xc:='0';
when "001" => xa:='1';xb:='1';xc:='1';
when "010" => xa:='1';xb:='0';xc:='0';
when "011" => xa:='0';xb:='1';xc:='0';
when "100" => xa:='0';xb:='0';xc:='1';
when others => xa:='0';xb:='1';xc:='1';
end case;
x1<=xa;
x2<=xb;
x3<=xc;
end process;
count<=count_c;
process(clk)
variable sign_s :std_logic;
begin
IF (hold'event and hold='1') THEN
sign_s := not sign_s;
end if;
sign<=sign_s;
end process;
signout<=sign;
mROCESS (clk)
BEGIN
if( sign='1' )then
if( x1='1')then
if(clk'event and clk='1') then
if(time="11110")then
x1<='0';
if(time="11110")then
time<="00000";
end if;
else
time<=time+1;
end if;
end if;
elsif( x1='0' and x2='1')then
if(clk'event and clk='1') then
if(time="01111")then
x2<='0';
if(time="01111")then
time<="00000";
end if;
else
time<=time+1;
end if;
end if;
elsif( x1='0' and x2='0' and x3='1' )then
if(clk'event and clk='1') then
if(time="10100")then
x3<='0';
if(time="10100")then
time<="00000";
end if;
else
time<=time+1;
end if;
end if;
end if;
end if;
END PROCESS ;
END a; |
|