Infinite Loop using While

In reply to raku:

Raku,

Actually I modified the code and put $display statements in while statement. During the simulation I can see that infitie loop occurs because of the while statement. My code enters in while statement and stays there forever


class Receiver ;
...
    task dutOutMonitor ();
        @ (posedge ifc.wr_doing ) 
        @ (posedge ifc.spi_cs ) 
 
        while (ifc.spi_cs == 1'b1 ) 
        begin
            @ (posedge ifc.spi_sck ) 
              $display("Inside while: the value of ifc.spi_cs is %d", ifc.spi_cs);
        end
 
         @ (negedge ifc.spi_cs )
          this.ReceiveBox.put (dataIn ); 
          return;
    endtask
endclass
 
program execTest ();
initial 
begin: WRITE
     genObj.CONFIG();
     genObj.randomize();
     genObj.WRITE();
     receivObj.dutOutMonitor();    
end
endprogram

After simulation the simulator always prints this line:

Inside while: the value of ifc.spi_cs is 1
Inside while: the value of ifc.spi_cs is 1