Infinite Loop using While

In reply to haykp:

Try putting display statement immediately i.e. before @ (negedge ifc.spi_cs ) after while loop and check . From this we will know whether it has exited while loop or still in while loop.