Automatic variables in fork

In reply to puranik.sunil@tcs.com:

BTW, please use code tags to format your code. I have done that for you in your post.

Yes, case 1 and 5 should work the same. The only difference would be visibility of the variable k after the fork statement if there were other statements. Your code works fine for me in ModelSim/Questa. It prints 2 1 0. (any order would be correct).

Also, I do not recommend the use of program blocks. Just use a module.

Dave