View Full Version : How to extend ovm classes? Basic instructions needed.
antti
03-14-2008, 04:29 AM
Hi,
I played with ovm and I tried to create my_ovm_random_stimulus by extending ovm_random_stimulus. I just needed different generate_stimulus task. All I did I wrote new my_generate_stimulus task. However, this seems not to work, since I didn't wrote "new" constructor. What did I miss here?
Where I can found basic instructions / examples to extend ovm classes?
Thanks,
Antti
dave_59
03-14-2008, 08:27 AM
When you extend any class, not only in the OVM, you must call super.new() in the constructor of your extended class and pass the required arguments to the constructor of the class you are extending. The call to super.new must be the first executable statement of your constructor.
For any class derived from ovm_component, you must pass the name and the parent component arguments.
function new(string name, ovm_component parent);
super.new(name, parent);
endfunctionDave
antti
03-17-2008, 12:18 AM
Thanks Dave, but I can't get forward. I took ovm_random_stimulus
"class ovm_random_stimulus
#(type trans_type=ovm_transaction)
extends ovm_component;"
=> modified as :
[line 79] :
"class my_random_stimulus
#(type trans_type=ovm_transaction)
extends ovm_random_stimulus;"
But this gives me warning below. I cannot understand the warning message. What is the trick with parameterised classes?
# ** Warning: mem_env.sv(79): (vlog-2181) Use of a parameterized class ovm_random_stimulus as a type creates a default specialization.
Br,
Antti
kurts
03-17-2008, 12:40 AM
I think you need to pass on the type parameter to the parent class, since it is also parameterized.
Try:
class my_random_stimulus #(type trans_type=ovm_transaction)
extends ovm_random_stimulus #(trans_type);
-Kurt
antti
03-19-2008, 05:06 AM
Thanks Kurt,
That's the way it works. Still in the learning curve....
Antti
Powered by vBulletin™ Version 4.0.3 Copyright © 2010 vBulletin Solutions, Inc. All rights reserved.