my project is under simulator .
to my surprise , my project sometimes run well and I got desirable output .
but sometimes my project get incorrect output .
I found my program fell into the cos function and can not get out .
after a while , i run the program again and i got desirable output.
how to explain this strange phenomenon? how to fix this problem?thanks