# What is correct syntax for \`uvm\_do\_callbacks?

**URL:** <https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425>\
**Category:** UVM\
**Tags:** UVM, UVM-callback\
**Created:** [December 6, 2018, 1:47pm UTC](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425 "2018-12-06T13:47:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![frisbeeeking](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/f/34f0e0/32.png) [@frisbeeeking](https://verificationacademy.com/forums/u/frisbeeeking)\
**Post date:** [December 6, 2018, 1:47pm UTC](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/1 "2018-12-06T13:47:44Z")

</div>

Helllo!

I am currently on a verification training, and still learning about UVM and it’s possibilities.  
I’ve been reading about callbacks (already read that these aren’t recommended), and one thing bothers me. There is an example on academy’s website in verification-methodology-reference. Macro’s signature is written like this:

```verilog
`uvm_do_callbacks(T,CB,METHOD)

```

,  
and then there is an example which I believe switches order of arguments, like this:

```verilog
task mycomp::run_phase(uvm_phase phase);
   int curr_addr, curr_data;
   ...
   `uvm_do_callbacks(mycb, mycomp, my_function(this, curr_addr, curr_data))
   ...
endtask

```

If I am right, this macro should be invoked in component’s code (i.e. run phase), and first argument should be pointing to that component, that is keyword _this_.

I was just wondering if I understood this correctly.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [December 6, 2018, 2:40pm UTC](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/2 "2018-12-06T14:40:19Z")

</div>

Please provide a direct link to the example in question.  
Thanks

---

<div class="post-metadata">

**Author:** ![frisbeeeking](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/f/34f0e0/32.png) [@frisbeeeking](https://verificationacademy.com/forums/u/frisbeeeking)\
**Post date:** [December 6, 2018, 2:49pm UTC](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/3 "2018-12-06T14:49:45Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/2):_

[https://verificationacademy.com/verification-methodology-reference/uvm/docs\_1.1c/html/files/macros/uvm\_callback\_defines-svh.html#`uvm\_do\_callbacks](https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.1c/html/files/macros/uvm_callback_defines-svh.html#%60uvm_do_callbacks)

Here it is, under the **`uvm\_do\_callbacks** section.

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [December 6, 2018, 3:12pm UTC](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/4 "2018-12-06T15:12:37Z")

</div>

Actually, the example is part of the Accellera UVM Reference Guide, which we just include on Academy for convenience. You are apparently the first person to notice, since the problem persists through UVM1.2 and even into the reference implementation of 1800.2 (although not in the actual 1800.2 standard). I’ve notified the appropriate committee. Thanks for the heads up.  
In the meantime, stick with using the component as the first argument.

---

<div class="post-metadata">

**Author:** ![frisbeeeking](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/f/34f0e0/32.png) [@frisbeeeking](https://verificationacademy.com/forums/u/frisbeeeking)\
**Post date:** [December 6, 2018, 4:01pm UTC](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/5 "2018-12-06T16:01:41Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/what-is-correct-syntax-for-uvm-do-callbacks/35425/4):_

I will, thank you!
