# Create different handle of class in the macro based on number of times macro is called

**URL:** <https://verificationacademy.com/forums/t/create-different-handle-of-class-in-the-macro-based-on-number-of-times-macro-is-called/30508>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, OVM, OOPS\
**Created:** [April 1, 2015, 6:23am UTC](https://verificationacademy.com/forums/t/create-different-handle-of-class-in-the-macro-based-on-number-of-times-macro-is-called/30508 "2015-04-01T06:23:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Vinay\_Jain](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/vinay_jain/32/3037_2.png) [@Vinay\_Jain](https://verificationacademy.com/forums/u/Vinay_Jain)\
**Post date:** [April 2, 2015, 4:26am UTC](https://verificationacademy.com/forums/t/create-different-handle-of-class-in-the-macro-based-on-number-of-times-macro-is-called/30508/3 "2015-04-02T04:26:31Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/create-different-handle-of-class-in-the-macro-based-on-number-of-times-macro-is-called/30508/2):_

@dave_59,  
This macro is used to take the list of cmds and wait for each cmd resp i.e cmd\_seq.get\_resp and if that cmd is completed we push that cmd into cmd completed queue. one of feature that user can pass the count that for how many cmds it should wait.  
e.g. my\_macro(cmd\_list,10) here cmd\_list has 20cmds and they already driven from driver.Now once i received response of 10 cmds i can move further in my testcase util this time I would block the testcase at that point.

why Forked, there can be another scenario where we can have two types of cmds  
e.g.

```verilog
fork 
begin
 my_macro(read_cmd_list,10)
end
begin
 my_macro(write_cmd_list,5)
end

```

in this case, raed and write cmd list have 20 cmds each and after 10 read and 5 write response i can move further in my testcase.

But with current implementation, only the last thread update the utils\_h.cmd\_list.

This is because one class handle and when 2nd thread start it update the handle pointer.

what might be another solution if we don’t use Macro. This utility is for user who doesn’t have much knowledge of Implementation,where they just have to call one macro with proper arguments. adding more steps like add\_cmds function would be burden on them.

---

_[View the full topic](https://verificationacademy.com/forums/t/create-different-handle-of-class-in-the-macro-based-on-number-of-times-macro-is-called/30508)._
