循环灯控制器,该控制器控制红、绿、黄三个发光管循环发亮(VHDL语言)

2019-07-14 01:50发布

设计一个循环灯控制器,该控制器控制红、绿、黄三个发光管循环发亮。要求红发光管亮2秒,绿发光管亮3秒,黄发光管亮1秒。(假设外部提供频率为1MHz的方波信号)

library ieee; use ieee.std_logic_1164.all; entity loopled_tb_vhd is end loopled_tb_vhd; architecture rtl of loopled_tb_vhd is component loopled port( CLK,CLR:IN STD_LOGIC; Red,Green,Yellow:OUT STD_LOGIC ); end component; signal clr :std_logic:='0'; signal clk :std_logic:='0'; signal Red :std_logic; signal Green :std_logic; signal Yellow :std_logic; begin uut:loopled port map ( clk=>clk,clr=>clr,Red=>Red,Green=>Green,Yellow=>Yellow ); --clk_gen:process --begin -- clk <= '1' AFTER 0 ns; clr <='1' AFTER 0 ns, '0' AFTER 2 ns; tb:PROCESS BEGIN clk<='0'; LOOP clk<='1','0' AFTER 1 ns; wait for 2 ns; END LOOP; END PROCESS; end rtl;