Last active
November 23, 2016 12:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class abc; | |
string name; | |
task multiple_process(input int unsigned delay); | |
fork | |
begin | |
forever begin | |
#20; | |
$display ($time, " %s, Process:1", name); | |
end | |
end | |
join_none | |
fork | |
begin | |
#delay; | |
$display ($time, " %s, Process:2", name); | |
end | |
begin | |
#10; | |
$display ($time, " %s, Process:3", name); | |
end | |
join_any | |
disable fork; | |
$display ($time, " %s, multiple_process completed", name); | |
endtask : multiple_process | |
endclass : abc | |
module top1(); | |
abc a1, a2; | |
initial begin | |
a1 = new(); | |
a1.name = "a1"; | |
a2 = new(); | |
a2.name = "a2"; | |
fork | |
a1.multiple_process(5); | |
a2.multiple_process(7); | |
join | |
#30 $finish; | |
end | |
endmodule : top1 | |
//Output: | |
// 5 a1, Process:2 | |
// 5 a1, multiple_process completed | |
// 7 a2, Process:2 | |
// 7 a2, multiple_process completed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment