4/10/2024 0 Comments Anylogic tutorial inject![]() ![]() ![]() UVM_INFO user_callback.sv(18) 0: reporter Inside post_drive method UVM_INFO user_callback.sv(14) 0: reporter Inside pre_drive method UVM_INFO driver.sv(23) 0: uvm_test_ Inside drive_pkt methodĬallback_test simulator output (With Callback) UVM_INFO 0: reporter Running test user_callback_test. Simulator Output: UVM_INFO 0: reporter Running test basic_test. Uvm_callbacks#(driver,driver_callback)::add(env.driv,callback_1) Ĭomplete testcase code class user_callback_test extends basic_test įunction new(string name = "user_callback_test", uvm_component parent=null) Ĭallback_test is the test with callbacks added, and basic_test is without callbacks. In order to execute the callback method, register the callback object to the driver using the ‘add’ method.Declare and create an object of callback class in which methods are implemented (callback_1).Ĭallback_1 = user_callback::type_id::create("callback_1", this).In the testcase where callbacks need to be applied, `uvm_info("USER_CALLBACK","Inside post_drive method",UVM_LOW) Ĭomplete callback class code class user_callback extends driver_callback įunction new(string name = "user_callback") `uvm_info("USER_CALLBACK","Inside pre_drive method",UVM_LOW) Implement the methods with logic in it (this example we are adding only display’s).Need to extend the user-defined callback class and write one more callback class callback_1Ĭlass user_callback extends driver_callback. ![]() Here will see how to add logic to callback methods. We have looked into, how to define the callback methods (In user-defined callback class) and placing hook to callback methods (In driver class using `uvm_do_callbacks macro) `uvm_do_callbacks(driver,driver_callback,post_drive()) Ĭomplete driver code class driver extends uvm_component `uvm_do_callbacks(driver,driver_callback,pre_drive()) Callback methods can be called by using macro `uvm_do_callbacks.Need to place method call’s (callback hook) to methods defined in user-defined callback class (pre_drive() and post_drive()).Callback class can be registered by using macro `uvm_register_cb.Callback class has to be registered with the object/component where callbacks are going to be used.In this example pre_drive() and post_drive() are the callback methods.Ĭomplete user-defined class code class driver_callback extends uvm_callback įunction new(string name = "driver_callback").Define callback methods in user-defined callback class.User has to write user-defined callback class by extending the uvm_callback classĬlass driver_callback extends uvm_callback.UVM_INFO driver.sv(18) 0: uvm_test_ Inside drive_pkt methodĬlick to execute on TestBench with callbacksįor easy understanding will see through below steps, TestCase class basic_test extends uvm_test įunction new(string name = "basic_test", uvm_component parent=null) Įnv = environment::type_id::create("env", this) `uvm_info("DRIVER","Inside drive_pkt method",UVM_LOW) Įnvironment class environment extends uvm_env įunction void build_phase(uvm_phase phase) ĭriv = driver::type_id::create("driv", this) uvm testbench with callback TestBench without callbacks Driver class driver extends uvm_component įunction new(string name, uvm_component parent) With help of callback, will add pre_drive() and post_drive() callbacks. The driver has drive() task, which revives the seq_item and drives to DUT (Current example code doesn’t have any logic to receive and drive seq_item). With a simple driver example will see to UVM Callback. Only the required callback methods are explained here. UVM provides a set of classes, methods, and macros to implement the callbacks. What are the benefits of callback?ĭifferent flavors of the component can be obtained by customizing the empty callback methods. Where callbacks can be implemented?Ĭallbacks can be implemented in an object or component. UVM Callbackīefore Starting with UVM Callbacks, It is good to go through SystemVerilog Callback. Callbacks are empty methods with a call to them.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |