blocking - 写入时钟块之前的 SystemVerilog 计算
问题描述
我有一个任务,它的工作是通过时钟块将数据驱动到总线上。见片段:
task effects_driver::ReadQueueData();
stream_intf_.cycles(); // clocking block event
if (sample_q_.size() >= 2) // check to see if there is enough data in the queue
begin
automatic bit [31:0] sample0, sample1;
sample0 = sample_q_.pop_front(); // read from queue
sample1 = sample_q_.pop_front(); // read from queue
stream_intf_.cb.AXIS_TDATA <= {sample1, sample0}; // drive two samples at once
stream_intf_.cb.AXIS_TVALID <= 1;
end
else
...
endtask
您会注意到,我需要先从队列中读取几个项目,然后再将其写入时钟块。这是正确的方法吗?我是否保证模拟器会在将自动变量写入时钟块之前对其执行这些阻塞分配?
谢谢!
PS 我经常遇到这种情况——我需要在写入时钟块之前即时进行一些快速计算。
解决方案
我相信您的意思是问“我是否保证模拟器会在将自动变量写入时钟块之前对其执行这些阻塞分配?” 因为这就是你的代码正在做的事情。
答案是肯定的,阻塞赋值保证在执行后面的语句之前完成。
另请注意,不需要声明sample0
andsample1
具有自动生命周期,因为类方法始终具有自动生命周期。其中声明的变量是隐式自动的。
推荐阅读
- jquery - 带有链接的引导弹出窗口在更改分辨率和缩放时会产生问题
- javascript - 点击离开时如何显示
- kubernetes - Pod 错误:在我的 cont 上部署 mojaloop 后来自 kubernetes 的 CrashLoopBackOff
- c# - 为什么返回带有前缀 ArrayOf 的类对象数组?
- node.js - 为什么在 Heroku 上部署 nodejs 应用程序时出现此应用程序错误?
- list - 如何从python中数据集的每一行中删除几列?
- python - 如何从包含不同类别的 txt 文件创建字典?
- swift - Swift 框架在 lldb 中返回“模糊使用”方法扩展
- ruby - Ruby从一个单词问题中取出最后一个元音
- python-3.x - 如何将日期时间字段从数字转换为全月名称