Quantcast
Channel: Cadence Functional Verification Forum
Viewing all articles
Browse latest Browse all 1074

Fork a task with parameter from within a function

$
0
0

Hi,

Below is what I've tried to start a task with parameter from a function.


function fork_task_in_func()
	for (int i = O; i < 3; i++) begin
		fork
		  print_me(i);
		join_none
	end
endfunction

task print_me(int i);
	$display("print me: i: %Od\n", i);
endtask

What I expect is as follows,

print me: i: 0
print me: i: 1
print me: i: 2

But the actual outputs are,

print me: i: 3
print me: i: 3
print me: i: 3

Anyone can explain a bit for this result?

Thanks.


Viewing all articles
Browse latest Browse all 1074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>