I have a doubt on whether to call build() tasks explicitly or NOT??
As per the OVM_Reference.pdf , build() task must be called explicitly & if NOT , will be called implicitly in post_new phase!!!
(refer page no:39)
In the xbus example, the sve calls the env’s build task which in turn calls the build tasks of masters & slaves explicitly after create_component call.
If I am NOT going to make build task call explicitly, then am getting errors from simulator.
Why does the post_new phase of OVM doesn’t call the build tasks implicitly , if it is NOT called explicitly? :mad:
I hope this can help you:
OVM mechanism calls the "build phase; every time you rewrite the build function, you have to remember to call super.build() to correctly build the hierarchy.
If I recall, the xbus example calls the build() of children explicitly because it mixes both construction and connection in the same build() function. If you do this, you must call the child’s build() explicitly in order for the child’s ports to be constructed before you try to connect them.
I think a better approach is to separate the construction of components from their connection. In other words, you should just do things like call create_component inside build(), and do all the port.connect() calls inside the connect() function.
That way, you can let OVM automatically call build() on all your components, and then when that phase is done, it will call connect() automatically.
As was said above, it is a good habit to always call super.build() or super.connect(), etc. in your phase functions. That way, if you ever extend a class, you won’t miss out on the base class functionality.