{"id":65,"date":"2023-06-08T15:00:41","date_gmt":"2023-06-08T15:00:41","guid":{"rendered":"https:\/\/amvrao.in\/blog\/?p=65"},"modified":"2023-06-08T15:00:42","modified_gmt":"2023-06-08T15:00:42","slug":"delaying-end-of-phase-in-uvm","status":"publish","type":"post","link":"https:\/\/amvrao.in\/blog\/index.php\/2023\/06\/08\/delaying-end-of-phase-in-uvm\/","title":{"rendered":"Delaying end of phase in UVM"},"content":{"rendered":"\n<p>Sometimes you will need to delay execution of a phase in your verification environment. A basic example is that in your test you might drive the sequences and then drop objection in the test to exit the test. In scoreboards or any monitors, if the transactions are still in line waiting for any responses or other stuff, you will have to delay the phase execution to flush all transactions. <\/p>\n\n\n\n<p>To do that we will use the &#8220;<strong>phase_ready_to_end<\/strong>&#8221; function of uvm component to induce delay.<\/p>\n\n\n\n<p>Well &#8220;phase_ready_to_end&#8221; is a function, but how can i call it to insert delay. You need to raise objection create a fork join_none block and then you have to drop objection once your processing is complete. An example can be found below<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction void phase_ready_to_end(uvm_phase phase);\n if(phase.get_name == &quot;main&quot; &amp;&amp; (should_i_wait_or_not)) begin \/\/Use your own phase name which you want to stall, should_i_wait_or_not is a variable or function that you should see when do you want to delay the phase or not.\n    phase.raise_objection(this);\n    fork\n    begin\n      your_task_to_execute();\n    end\n    join_none\n  end\nendfunction\n<\/pre><\/div>\n\n\n<p>Some caveats:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The phase_ready_to_end is called when the objections for that phase are down to 0.<\/li>\n\n\n\n<li>So when you raise objection in the phase_ready_to_end and when you call the drop_objection, the phase_ready_to_end will be again re-called.<\/li>\n\n\n\n<li>So it is better to place a condition on the check in your function to check if is it really required to wait or not.<\/li>\n\n\n\n<li>The UVM phase class a limit of 20 on the phase_ready_to_end, that means when you call the phase_ready_to_end 20 times, next time when objections are dropped to &#8216;0&#8217;, the phase_ready_to_end is not called.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you will need to delay execution of a phase in your verification environment. A&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/amvrao.in\/blog\/index.php\/2023\/06\/08\/delaying-end-of-phase-in-uvm\/\">Read the post<span class=\"screen-reader-text\">Delaying end of phase in UVM<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-uncategorized","excerpt","zoom","full-without-featured","even","excerpt-0"],"_links":{"self":[{"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/posts\/65"}],"collection":[{"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":1,"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":67,"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions\/67"}],"wp:attachment":[{"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amvrao.in\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}