??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 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏