簡體   English   中英

寫入時鍾塊之前的 SystemVerilog 計算

[英]SystemVerilog calculations right before writing to clocking block

我有一個任務,它的工作是通過時鍾塊將數據驅動到總線上。 見片段:

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 我經常遇到這種情況——我需要在寫入時鍾塊之前即時進行一些快速計算。

我相信您的意思是問“我是否保證模擬器會在將自動變量寫入時鍾塊之前對其執行這些阻塞分配?” 因為這就是你的代碼正在做的事情。

答案是肯定的,阻塞賦值保證在執行后面的語句之前完成。

另請注意,無需聲明sample0sample1具有自動生命周期,因為 class 方法始終具有自動生命周期。 在其中聲明的變量是隱式自動的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM