微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > 一道数字面试题目,怎么做?

一道数字面试题目,怎么做?

时间:10-02 整理:3721RD 点击:
Design a block which has 3 inputs as follows:
(1)system clock of pretty high freq
(2)asynch clock input P
(3)asynch clock input Q
P and Q clocks have 50% duty cycle each. Their frequencies are close enough and
they have phase difference.Design the block to generate these outputs:
(1) PeqQ :goes high if periods of P and Q are same
(2) PleQ: goes high if P's period is less than that of Q  
(3) PgrQ: goes high if P's period is greater than that of  Q

感觉用计数器就能实现么,弄三个计数器同是计数3个CLK,记上N个周期之后经过比较器进行比较,同时三个计数器清零,这样好像就可以了

这样做的话,是不是必须要一个复位信号呀?

curious....

只是一个数字锁相环的鉴相部分而已,一个高频时钟(鉴相时钟),两个异步时钟,一般通过一个异或(XOR)鉴相方法可解决!

这是数字设计基础!

so i'm curious,why counter?

好强大  !

小编果然牛

小编能否说详细点啊!谢谢!

看看输出信号就知道了
(1) PeqQ :goes high if periods of P and Q are same
(2) PleQ: goes high if P's period is less than that of Q  
(3) PgrQ: goes high if P's period is greater than that of  Q
DPLL 的PD,后接CP Filter

好,学学数字锁相环

PD & PF
Phase Detector
Frequency Detector

sorry , PD & FD.

看起来简单,深入的分析却也不简单

hehe

哈哈,maxin太精辟了!

值得学习

厉害
佩服

好好学习天天向上,呵呵

学习中。

还是没有理解

应该不是很难,我认为应该用最高频的时钟作一个计数器,用其他两个时钟信号的高电平或低电平作使能信号,然后比较计数器大小即可

very good

此题收藏,以后慢慢做。

学习了,呵呵

ding ding ding

期待详细说明,或者哪里能找到相关说明啊?谢谢了!

这是我的看法,可能有误。望指教
假设Input依次为sys_clk, P_in, Q_in
//for P input: 计算高电平持续时间
always @ (posedge sys_clk or negedge rstj)
if(!rstj)
    p_cnt <= #1 'h0;
else if(P_in)
    p_cnt <= #1 p_cnt + 1'b1;
else
    p_cnt <= #1 'h0;
//由于P跟Q相位不一致,所以必须统计cnt的最大值
always @ (posedge sys_clk or negedge rstj)
if(!rstj)
    p_cnt_max <= #1 'h0;
else if(!P_in && p_cnt_max<p_cnt) //当p_cnt为低电平时,触发最大值统计
    p_cnt_max <= #1 p_cnt;
//for Q input: 计算高电平持续时间
always @ (posedge sys_clk or negedge rstj)
if(!rstj)
    q_cnt <= #1 'h0;
else if(Q_in)
    q_cnt <= #1 q_cnt + 1'b1;
else
    q_cnt <= #1 'h0;
always @ (posedge  sys_clk or negedge rstj)
if(!rstj)
    q_cnt_max <= #1 'h0;
else if(!Q_in && q_cnt_max< q_cnt)
    q_cnt_max <= #1 q_cnt;
//Output Ready (让检测的时间够充分)
#define MAX_DETECT_CLOCK 2000
always @ (posedge  sys_clk or negedge rstj)
if(!rstj)
    detect_cnt <= #1 'h0;
else if(!detect_ready)
    detect_cnt <= #1 detect_cnt + 1'b1;
assign detect_ready = (detect_cnt == `MAX_DETECT_CLOCK);
//Output 只有在detect_ready =1时才有效)
assign PeqQ =  p_cnt_max == q_cnt_max;
assign PleQ  =  p_cnt_max < q_cnt_max;
assign PeqQ =  !(PeqQ||PleQ);

个人认为是是这样的。
可以做一个找clk edge的东西,来产生使能信号,就不用找最大值了

这种,还是每个明确的说法~

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top