Jump to content

using a task of class1 in class2 when both class1 &2 have common base classe


Recommended Posts

Hi,

I've my class hierarchy as below

class B extends class A

endcalss

class B1 extends class B

task D()

endclass

class C extends class A

endclass

class E extends class C

B1 B1_inst;

function new(string name = "E", uvm_component parent = null);

super.new(name,parent);

B1_instt=new();

endfunction // new

virtual task run_vseq();

B1_inst.D();

super.run_vseq();

endtask

endclass

Both class B & C are derivatives of class A

class B1 is derived from class B and has a task D

class E is derived from class C. Now i need to use task D in class E

I followed normal method of instantiating class B1 in the class E and used the required task as inst_B1.D(). But it is not working. I'm getting a UVM fatal error message for it.

Link to post
Share on other sites

Can you be more specific with what is not working (i.e. the behavior you are seeing versus what you expected to happen) What is the error message you are getting and on which line of code produces the message? What you have shown (minus the syntax errors, typos, and missing code fragments) looks fine to me.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...