No.89472 作者:mmaatybz 邮件:junting1983@houtmail.com ID:48130 登陆:1次 文章数:2篇 最后登陆IP:61.130.107.12 最后登陆:2006/3/8 22:02:51 注册:2006/2/27 21:12:59 财富:107 发帖时间:2006/2/27 21:17:01 发贴者IP:61.130.107.12 标题:mmaatybz:请高手帮我个忙,关与VHDL语言的。 摘要:No.89472请高手帮我个忙,关与VHDL语言的。 我是不懂的,帮一个朋友发的 下面是一段交通灯的控制程序,里面要加一个计数器可以从1到50记数,请各位大虾帮忙。谢谢了 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity light is port(clk,clr,set_red:in std_logic; a_green,a_yellow,a_red:out std_logic; b_green,b_yellow,b_red:out std_logic); end light; architecture rtl of light is type state is(agreen,ayellow,bgreen,byellow,alarm); --begin signal current_state,next_state:state; signal timer:integer; signal light:std_logic_vector(5 downto 0); signal flag:std_logic; begin process(clk,clr,set_red) begin if(clr='1')then current_state <= agreen; --timer <= 50; flag <='0'; --elsif(set_red='1')then --current_state <= alarm; --timer <=timer; --flag <='1'; --light <="001001" ; elsif(clk'event and clk='1')then flag <='0'; --timer <=timer-1; --if(timer=timer-1) current_state <= next_state; end if; end process; process(current_state,set ......
>>返回讨论的主题
|