jleng Posted July 13, 2014 Report Share Posted July 13, 2014 I just wonder if it is possible to override a build phase from uvm_driver? Seems there's only way is to override driver type/instance, but not phase. thanks, Jennifer, Quote Link to comment Share on other sites More sharing options...
tudor.timi Posted July 14, 2014 Report Share Posted July 14, 2014 I think you are a bit confused about overriding. If you want to override the default behavior of build_phase(...) which is a function, then you just declare your own implementation: class my_driver extends uvm_driver #(my_item); // factory registration stuff function void build_phase(uvm_phase phase); // super.build_phase means calling the build_phase function // as it was defined in the base class (our case uvm_driver) super.build_phase(phase); // up to now our build_phase does the exact same thing that // it did in the base class // add your extra code here // - code that does more stuff that you need endfunction Whenever you extend a class (create a subclass) and redefine a method, this means you are overriding the method (method means function or task). Method overrides control what object actually do. When you instantiate an object of type my_driver and call build_phase, then the implementation we have defined above will get executed. Type and instance overrides are a different thing that applies to the factory. They control what types of objects actually get instantiated. David Black 1 Quote Link to comment Share on other sites More sharing options...
David Black Posted July 14, 2014 Report Share Posted July 14, 2014 To reinforce Tudor's reply, you will need to "override" twice - once in the OO sense, and once in the factory sense: 1. derive a new driver class (assuming you are overriding an existing driver) 2. implement your new build_phase -- IMPORTANT: you will probably want to call super.build_phase from within your new implementation 3. set_type_override or set_instance_override in the test class (or possibly the environment) during the build_phase of that class Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.