??skt 2016-12-25 08:37 采纳率: 0%
浏览 1418

汽车尾灯的vhdl求解释

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity weideng is
port(clk,tright,tleft,jingji:in std_logic;
rightdeng:out std_logic_vector(2 downto 0);
leftdeng:out std_logic_vector(2 downto 0));
end weideng;
architecture qiche of weideng is
signal rightd:std_logic_vector(1 downto 0);
signal leftd:std_logic_vector(1 downto 0);
signal jingjid:std_logic_vector(1 downto 0);
begin
control:process(clk,tleft,tright)
begin
if clk'event and clk='1'then
if rightd="01"then rightd<="11";
else rightd<=(rightd-1);
end if;
if leftd<="01" then leftd<="11";
else leftd<=(leftd-1);
end if;
if(jingjid="01") then
jingjid<="11";
else
jingjid<=(jingjid-1);
end if;
end if;
end process control;
proout:process(clk,tright,tleft,rightd,leftd,jingjid)
begin

if clk'event and clk='1'then
if tright='1'then leftdeng<="000";
case rightd is
when"01"=>rightdeng<="001";
when"10"=>rightdeng<="010";
when"11"=>rightdeng<="100";
when others=>rightdeng<="000";
end case;
elsif tright='0' then rightdeng<="000";
case leftd is
when"01"=>leftdeng<="100";
when"10"=>leftdeng<="010";
when"11"=>leftdeng<="001";
when others=>leftdeng<="000";
end case;
elsif tleft='0'then leftdeng<="000";
end if;
end if;
if tleft='1'and tright='1'then
leftdeng<="111";
rightdeng<="111";
elsif tleft='0'and tright='0'then
leftdeng<="000";
rightdeng<="000";
end if;

if(jingji='1')then
case jingjid is
when"01"=>leftdeng<="000";
rightdeng<="000";
when"10"=> leftdeng<="111";
rightdeng<="111";
when"11"=> leftdeng<="000";
rightdeng<="000";
when others=>leftdeng<="111";
rightdeng<="111";
end case;
end if;

end process proout;
end qiche;图片

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿