1.2 DPLL电路实现
1.2.1 数字鉴相器
数字鉴相器由异或门构成,并使用VHDL语言编程来实现。异或鉴相器比较输入信号IN64和输出信号OUT64之间的相位差,输出误差信号ud作为可逆计数器Q的计数方向信号。环路锁定时,ud为一个占空比为50%的方波,此时的绝对相位差为90°,因此异或鉴相器相位差极限为±90°。
1.2.2 数字环路滤波器
数字环路滤波器由变模可逆计数器Q构成。在ud的控制下,当j=0时,Q对时钟Mf0进行“加”计数;当j=1时,Q对时钟Mf0进行“减”计数。可逆计数器的模数K可以通过Ka、Kb、Kc、Kd四个输入端进行预置,当Ka、Kb、Kc、Kd在0001~1110取值时,相应模数的变化范围是 2 3~2 16。数字环路滤波器用VHDL语言编程实现,其程序如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity count_zj is
port(clkl,j,Kd,Kc,Kb,Ka,en:in std_logic;
INC,DEC:out std_logic);
End count_zj;
architecture behave Of eonnt_zj is
signal cq,k,mo,k2,mo2,cql:std_logic_vector(16 downto 0);
signal caol,cao2,caoll,cao22,caolll,cao222:std_logic;
signal instruction,aa,q1,q2:std_lOgic_vector(3 downto 0);
begin
instruction<=Kd & Kc & Kb & Ka;
aa<=instruction+1;
with instruction select
mo<=“00000000000000111”when“0001”,
“0000000000000t111”when“0010”,
“000(0)0(000~11111”when“0011”,
“00000000000111111”when“0100”,
“00000000001111111”when“0101”,
“00000000011111111”when“0110”,
“00000000111111111”when“0111”,
“00000001111111111”when“1000”,
“00000011111111111”when“1001”,
“00000111111111111”when“1010”,
“00001111111111111”when“1011”,
“00011111111111111”when“1100”,
“00111111111111111”when“1101”,
“01111111111111111”when“1110”,
“11111111111111111”when“1111”,
“00000000000000111”when others;
with aa select
m02<=“00000000000000111”when“0001”,
“00000000000001111”when“0010”,
“00000000000011111”when“0011”,
“00000000000111111”when“0100”,
“00000000001111111”when“0101”,
“00000000011111111”when“0110”,
“00000000111111111”when“0111”,
“00000001111111111”when“1000”,
“00000011111111111”when“1001”,
“00000111111111111”when“1010”,
“00001111111111111”when“1011”,
“00011111111111111”when“1100”,
“00111111111111111”when“1101”,
“01111111111111111”when“1110”,
“11111111111111111”when“1111”,
“00000000000000111”when othels;
process(clkl,j,mo,en)