【问题标题】:UVM compile fail if "abc_seq_item m_tx;" is not the first executable line in "task run_phase(uvm_phase phase)"如果“abc_seq_item m_tx;”UVM 编译失败不是“task run_phase(uvm_phase phase)”中的第一个可执行行
【发布时间】:2020-07-17 00:27:46
【问题描述】:

我遇到过几次这种情况。

在用户定义的 uvm 驱动程序中,如果我在 run_phase 中设置如下所示,它将失败。

task run_phase(uvm_phase phase);
    #1; // It fail even if I put something like `uvm_info() instead of "#1".
    abc_seq_item m_tx;
    ...

这种类似的行为也可能发生在序列类中。

task body();
    #1;
    abc_seq_item m_tx;
    ...

如果“abc_seq_item m_tx”是任务中的第一个可执行文件,它将通过。 我可以知道究竟是什么原因吗?

【问题讨论】:

    标签: system-verilog uvm


    【解决方案1】:

    这是来自 Verilog 的一般 BNF 规则,即在任何程序代码块中,声明必须位于任何语句之前。此规则适用于任何任务、函数、开始/结束、分叉/连接块。我不确定 LRM 中是否有一个特定的地方用文字提到了这一点,但它在 BNF 中被编入你寻找 block_item_declaration

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多