Callback in SV

Why callback is required? and Where we can used the callback?

In reply to p_patel:
A callback is a way to inject a new code in a file (in most of the cases it’s a driver) from testcase, without modifying the original file.
The one application of callback is to inject an error.

Got it

Thanks,
H.Modh

In reply to p_patel:
A callback was a technique used before Object Oriented Programming (OOP) was widespread to modify the existing behavior of a routine. But the code that you want to modify has to be instrumented to check if someone has registered a routine to call-back in every place you want them to be able to modify the behavior.

In OOP, we use derived classes to extend to override the behavior of virtual methods. It is much more efficient.

However, one place I see callbacks used in a catcher or filter. Think of an e-mail filter where you set up rules to perform operations on incoming e-mails and each rule is implemented by a callback routine. This is how the UVM report catcher is implemented.