amitk3553 7 Report post Posted February 14, 2014 Where is the use of the concept of polymorphism in testbench development in UVM. Please tell me some usecases of polymorphism in testbench development. Share this post Link to post Share on other sites
Hany Salah 1 Report post Posted February 14, 2014 in case you have such ubus example,,, you have different agents ,, each one is responsible to act like either master or slave ,, It isn't restricted that all agents act in the same way at the same time,, but you have to randomly configure each one to make your test more random and more effective ,, such way ,, you have different agents ,,, each one extended from uvm_agent base class ,, and each one may have the same function name ,, for instance write(),, strope () ,, read() and so on ,, Through build phase ,, you called build function through all environments in the same test bench ,, although they have the same name ,, polymorphism play its role another example through when run phase ,,, each agent may have his own run routine with the same name run () ,, but they don't act as each other ,, so polymorphism play its role here also on Other matter ,, naming function whose main purpose similar like run, is so practical as on complex tests you have high number of agents and scripts and you may get lost in routines' names 1 amitk3553 reacted to this Share this post Link to post Share on other sites
David Black 123 Report post Posted February 14, 2014 The simplest examples of polymorphism at work are the UVM factory when you use overrides. 1 amitk3553 reacted to this Share this post Link to post Share on other sites
uwes 17 Report post Posted February 17, 2014 hi, polymorphism is a general concept. see http://en.wikipedia.org/wiki/Polymorphism_(computer_science). the testbenches we write are essentially software. in that sense all methods to improve creation/speed/maintenance/stability/reuse of software should be in the focus for tb developers too. the concept of polymorphism is one way to improve. /uwe 1 amitk3553 reacted to this Share this post Link to post Share on other sites
quanghong 1 Report post Posted February 18, 2014 You can use the polymorphism in UVM as following example: class driver extends uvm_driver; class my_driver extends driver; module test; .... driver dr; initial begin // polymorphism: wait until run-time to bind the object type // You can override either by type or instance. factory.set_type_override_by_type(driver::get_type(), my_driver::get_type()); // It is important to use factory before create dr = driver::type_id::create("driver", null); run_test(); end endmodule Hope it helps. Quang 1 amitk3553 reacted to this Share this post Link to post Share on other sites
nirmish 0 Report post Posted March 14, 2014 Another Simple use case of polymorphism is callbacks.... in driver classes you call the methods [pre* , *post] which are defined in façade class. Now when you extend these façade class you provide definition to these method, once these extended callback classes are added to queue of these callback class then during execution of test case functionality of these redefined method will be called by using the handle of old class... this is possible by polymorphism... hope it helps and clear to you :-) Share this post Link to post Share on other sites