⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erfenpin.txt

📁 二分频的实现 二分频的作用是将测相范围由0°~180°扩大到0°~360°。
💻 TXT
字号:
二分频
library ieee;
use ieee.std_logic_1164.all;
library altera;
use altera.maxplus2.all;
entity freq2 is
 port(clkin:in std_logic;
      clkout:out std_logic);
end entity;
architecture rt1 of freq2 is
 signal temp:std_logic;
begin
u0:dff
  port map(d=> not temp,clk=>clkin,clrn=>'1',prn=>'1',q=>temp);
clkout<=temp;
end rt1;
数字环路滤波器是数字锁相环的重要组成部分,它直接影响数字锁相环路的跟踪捕获速度与跟踪的稳定性。数字环路滤波器由变模可逆计数器构成(模数K 可预置)。数字环路滤波器在锁相环路系统中有2种作用。其一,它输出超前调整信号与滞后调整信号控制DCO进行相位调整;其二,它有数字滤波作用,对噪声信号及高频干扰信号有较好的抑制作用。数字环路滤波器内部拥有容量K 的计数器,能够有效消除掉随机出现的正态分布噪声信号。容量K值越大,对噪声抑制效果越好;但同时K值越大,跟踪速度越慢,实时功能下降。所以在设计时K值的选取要综合考虑实际因素。本设计的计数器为一个17 位可编程(可变模数)可逆计数器,计数范围由外部置数DCBA 控制。假设系统工作无相位差,由锁相环原理知,U1和U2的相位差为0 ,异或门鉴相器输出是一个对称的方波。因此可逆计数器在相同的时间间隔内进行加或减计数,只要K足够大,那么从零开始的计数就不会溢出或不够。若U1 开始超前U2 ,异或门输出不对称,那么计数器加计数时间比减计数时间长,其结果计数器随着时间的增长将溢出,产生一个进位脉冲。相反,若U1 开始滞后U2,计数器将产生一个借位脉冲。进位和借位脉冲可用来控制DCO ,使得DCO 输出的脉冲数根据进位和借位来加上或者是删除一些脉冲,实际上也就改变了DCO 的输出频率[6][9]。
当U1同步于U2或只有随机干扰脉冲时,计数器加减的数目基本相等,计数结果在初始值处上下徘徊,不会产生进位和借位脉冲,滤除因随机噪声引起的相位抖动。计数器根据输出结果生成控制DCO 动作的控制指令。

 K模可逆计数器
library ieee ;
use ieee. std_logic_1164. all ;
use ieee. std_logic_unsigned. all ;
entity count_k is
port (clk ,j ,en ,d ,c ,b ,a :in std_logic ;
   r1 ,r2 :out std_logic) ;
end count_k ;
architecture  behave  of  count_k is
signal  cq ,k ,mo :std_logic_vector(16 downto 0);
signal  cao1 ,cao2 :std_logic ;
signal  instruction :std_logic_vector(3 downto 0);
begin
   instruction < = d &c &b &a ;
 with instruction select
 mo < =“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 others ;
process (clk ,en ,j ,k ,cq)
begin
if  clk’event  and  clk = ’1’then
   k < = mo ;
  if en = ’1’then
   if j = ’0’then
    if cq < k then cq < = cq + 1 ;
     else cq < = (others = > ’0’) ;
    end if ;
  else
   if cq > 0 then cq < = cq - 1 ;
 else cq < = k ;
   end if ;end if ;
  else cq < = (others = > ’0’) ;
  end if ;end if ;end process ;
process (en ,j ,cq ,k)
begin
  if en = ’1’then
   if j = ’0’then
    if cq = k then cao1 < = ’1’;
     else cao1 < = ’0’;
    end if ;
    cao2 < = ’0’;
    else if cq =“00000000000000000”thencao2 < = ’1’;
        else cao2 < = ’0’;
        end if ;
        cao1 < = ’0’;
   end if ;
  else cao1 < = ’0’;cao2 < = ’0’;
  end if ;
end process ;
     r1 < = cao1 ;  r2 < = cao2 ;
end behave ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -