⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 car_control.vhd

📁 1 前大灯可以随意打开和关闭; 2 当汽车左转弯的时候
💻 VHD
字号:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;

ENTITY car_control IS
  PORT(
        turn_fro_big_light  : IN std_logic;
        turn_left           : IN std_logic;
        turn_right          : IN std_logic;
        bake                : IN std_logic;
        fro_big_light_con   : OUT std_logic;        
        fro_L_light_con     : OUT std_logic;
        fro_R_light_con     : OUT std_logic;
        back_L_lights_con   : OUT std_logic_vector( 2 downto 0);
        back_R_lights_con   : OUT std_logic_vector( 2 downto 0)        
      );
END car_control;

ARCHITECTURE arch_car_control of car_control IS
BEGIN
  process( turn_left, turn_right, bake, turn_fro_big_light)
   BEGIN   
    if( turn_fro_big_light = '1' ) then 
      fro_big_light_con <= '1';
    else
      fro_big_light_con <= '0';
    end if;

    --when nothing to do
    if( turn_left = '0' and turn_right = '0' and bake = '0') then
      fro_L_light_con <= '0';
      fro_R_light_con <= '0';
      back_L_lights_con <= "000";
      back_R_lights_con <= "000"; 
    
    --when Only bake
    elsif( turn_left = '0' and turn_right = '0' and bake = '1') then
      fro_L_light_con <= '0';
      fro_R_light_con <= '0';
      back_L_lights_con <= "010";
      back_R_lights_con <= "010";
    
    --when Only turn_right 
    elsif( turn_left = '0' and turn_right = '1' and bake = '0')then
      fro_L_light_con <= '0';
      fro_R_light_con <= '1';
      back_L_lights_con <= "000";
      back_R_lights_con <= "001";

    --when turn_right and bake;
    elsif( turn_left = '0' and turn_right = '1' and bake = '1')then
      fro_L_light_con <= '0';
      fro_R_light_con <= '1';
      back_L_lights_con <= "100";
      back_R_lights_con <= "001";
  
    --when Only turn left;
    elsif( turn_left = '1' and turn_right = '0' and bake = '0')then
      fro_L_light_con <= '1';
      fro_R_light_con <= '0';
      back_L_lights_con <= "001";
      back_R_lights_con <= "000";

    --when turn left and bake
    elsif( turn_left = '1' and turn_right = '0' and bake = '1')then

      fro_L_light_con <= '1';
      fro_R_light_con <= '0';
      back_L_lights_con <= "001";
      back_R_lights_con <= "100";

    elsif( turn_left = '1' and turn_right = '1' and bake = '0')then
      fro_L_light_con <= '0';
      fro_R_light_con <= '0';
      back_L_lights_con <= "000";
      back_R_lights_con <= "000";

    elsif( turn_left = '1' and turn_right = '1' and bake = '1')then
      fro_L_light_con <= '0';
      fro_R_light_con <= '0';
      back_L_lights_con <= "000";
      back_R_lights_con <= "000";
    end if;
  
  END process;
END arch_car_control;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -