Threads in SystemVerilog

SystemVerilog has following ways to create threads:

  1. fork...join
  2. fork...join_none
  3. fork...join_any
fork...join
















Output:
@0: Before fork...join
@0: parallel start
@10: parallel after #10
@30: sequential after #30
@40: sequential after #10
@50: parallel after #50
@50: after join

fork...join_none
A fork...join_none block schedules each statement in the block, but execution continues in the parent thread.

Output:
@0: Before fork...join
@0: parallel start
@0: after join_none
@10: parallel after #10
@30: sequential after #30
@40: sequential after #10
@50: parallel after #50


fork...join_any
A fork...join_any block schedules each statement in the block. Then, when the first statement completes, execution continues in the parent thread. All other remaining threads continue.


















Output:
@0: Before fork...join_any
@0: parallel start
@0: after join_any
@10: parallel after #10
@30: sequential after #30
@40: sequential after #10
@50: parallel after #10

Waiting for all Spawned Threads
In SystemVerilog, when all the initial blocks in the program are done, the simulation exits. You may need to spawn many threads, which might still be running. Use the wait fork statement to wait for all child threads












Disabling Threads

  • Disabling a Single Thread











  • Disabling Multiple Threads

2 comments:

  1. I liked the posts, for your information I was thinking why these content is not monetised, are u waiting for adsense approval.I have found another alternative ads http://tinyurl.com/zl83sk9 works fine for my blog http://basicsofvlsi.blogspot.in/

    ReplyDelete
  2. I liked the posts, for your information I was thinking why these content is not monetised, are u waiting for adsense approval.I have found another alternative ads http://tinyurl.com/zl83sk9 works fine for my blog http://basicsofvlsi.blogspot.in/

    ReplyDelete