题目如下:
给你的三个信号:
信号1: 100M的clock
信号2: 66M的clock
信号3: 100M clock的一个单一的高电平脉冲信号 (宽度5ns) (如下图)
___
________| |________________
要求生成一个66M的单一的高点平脉冲信号(宽度7.5ns)
(与条件给出的100M脉冲信号没有相位关系方面的要求)
[ 本帖最后由 999T 于 2008-5-28 15:41 编辑 ]



最新回复
999T (2008-5-28 14:54:52)
999T (2008-5-28 15:04:49)
QUOTE:
我觉得66M的clock采100M的pulse是不合适的snowboyfly (2008-5-28 15:10:40)
我理解pulse宽度10ns.
qingchuyu (2008-5-28 15:18:26)
但有可能只是一个周期.
如果用66M去采,很可能采不到
这是慢时钟处理快时钟信号,
两种方法:1,快时钟锁存高电平,慢时钟采到后发送信号回快时钟,然后撤除高电平.
2.快时钟出现高电平,则停时钟让慢时钟采样,采样后恢复快时钟
999T (2008-5-28 15:33:43)
QUOTE:
应该是宽度 5ns 的脉冲leonyang (2008-5-28 15:33:57)
999T (2008-5-28 15:37:43)
QUOTE:
采样之后只需要一个66M高电平脉冲(宽度7.5ns)作为要求的输出结果所以应该不用再恢复先前的时钟了吧
999T (2008-5-28 15:39:06)
QUOTE:
题目没说,就是无要求 :)你觉得应该怎么实现?
999T (2008-5-28 15:41:47)
QUOTE:
我题目没说清楚啊,不好意思现在修正一下
条件给的脉冲信号宽度5ns
要求你生成的脉冲信号宽度7.5ns
rice973 (2008-5-28 16:06:24)
QUOTE:
--------------------------------------------------------5ns的脉冲100M的时钟也没法才啊。。。我觉得应该是10ns的脉冲吧,这样的话就是设计一个脉冲宽度延伸器。。。
这样的题目。。。不知道这个5ns脉冲信号有什么用,什么时钟都采不了。。。
beelzebub (2008-5-28 16:29:25)
999T (2008-5-28 16:54:19)
QUOTE:
大致的思路应该是这样的我觉得100M去第一次对100M的脉冲信号进行采样无疑是第一步(面试我的人也是这么认为的)
现在问题是,采样之后怎么处理,怎么在避免亚稳态的前提下,转换到66M的时钟域去
rice973 (2008-5-28 16:56:48)
input rstn;
input clk100,clk66;
input pulsein;
output pulseout;
reg pulseRise,pulseFall;
always @ ( posedge clk100 )
if ( !rstn )
pulseRise <= 0;
else
pulseRise <= pulsein;
always @ ( negedge clk100 )
if ( !rstn )
pulseFall <= 0;
else
pulseFall <= pulsein;
wire in = pulseRise | pulseFall;
reg d1, d2;
always @ ( posedge clk66 )
{ d2, d1 } <= { d1 , in };
wire pulse15 = !d2 & d1;//15ns的脉冲
reg d3, d4;
always @ ( posedge clk66 )
d3 <= pulse15;
always @ ( negedge clk66 )
d4 <= pulse15;
assign pulseout = d3 & d4;//7.5ns的脉冲
lg20025779 (2008-5-28 17:08:51)
我不说话
alenww (2008-5-28 17:17:07)
我考虑用66M时钟的上升和下降沿各去采10ns脉宽的脉冲,这样即使一个出现亚稳态,另一个出现的可能性就会大大降低。两个应该有一个可以出来需要的结果。
niu12345 (2008-5-28 17:18:33)
999T (2008-5-28 17:45:52)
QUOTE:
写了个tb你这个应该是可用的,不过5ns的脉冲检测不到
`timescale 1ns/100ps
module xxx_t;
reg rstn_t;
reg clk100_t,clk66_t;
reg pulsein_t;
wire pulseout_t;
always #5 clk100_t = ~clk100_t;
always #7.5 clk66_t = ~clk66_t;
initial
begin
clk100_t = 0;
clk66_t = 0;
rstn_t = 0;
pulsein_t = 0;
#50
rstn_t = 1;
#5
pulsein_t = 1;
#10
pulsein_t = 0;
#300
$stop;
end
xxx
xxx_instance
(
.rstn(rstn_t),
.clk100(clk100_t),
.clk66(clk66_t),
.pulsein(pulsein_t),
.pulseout(pulseout_t)
);
endmodule
[ 本帖最后由 999T 于 2008-5-28 17:55 编辑 ]
999T (2008-5-28 18:10:50)
源文件:
module xxx
(
rstn,
clk100,
clk66,
pulsein,
pulseout,
pulseRise,
pulseFall,
in,
d1,
d2,
pulse15,
d3,
d4
);
input rstn;
input clk100,clk66;
input pulsein;
output pulseout;
output pulseRise;
output pulseFall;
output in;
output d1;
output d2;
output pulse15;
output d3;
output d4;
reg pulseRise,pulseFall;
always @ ( posedge clk100 )
if ( !rstn )
pulseRise <= 0;
else
pulseRise <= pulsein;
always @ ( negedge clk100 )
if ( !rstn )
pulseFall <= 0;
else
pulseFall <= pulsein;
wire in = pulseRise | pulseFall;
reg d1, d2;
always @ ( posedge clk66 )
{ d2, d1 } <= { d1 , in };
wire pulse15 = !d2 & d1;//15ns的脉冲
reg d3, d4;
always @ ( posedge clk66 )
d3 <= pulse15;
always @ ( negedge clk66 )
d4 <= pulse15;
assign pulseout = d3 & d4;//7.5ns的脉冲
endmodule
============================
tb文件:
`timescale 1ns/100ps
module xxx_t;
reg rstn_t;
reg clk100_t,clk66_t;
reg pulsein_t;
wire pulseout_t;
wire pulseRise_t;
wire pulseFall_t;
wire in_t;
wire d1_t;
wire d2_t;
wire pulse15_t;
wire d3_t;
wire d4_t;
always #5 clk100_t = ~clk100_t;
always #7.5 clk66_t = ~clk66_t;
initial
begin
clk100_t = 0;
clk66_t = 0;
rstn_t = 0;
pulsein_t = 0;
#50
rstn_t = 1;
#5
pulsein_t = 1;
#8
pulsein_t = 0;
#300
$stop;
end
xxx
xxx_instance
(
.rstn(rstn_t),
.clk100(clk100_t),
.clk66(clk66_t),
.pulsein(pulsein_t),
.pulseout(pulseout_t),
.pulseRise(pulseRise_t),
.pulseFall(pulseFall_t),
.in(in_t),
.d1(d1_t),
.d2(d2_t),
.pulse15(pulse15_t),
.d3(d3_t),
.d4(d4_t)
);
endmodule
[ 本帖最后由 999T 于 2008-5-28 18:13 编辑 ]
新建 BMP 图像.JPG
999T (2008-5-28 18:22:45)
所以应该可以再精简一下
不过功能上肯定是对的
rice973 (2008-5-28 18:53:33)
QUOTE:
------------------跨频域所以用了2个FF,不然也可以用d1&in得到pulse15