Jump to content

JingWang

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by JingWang

  1. Question: Why do you say "before UVM 2017 v1.1 Library Code for IEEE 1800.2 flush function is correct? Answer: the below code is flush function of uvm_tlm_fifo.svh in 1800.2-2020-2.0 Library Code care for the Line.14, it used mailbox's in-build function try_get(); 1 virtual function void flush(); 2 T t; 3 bit r; 4 5 m_clear_zombie_gets(); 6 7 if( m.num() > 0 && m_pending_blocked_gets.size() != 0 ) begin 8 uvm_report_error("flush failed" , 9 "there are blocked gets preventing the flush", UVM_NONE); 10 return; 11 end 12 13 r = 1; 14 while( r ) r = m.try_get( t ) ; 15 16 17 endfunction the below code is flush function of uvm_tlm_fifo.svh in UVM 2017 v1.1 Library Code for IEEE 1800.2 the critical code is Line.6, it used the function try_get() in class uvm_tlm_fifo, but not the mailbox in-build function! 1 virtual function void flush(); 2 T t; 3 bit r; 4 5 r = 1; 6 while( r ) r = try_get( t ) ; 7 8 if( m.num() > 0 && m_pending_blocked_gets != 0 ) begin 9 uvm_report_error("flush failed" , 10 "there are blocked gets preventing the flush", UVM_NONE); 11 end 12 13 endfunction And in all UVM Version Library Code, the try_get() function in class uvm_tlm_fifo which is as below are all the same. The one of differences between function try_get() in class uvm_tlm_fifo and the mailbox is the return value type! the function try_get() in class uvm_tlm_fifo return type is bit, and the mailbox try_get() function return type is int. virtual function bit try_get( output T t ); if( !m.try_get( t ) ) begin return 0; end get_ap.write( t ); return 1; endfunction So in UVM-1.1d, UVM-1.2, and UVM 2017 v1.1 Library Code for IEEE 1800.2, the flush function of uvm_tlm_fifo is correct. But after UVM 2017 v1.1 Library Code for IEEE 1800.2, the flush function of uvm_tlm_fifo is wrong. I have a question: Why change the line code from while( r ) r = try_get( t ) ; to while( r ) r = m.try_get( t ) ; after UVM 2017 v1.1 Library Code for IEEE 1800.2 ?
  2. Hi, I am trying to use flush function in uvm_tlm_fifo class to clear all transactions in uvm_tlm_fifo, but it can not work correctly. the code of flush function in uvm_tlm_fifo class is as below. // Function -- NODOCS -- flush // // Removes all entries from the FIFO, after which <used> returns 0 // and <is_empty> returns 1. virtual function void flush(); T t; bit r; m_clear_zombie_gets(); if( m.num() > 0 && m_pending_blocked_gets.size() != 0 ) begin uvm_report_error("flush failed" , "there are blocked gets preventing the flush", UVM_NONE); return; end r = 1; while( r ) r = m.try_get( t ) ; endfunction For " while( r ) r = m.try_get( t ) ; ", in the while loop it used mailbox m in-build function try_get(). Reference to Systemverilog IEEE 1800-2017 LRM 15.4.6 try_get(): If a message is available and the message type is equivalent to the type of the message variable, the message is retrieved, and the method returns a positive integer. m.try_get(t) returns a positive integer number, and it will be assigned to var r, but var r is bit type, so int number bit0 will be assigned to var r actually. In that case, r may be assigned to zero, and while loop can go out even when mailbox m still has transaction in it. That is the case I meet, the flush function does not work as expected. I also download previous release of UVM code. I found before UVM 2017 v1.1 Library Code for IEEE 1800.2 flush function is correct. the code is as below: // Function -- NODOCS -- flush // // Removes all entries from the FIFO, after which <used> returns 0 // and <is_empty> returns 1. virtual function void flush(); T t; bit r; r = 1; while( r ) r = try_get( t ) ; if( m.num() > 0 && m_pending_blocked_gets != 0 ) begin uvm_report_error("flush failed" , "there are blocked gets preventing the flush", UVM_NONE); end endfunction
×
×
  • Create New...