在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 399|回复: 6

[求助] 锁相环的LOCK侦测模块,有VerilogA代码或者文章参考吗。

[复制链接]
发表于 2024-10-31 12:13:21 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
头疼。
发表于 2024-10-31 12:50:17 | 显示全部楼层
`include "disciplines.vams"  module pll_lock_detector(input phase_difference, output reg lock);      // Parameters     parameter real threshold = 0.1;  // Threshold for determining lock     parameter real check_time = 1e-6; // Time window to check for lock     parameter real hysteresis = 0.05; // Hysteresis for lock determination      // Internal signals     real phase_diff_integrated;     real time_count;      analog begin         @(initial_step) begin             phase_diff_integrated = 0;             time_count = 0;             lock = 0;         end          // Integrate phase difference over time         phase_diff_integrated = phase_diff_integrated + abs(phase_difference) * `dt;         time_count = time_count + `dt;          // Check if phase difference is within threshold         if (time_count >= check_time) begin             if (phase_diff_integrated <= threshold) begin                 lock = 1;             end else if (phase_diff_integrated >= threshold + hysteresis) begin                 lock = 0;             end             // Reset integration and time counter             phase_diff_integrated = 0;             time_count = 0;         end     end endmodule
发表于 2024-10-31 12:53:14 | 显示全部楼层
`include "disciplines.vams"

module pll_lock_detector(input phase_difference, output reg lock);

    // Parameters
    parameter real threshold = 0.1;  // Threshold for determining lock
    parameter real check_time = 1e-6; // Time window to check for lock
    parameter real hysteresis = 0.05; // Hysteresis for lock determination

    // Internal signals
    real phase_diff_integrated;
    real time_count;

    analog begin
        @(initial_step) begin
            phase_diff_integrated = 0;
            time_count = 0;
            lock = 0;
        end

        // Integrate phase difference over time
        phase_diff_integrated = phase_diff_integrated + abs(phase_difference) * `dt;
        time_count = time_count + `dt;

        // Check if phase difference is within threshold
        if (time_count >= check_time) begin
            if (phase_diff_integrated <= threshold) begin
                lock = 1;
            end else if (phase_diff_integrated >= threshold + hysteresis) begin
                lock = 0;
            end
            // Reset integration and time counter
            phase_diff_integrated = 0;
            time_count = 0;
        end
    end
endmodule
In this code:

phase_difference: The input signal representing the phase difference between the reference signal and the output signal of the PLL.

lock: The output signal indicating whether the PLL is locked or not.

threshold: The phase difference threshold used to determine if the PLL is locked.

check_time: The time window over which the phase difference is integrated.

hysteresis: The additional threshold margin to prevent oscillation around the lock state.

This lock detector works by integrating the absolute phase difference over a specified time window and comparing it against a threshold. If the integrated phase difference is below the threshold, it indicates that the PLL is locked. The hysteresis parameter helps prevent the lock signal from rapidly toggling due to small fluctuations.
发表于 2024-10-31 12:54:56 | 显示全部楼层
`include "disciplines.vams"

module pll_lock_detector(input phase_difference, output reg lock);

    // Parameters
    parameter real threshold = 0.1;  // Threshold for determining lock
    parameter real check_time = 1e-6; // Time window to check for lock
    parameter real hysteresis = 0.05; // Hysteresis for lock determination

    // Internal signals
    real phase_diff_integrated;
    real time_count;

    analog begin
        @(initial_step) begin
            phase_diff_integrated = 0;
            time_count = 0;
            lock = 0;
        end

        // Integrate phase difference over time
        phase_diff_integrated = phase_diff_integrated + abs(phase_difference) * `dt;
        time_count = time_count + `dt;

        // Check if phase difference is within threshold
        if (time_count >= check_time) begin
            if (phase_diff_integrated <= threshold) begin
                lock = 1;
            end else if (phase_diff_integrated >= threshold + hysteresis) begin
                lock = 0;
            end
            // Reset integration and time counter
            phase_diff_integrated = 0;
            time_count = 0;
        end
    end
endmodule

In this code:

phase_difference: The input signal representing the phase difference between the reference signal and the output signal of the PLL.

lock: The output signal indicating whether the PLL is locked or not.

threshold: The phase difference threshold used to determine if the PLL is locked.

check_time: The time window over which the phase difference is integrated.

hysteresis: The additional threshold margin to prevent oscillation around the lock state.

This lock detector works by integrating the absolute phase difference over a specified time window and comparing it against a threshold. If the integrated phase difference is below the threshold, it indicates that the PLL is locked. The hysteresis parameter helps prevent the lock signal from rapidly toggling due to small fluctuations.
发表于 2024-10-31 13:36:24 | 显示全部楼层
有吗 ?  只有看一些datasheet上有描述,同求
 楼主| 发表于 2024-11-1 08:48:30 | 显示全部楼层
感谢
 楼主| 发表于 2024-11-1 08:49:17 | 显示全部楼层


ethanchung 发表于 2024-10-31 12:54
`include "disciplines.vams"

module pll_lock_detector(input phase_difference, output reg lock);


好的,感谢~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-19 13:16 , Processed in 0.020062 second(s), 5 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表