Library ieee;
Use ieee.std_logic_1164.all;
USE IEEE.std_logic_arith.all;
USE IEEE.std_logic_unsigned.all;
Entity ps7 is
Port(clk:in std_logic;
i,u,n:in std_logic;
Load:in std_logic;
Qut std_logic;
yut std_logic
);
end ps7;
architecture behav of ps7 is
signal c0,c1,c2,c3,c4,c5,c6,c7:std_logic;
signal d,c,b,a:std_logic;
signal count_4:std_logic_vector(3 downto 0);
signal k:std_logic_vector(7 downto 0);
begin
process(clk,load)
begin
if clk'event and clk='1' then
if(load='1')then
c7<='0';
c6<='0';
c5<='0';
c4<='0';
c3<='0';
c2<='0';
c1<='0';
c0<='1';
Q<=c7;
ELSE
C1<=c0;
C2<=c1;
c3<=c2;
c4<=c3;
c5<=c4;
c6<=c5;
c7<=c6;
c0<=c7 xor c4 xor c3 xor c2;
Q<=c7;
end if;
end if;
end process;
process(clk)
begin
if(clk'event and clk='1') then
if(count_4="1111") then
count_4<="0000" ;
else
count_4<=count_4+1;
end if;
end if;
end process;
D<=count_4(0);
c<=count_4(1);
b<=count_4(2);
a<=count_4(3);
begin
k<=i & u & n;
process(k)
begin
case k is
when"000"=> y<=clk;
when"001"=> y<=d;
when"010"=> y<=c;
when"011"=> y<=b;
when"100"=> y<=a;
when others=> y<=clk;
end case;
end process;
end behav;
这是我的程序蓝颜色是出问题的地方,是cpld那有三个按键,000表示无键按下输出原频率,001有一个键按下实现二分频,以此类推,可编译有错误,我也觉得不太对,该怎么改呢? |