|
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fenpin is
port(
clk_a:in std_logic; --a脉冲
clk_b:in std_logic; --a脉冲
cmd:in std_logic_vector(7 downto 0); --拨码输入
clkout_a:out std_logic; --a
clkout_b:out std_logic; --拨码分频输出b
out_a : out STD_LOGIC; --
out_b : out STD_LOGIC; ---8分频输出b
k : out STD_LOGIC --方向输出
);
end fenpin;
architecture arch of fenpin is
signal clkt_a:std_logic:='0';
signal clkt_b:std_logic:='0';
signal count_a :std_logic_vector(2 downto 0):="000";
signal count_b :std_logic_vector(2 downto 0):="000";
signal kout:std_logic:='0';
signal kc:std_logic:='0';
begin
clkout_a<=clkt_a;
clkout_b<=clkt_b;
k<=kout;
process(clk_a,kc)
begin
if (kc='1') then count_a<="000";
else
if (clk_a'event and clk_a='1')
then
if (count_a="111") then
count_a<=(others=>'0');
else
count_a<=count_a+1;
if(count_a(2)='0') then
out_a<='1';
else
out_a<='0';
end if;
end if;
end if;
end if;
end process;
process(clk_b,kc)
begin
if (kc='1') then count_b<="000";
else
if (clk_b'event and clk_b='1')
then
if (count_b="111") then
count_b<=(others=>'0');
else
count_b<=count_b+1;
if(count_b(2)='0') then
out_b<='1';
else
out_b<='0';
end if;
end if;
end if;
end if;
end process;
-- b信号八分频
process(kout,clk_a)
begin
if(kout'event) then kc<='1'; -----------------------------------line 175
else if (clk_a='0') then kc<='0';
end if;
end if;
end process;
process(clk_a,clk_b)
begin
if (clk_a'event and clk_a='1') then
if clk_b='1' then
kout<='1';
else
kout<='0';
end if;
end if;
end process;
-- ab信号相位判断
process(clk_a,cmd)
variable cnt_a:std_logic_vector(7 downto 0):="00000000";
begin
if cmd=0 then
clkt_a<=clk_a;
cnt_a:="00000001";
elsif rising_edge(clk_a) then
if cnt_a="00000001" then
clkt_a<=not clkt_a;
cnt_a:=cmd;
else
cnt_a:=cnt_a-1;
end if;
end if;
end process;
-- a拨码分频
process(clk_b,cmd)
variable cnt_b:std_logic_vector(7 downto 0):="00000000";
begin
if cmd=0 then
clkt_b<=clk_b;
cnt_b:="00000001";
elsif rising_edge(clk_b) then
if cnt_b="00000001" then
clkt_b<=not clkt_b;
cnt_b:=cmd;
else
cnt_b:=cnt_b-1;
end if;
end if;
end process;
end arch;
-- b拨码分频
综合提示错误:
Analyzing Entity <fenpin> in library <work> (Architecture <arch>).
ERROR:Xst:797 - "E:/xilinx workfile/fenpin/fenpin.vhd" line 175: unsupported Clock statement.
高手帮我看下怎么回事? |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|