EDA大作业——交通灯代码
报告说明链接 http://blog.csdn.net/a350203223/article/details/36059701
附件:程序设计
(1)分频器的设计
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity arc_devide5m is
port(
clk : in std_logic;
clk_out : out std_logic
);
end arc_devide5m;
architecture behave of arc_devide5m is
signal count : std_logic_vector(26 downto 0);
signal newcount : std_logic;
begin
process
begin
wait until clk'event and clk = '1';
if( count < 25000000) then
count <= count + 1;
newcount <= newcount;
else
count <= (others => '0');
newcount <= not newcount;
end if;
end process;
clk_out <= newcount;
end architecture behave;
(2)控制器设计
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity control is
port( clk,hold:in std_logic;
ared,agreen,ayellow,bred,bgreen,byellow: out std_logic;
aout,bout: out std_logic_vector(6 downto 0));
end control;
architecture behavior of control is
type state_type is (s0,s1,s2,s3,s4);
signal current_state,next_state: state_type;
signal c