恩,我贴出来哦, 是ateara 的maxii 麻烦你看一下是不是存在根本性的错误,就是说,完全不能这么写的。 谢谢哦。 我也不知道为什么了。
library ieee;
LIBRARY altera;
USE altera.altera_primitives_components.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity AD_generate is
port( clk: in std_logic;
rst: in std_logic;
dout: out std_logic_vector(15 downto 0)
);
end ad_generate;
architecture ver1 of ad_generate is
signal count:std_logic_vector(13 downto 0);
signal clk_48:std_logic;
type state is(r0,r1,g12,g11,g10,g9,g8,g7,g6,g5,g4,g3,g2,g1,g0,g0_1);
signal current_state,next_state:state;
component global
port (
a_in : in std_logic;
a_out : out std_logic);
end component;
signal clk_state:std_logic;
begin
U1: global port map (a_in=>clk_48,a_out=>clk_state);
HZ24M:process(clk,rst)
begin
if (rst='0')
then count<=(others=>'0');
elsif(clk'event and clk='1')
then if (count<9999)
then count<=count+1;
else count<=(others=>'0');
end if;
end if;
end process;
HZ48K:process( count)
begin
if(count<5000)
then clk_48<='1';
else clk_48<='0';
end if;
end process;
reg:process(clk_state,rst)
begin
if(rst='0') then current_state<=r0;
elsif(clk_state'event and clk_state='1') then
current_state<=next_state;
end if;
end process;
com:process( current_state)
begin
case current_state is
when r0 => next_state<=r1;
when r1 => next_state<=g12;
when g12 => next_state<=g11;
when g11 => next_state<=g10;
when g10 => next_state<=g9;
when g9 => next_state<=g8;
when g8 => next_state<=g7;
when g7 => next_state<=g6;
when g6 => next_state<=g5;
when g5 => next_state<=g4;
when g4 => next_state<=g3;
when g3 => next_state<=g2;
when g2 => next_state<=g1;
when g1 => next_state<=g0;
when g0 => next_state<=g0_1;
when g0_1 => next_state<=r0;
when others => next_state<=r0;
end case;
end process;
com1:process(current_state)
begin
case current_state is
when r0 => dout<="1111111011111111";
when r1 => dout<="1111110111111111";
when g12=> dout<="1111101111111111";
when g11=> dout<="1111011111111111";
when g10=> dout<="1110111111111111";
when g9 => dout<="1101111111111111";
when g8 => dout<="1011111111111111";
when g7 => dout<="0111111111111111";
when g6 => dout<="1111111111111110";
when g5 => dout<="1111111111111101";
when g4 => dout<="1111111111111011";
when g3 => dout<="1111111111110111";
when g2 => dout<="1111111111101111";
when g1 => dout<="1111111111011111";
when g0 => dout<="1111111110111111";
when g0_1=>dout<="1111111101111111";
when others=> dout<="1111111111111111";
end case;
end process;
end ver1; |