This assignment works in an cumulative way. Try to obtain 100% coverage and, upon reaching 100%, stop the simulation. For this exercise it is decided that 100% coverage is reached when:
To have your simulation halt after achieving 100% coverage, and no longer on a certain number of operations, there is a built-in function $get_coverage( ).
Make sure you only count the instructions if they are valid and no reset is being done !!!