In reply to mbence76:
Tasks are NOT normally used in synthesis - for the basic reason (As Dave stated) that synthesis tools generally only recognize the ONE blocking event - i.e the always @( posedge clk ) at the beginning of the procedural block.
So, for synthesis, one cannot add any more blocking events in a task - so it’s pointless to use a task. Use functions instead.
The iff keyword is not synthesizable under any tools that I know of, so that’s not useful. I’m not sure what your intent is with using it either. The phrase “make it stop when it is finished” is NOT a hardware concept. The hardware is there or it isn’t. If you want to “make it stop” you’re now describing stateful behavior - you should be coding a state machine. “Make it stop” => “Return to idle state”.
Regards,
Mark