foreach(page_mode_vseq[i]) begin forever begin `uvm_do_on_with(flp_if_normal_seq, p_sequencer.flp_if_seqr, { mode_seq == page_mode_vseq[i]; pause_seq == pause_vseq; rf_seq == rf_vseq; }) if((p_sequencer.vif.flp_if_vif.ack_finished == 1) || (p_sequencer.vif.flp_if_vif.transmit_disable == 1)) break; end if(p_sequencer.vif.flp_if_vif.transmit_disable == 1) break; end 如果 transmit_disable 为 1,则整个 foreach 循环也会被中断。添加一些代码使得整个foreach循环被中断之后可以重新开始循环
时间: 2024-01-18 20:02:48 浏览: 630
可以将整个 foreach 循环放在一个无限循环中,如果循环被中断,就在外层循环中重新开始,直到所有元素都被遍历完为止。修改后的代码如下所示:
```
forever begin
foreach (page_mode_vseq[i]) begin
forever begin
`uvm_do_on_with(flp_if_normal_seq, p_sequencer.flp_if_seqr,
{mode_seq == page_mode_vseq[i]; pause_seq == pause_vseq; rf_seq == rf_vseq;})
if (p_sequencer.vif.flp_if_vif.ack_finished == 1 || p_sequencer.vif.flp_if_vif.transmit_disable == 1)
break;
end
if (p_sequencer.vif.flp_if_vif.transmit_disable == 1)
break;
end
end
```
这样,当整个 foreach 循环被中断时,就会重新开始执行整个循环,直到遍历完所有元素为止。
阅读全文