集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1939|回复: 0

Getting a task done in another clock domain

[复制链接]
20080067 发表于 2010-5-3 10:57:34 | 显示全部楼层 |阅读模式
Getting a task done in another clock domain
If the clkA domain has a task that needs to be completed in the clkB domain, you can use the following design.

Here's one way to do it
module TaskAck_CrossDomain(    clkA, TaskStart_clkA, TaskBusy_clkA, TaskDone_clkA,     clkB, TaskStart_clkB, TaskBusy_clkB, TaskDone_clkB);// clkA domain signalsinput clkA;input TaskStart_clkA;output TaskBusy_clkA, TaskDone_clkA;// clkB domain signalsinput clkB;output TaskBusy_clkB, TaskStart_clkB;input TaskDone_clkB;reg FlagToggle_clkA, FlagToggle_clkB, Busyhold_clkB;reg [2:0] SyncA_clkB, SyncB_clkA;always @(posedge clkA) if(TaskStart_clkA & ~TaskBusy_clkA) FlagToggle_clkA <= ~FlagToggle_clkA;always @(posedge clkB) SyncA_clkB <= {SyncA_clkB[1:0], FlagToggle_clkA};assign TaskStart_clkB = (SyncA_clkB[2] ^ SyncA_clkB[1]);assign TaskBusy_clkB = TaskStart_clkB | Busyhold_clkB;always @(posedge clkB) Busyhold_clkB <= ~TaskDone_clkB & TaskBusy_clkB;always @(posedge clkB) if(TaskBusy_clkB & TaskDone_clkB) FlagToggle_clkB <= FlagToggle_clkA;always @(posedge clkA) SyncB_clkA <= {SyncB_clkA[1:0], FlagToggle_clkB};assign TaskBusy_clkA = FlagToggle_clkA ^ SyncB_clkA[2];assign TaskDone_clkA = SyncB_clkA[2] ^ SyncB_clkA[1];endmoduleand here's a matching simulation waveform

本帖子中包含更多资源

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

x
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2024-12-24 00:25 , Processed in 0.057740 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表