将 verilog 或 systemverilog 中 2x 时钟输入的数据转换为 1x 时钟
我正在致力于验证。我当前面临一个问题,即将 2x 时钟内的数据转换为一个单元。
对于 132 位信号,它以 2x 时钟作为 66 位总线传输。
再次接收时,所有时钟转换将从 2x 到 1x 完成,以取回信号的所有 132 位。
有人可以帮助我如何做到这一点吗?
预先非常感谢。
I am working on validation. I current face a problem of converting a data that is coming to a unit in 2x clock.
For a signal of 132 bits it travels as 66 bit bus in 2x clock.
At receiving again all the clock conversion is to be done from 2x to 1x getting back all 132 bits of the signal.
Can somebody help me on how to do this ?
Thanks a lot in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常的方法是你有一个 132 位双端口寄存器。一个端口位于 1x 时钟域中,另一个端口位于 2x 时钟域中。由于一个是只读的,一个是只写的,所以可以像普通寄存器一样描述它。但不同时钟域之间的迁移非常棘手,尤其是。因为亚稳态。要解决此问题,您必须添加另一级触发器(即另一个寄存器)。
我的回答不是很具体和详细,但这是因为您的问题非常不具体/广泛。
The usual way is that you have a 132 bit dual ported register. With one port in your 1x clock domain and and the other port in your 2x clock domain. As one is read only and one write only, you can just describe it like a normal register. But migrating between different clock domains is very tricky, esp. because of metastability. Do workaround this you have to add another level(s) of flip flops (i.e. another register).
My answer is not very specific and detailed, but this due to the fact, that your question is very unspecific/broad.
这是一篇关于时钟域交叉技术的优秀论文。
Here's an excellent paper on clock domain crossing techniques.
由于问题被标记为
verilog
&system-verilog
我假设需要一个 Verilog 模块来进行转换。假设输入&输出时钟是同步的,这里是代码(未经充分测试,可能需要一些调整):
我用这个刺激测试了它
:输出时钟不同步,我认为您需要在输入时钟域中切换标志信号,该信号必须与输出时钟域双同步并传递到输出逻辑。当输出侧逻辑检测到切换时,它可以读取 data_out,并且必须设置另一个标志信号,该信号必须双同步并传递到输入侧逻辑。在输入逻辑看到第二个标志切换之前,我认为它不应该改变
data_in
。Since the question is tagged
verilog
&system-verilog
I assume a Verilog module to do the conversion is desired.Assuming the input & output clocks are synchronous, here is the code (not well-tested, may need some tweaks):
I tested this with this stimulus:
If the input & output clocks are not synchronous, I think you will need to toggle a flag signal in the input clock domain which has to be double-sync'd to the output clock-domain and passed to the output logic. When the output-side logic detects the toggle, it can read
data_out
and will have to set another flag signal which has to be double-sync'd and passed on to the input-side logic. Until the input logic sees this second flag toggle I think it should not changedata_in
.