微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > IC验证交流 > 请教一个关于线程的问题

请教一个关于线程的问题

时间:10-02 整理:3721RD 点击:
task get_payload();
pkt2cmp_payload.delete();
fork
begin:wd_timer_fork
fork:frameo_wd_timer
@(negedge rtr_io.cb.frameo_n[da]);
begin
repeat(1000) @(rtr_io.cb);
$display("\n%m\n[ERROR]%t Frame signal timed out!\n",$realtime);
$finish;
end
join_any:frameo_wd_timer
disable fork;
end:wd_timer_fork
join
forever
begin
.....
end
endtask
请教一下,在这里不用管他的功能,我就是想知道这个task的第一个fork....join内部不是嵌套了一个begin....end么,因此在这里想问问这个fork....join在这里有什么用啊,看不出来是做什么用的。我不知道这个在功能上会有什么作用。其次,这个fork...join是否可以删掉,删掉会有影响么。
希望明白这个的朋友们能给我解答一下,万分感激。
不知道是不是因为自己不理解本质,所以不明白,我是个初学者,大家见笑了

I don't think there is any value here for the first fork---join structure because:
1. as you said, only one thread (begin---end) is involved in the structure.
2. disable fork will kill all fork--join/join_any structures in the code.
I guess the code here maybe is used to show the meaning of label since there is a set of label for the begin---end structure of the first fork--join, which is different with the second fork.

可以去掉外层FORK重新仿真,看看有无影响!

只是一种写法,
forkjob_a, job_bjoin_any
disable
这样不管是 job_a 还是 job_b 先结束,都会把另外一个 还没做完的Job kill掉。
不然 另外一个进程还会继续RUN。

若需要执行disable fork;来停止begin...end线程,则就有必要在begin...end外面再包一层fork...join来限定范围;当然也可以调用disable label_block_name;来终止线程。
推荐使用disable fork;方法,因其作用是停止当前thread衍生的所有子线程;而另一种方式是终止由标签label_block_name包含的代码生成的所有threads。

打印信息跑一下试试就知道了

恩 说的很好 谢谢啦

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top