My intension is to print some messages after all objections dropped. and the menu said that I can use all_dropped callback. Browsing source code of ovm_objection and I do not think it looks like ovm_callbacks.
First, create a subtype of ovm_test_done_objection:
class my_test_done_objection extends ovm_test_done_objection;
...
virtual task all_dropped(...);
// put your extended behavior here
endtask
endclass
Then, you need to replace the ovm_test_done instance with an instance of your subtype before anybody starts to use ovm_test_done. Doing this before calling run_test() should do the trick:
initial begin
my_test_done_objection my_test_done;
my_test_done = new;
ovm_test_done = my_test_done;
run_test();
end
That’s because ovm_test_done is initialized before you have a chance to register your override. You could use the factory override mechanism, but then you’d have to re-initialize ovm_test_done: