level 3
皓泪淡淡
楼主
不是太懂啊 跪求大神帮忙
代码是
汽车尾灯控制器的设计与实现
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity qwer is
port(
ck:in bit;
sel:in bit_vector(1 downto 0);
light:out bit_vector(1 downto 0);
movl:out bit_vector(3 downto 0)
);
end qwer;
architecture three of qwer is
begin
process(ck)
variable tmp:bit_vector(3 downto 0);
variable tmp2:bit_vector(1 downto 0);
variable tmp3:unsigned(1 downto 0);
variable cks:bit_vector(3 downto 0);
begin
cks:=ck&ck&ck&ck;
if ck'event and ck='1' then
if sel="00" then
tmp2:="00";
tmp:="0000";
else if sel="01" then
case tmp3 is
when"00"=>tmp:="1000";tmp2:="01";
when"01"=>tmp:="0100";tmp2:="00";
when"10"=>tmp:="0010";tmp2:="01";
when others=>tmp:="0001";tmp2:="00";
end case;
tmp3:=tmp3+1;
else if sel="10" then
case tmp3 is
when"00"=>tmp:="0001";tmp2:="10";
when"01"=>tmp:="0010";tmp2:="00";
when"10"=>tmp:="0100";tmp2:="10";
when others=>tmp:="1000";tmp2:="00";
end case;
tmp3:=tmp3+1;
else if sel="11" then
tmp2:="11";
tmp:="0000";
end if;
end if;
end if;
end if;
end if;
light<=tmp2;
movl<=tmp and cks;
end process;
end three;
2014年01月08日 13点01分
1
代码是
汽车尾灯控制器的设计与实现
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity qwer is
port(
ck:in bit;
sel:in bit_vector(1 downto 0);
light:out bit_vector(1 downto 0);
movl:out bit_vector(3 downto 0)
);
end qwer;
architecture three of qwer is
begin
process(ck)
variable tmp:bit_vector(3 downto 0);
variable tmp2:bit_vector(1 downto 0);
variable tmp3:unsigned(1 downto 0);
variable cks:bit_vector(3 downto 0);
begin
cks:=ck&ck&ck&ck;
if ck'event and ck='1' then
if sel="00" then
tmp2:="00";
tmp:="0000";
else if sel="01" then
case tmp3 is
when"00"=>tmp:="1000";tmp2:="01";
when"01"=>tmp:="0100";tmp2:="00";
when"10"=>tmp:="0010";tmp2:="01";
when others=>tmp:="0001";tmp2:="00";
end case;
tmp3:=tmp3+1;
else if sel="10" then
case tmp3 is
when"00"=>tmp:="0001";tmp2:="10";
when"01"=>tmp:="0010";tmp2:="00";
when"10"=>tmp:="0100";tmp2:="10";
when others=>tmp:="1000";tmp2:="00";
end case;
tmp3:=tmp3+1;
else if sel="11" then
tmp2:="11";
tmp:="0000";
end if;
end if;
end if;
end if;
end if;
light<=tmp2;
movl<=tmp and cks;
end process;
end three;