mastrick Posted April 26, 2012 Report Share Posted April 26, 2012 We have created some classes that extend uvm classes and add functionality to some of the uvm virtual functions. Our end users are supposed to extend those new classes and if they need to extend those same functions, they must call super.function(). If they forget to call the super version for some of the extended functions, they can get very strange broken behavior. Does anyone have a good idea on how to prevent such a problem? My best idea so far is to have our centralized extensions update flags and check the flag status of functions that should have been called previously, so that if a super version is not called, that flag will not be set and the next inherited function called will report an error based on that missing flag. Quote Link to comment Share on other sites More sharing options...
uwes Posted April 27, 2012 Report Share Posted April 27, 2012 yes, basically you got two options: 1. a local flag identifying correct super.function usage (set when super.function is invoked, checked when used) 2. use a linter which is capable to check super.function invocation /uwe Quote Link to comment Share on other sites More sharing options...
adielkhan Posted May 1, 2012 Report Share Posted May 1, 2012 Using flags is a bit messy, better of just writing a simple uvm_linter to check within function foo endfunction that super.foo() has been used. if you use flags, you need one flag per object, then a flag for each derived object and you will need to maintain the flags for each derived object and each constructed object seperately Make sure you test it with a combination of multiple-derivation and single-derivation objects in the same testcase. -adiel. Quote Link to comment Share on other sites More sharing options...
ajeetha.cvc Posted May 1, 2012 Report Share Posted May 1, 2012 We have created some classes that extend uvm classes and add functionality to some of the uvm virtual functions. Our end users are supposed <SNIP> My best idea so far is to have our centralized extensions update flags and check the flag status of functions that should have been called previously, so that if a super version is not called, that flag will not be set and the next inherited function called will report an error based on that missing flag. VMM (1.0/1.1) did precisely that for vmm_env::gen_cfg etc. and it was well accepted by the users. Yes it can be little messy/complicated for the developer(s), but it works well for end users. Ajeetha, CVC www.cvcblr.com/blog Quote Link to comment Share on other sites More sharing options...
cristian_amiq Posted May 2, 2012 Report Share Posted May 2, 2012 AMIQ's Verissimo SystemVerilog Testbench Linter has liniting checks like ""<class_name> descendants must call super.<function_name>". You may want to take a look at the datasheet here: http://www.dvteclipse.com/design_and_verification_tools_datasheet_download.php and play with it using the free trial. 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.