bap001 Posted December 8, 2011 Report Share Posted December 8, 2011 Hi , I have a basic UVM question, How can I make base class data elements visible in extended classes? Any help would be highly appreciated! I tried declaring the "do_test" as protected too - that should not be needed but it does not work either. I am missing something very basic here.. class dut_test extends uvm_test; rand bit do_test; function new(string name, uvm_component parent=null); super.new(name,parent); do_test = 1'b0; endfunction //Another function sets this bit ..... endclass; class dut_test_pkt extends dut_test; //I want to access do_test from the base class in the build portion of this class. //How do I do it? ...... //This is what I need to do - use it to constrain another cfg class.. virtual function void build_phase(uvm_phase phase); super.build_phase(phase); assert (cfg.randomize() with { enable == do_test; } endclass Quote Link to comment Share on other sites More sharing options...
dave_59 Posted December 9, 2011 Report Share Posted December 9, 2011 Could please explain what "doesn't work" means? Are you getting a compiler error or not the result you expect? You always have access to base class members from an extended class, unless they are declared "local". Quote Link to comment Share on other sites More sharing options...
bap001 Posted December 9, 2011 Author Report Share Posted December 9, 2011 Hi Dave, Thanks for the response. I am using ISU 10.20. With it, I get a compile error that "dut_test" is not part of the class. We have this complex environment of sequencers and agents talking to each other - and they work ok. We tried to do something as simple as this - it failed. We have since gotten around this by adding another level of encapsulation and using a method to set this signal - not the best but made us go ahead.. I realized that I have one modification to what I posted above, The hierarchy is as follows: class test_base extends uvm_test class dut_test extends test_base -- dut_test declared here.. class dut_test_pkt extends dut_test //Goal is to use dut_test here.. Is the problem because "dut_test" is not declared in the base class? Thanks once again! Quote Link to comment Share on other sites More sharing options...
dave_59 Posted December 9, 2011 Report Share Posted December 9, 2011 I'll give you another tip, don't mention what tool you are using until it is absolutely necessary - it will decrease the amount of expert advice you might get. Are these classed being compiled in the order you presented? Where and exactly what is the error message? Quote Link to comment Share on other sites More sharing options...
bap001 Posted December 9, 2011 Author Report Share Posted December 9, 2011 Oh thanks for the tip .. will keep that in mind. Let me retry that and post the actual error. Yes, the classes are being compiled in the same order.. Thanks a lot! 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.