imicman的个人空间 https://blog.eetop.cn/1518355 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

fork-join/any/none

已有 2356 次阅读| 2016-5-30 21:10 |个人分类:验证杂谈

Whenever you fork, you spawn off a set of new concurrent child processes from a parent process. The difference between the join, join_any, and join_none statements is in what the parent process does after the children are spawned off.

 

join - parent process blocks (waits) until all child processes complete and return, then it continues to the next statement after the join

 

join_any - parent process blocks (waits) until any child completes (i.e. the first to complete), then it continues to the next statement after the join_any

 

join_none - parent process does not block. Execution continues to the next statement after the join_none. Child processes are scheduled to start, but do not start until the parent encounters a blocking statement (#, @, wait)

 

join_none is useful when you want to start off a bunch of on-going processes, such as monitor processes that independently watch for interesting activity, or when you want to start up several independent stimulus generation processes. In both cases, you don't really care about when or even if the child processes finish.

 

join_any is useful when you want to start a child process, but you want to have a "timeout" so that execution in the parent can continue after either the child finished, or the timeout time has expired, whichever comes first:

fork
start_child_task();
#10000;
join_any

Here, two processes are spawned off, running concurrently. One process executes a task, which takes some unknown amount of time to complete. The second process just delays for 10000 time units, then completes. The parent process will continue execution after whichever child completes first. If desired, you can add a "disable fork" statement after the join_any so that the parent will kill the remaining process.



fork / join_any is useful for watchdog tasks. For example, task #1 is responsible for tracking the total numbers of clocks a test may execute, while task #2 checks for abnormally long idle periods on an interface of interest. If a test hangs with no bus activity, then task #2 completes and finishes the test. On the other hand, if the test is running fine, but is just taking way too many clocks to finish because of a DV oversight, then task #1 will complete and terminate the test. If neither task completes, then the watchdog process is blocked from completing.

fork/join_none is useful if multiple processes are providing stimulus. The testbench can start multiple tasks for each interface, and not worry about when the tasks are complete.


点赞

发表评论 评论 (1 个评论)

回复 imicman 2016-5-30 21:28
转载: https://stackoverflow.com/questions/35447430/systemverilog-task-inside-fork/35695443

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 8

    获赞
  • 34

    评论
  • 访问数
关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-25 10:16 , Processed in 0.030968 second(s), 19 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部