In sequence waiting for specific condition

Example

task read ();
  m_ral.register.fifo.read(status,read_val); // fifo register. 
    `uvm_info(get_type_name,"Value of fifo = %0h", read_val), UVM_LOW); 
  if (read_val[31] == 1'h1) // 31st field is "empty" of fifo register
  begin 
     m_ral.register.output.read(status,read_val);
  end 
endtask

The above task added in uvm sequence, How I should read the fifo register until
if (read_val[31] == 1’h1) this condition gets true or execute.

m_ral.register.fifo.read(status, read_val); // fifo register —> Whenever I call read() task , this will read fifo register on particular time and whatever data it is having it will return. That time if (read_val[31] == 1’h1) this condition will fail. So, I tried to keep the read (m_ral.register.fifo.read(status, read_val) in forever loop, but testcase got hang. Is there any way to try to read until condition become true.

Thank you. Please Answer ASAP.

Please assist. Thank you.

Use a do while() loop

task read ();
  do begin
    m_ral.register.fifo.read(status,read_val); // fifo register. 
    `uvm_info(get_type_name,"Value of fifo = %0h", read_val), UVM_LOW);
  end
  while  (read_val[31] == 1'h1) // 31st field is "empty" of fifo register
endtask

Hi @dave_59 ,

Thanks for the reply.

I tried the above scenario,

Actually, I should get read_val[31] as 1’h0 then only it will come out of loop. But test is goes on running it, unable to get read_val[31] as 1’h0. So, the test case is failing with Time out issue.

How to fix this ? Please provide some other solution.

Thanks.