8000 Fix package reference not found type_id · Issue #5833 · verilator/verilator · GitHub
[go: up one dir, main page]

Skip to content
Fix package reference not found type_id #5833
@wsnyder

Description

@wsnyder

Another type_id case that got added to a future UVM release, as noted in #5826, but different case.

Below gives: `

%Error: Package/class for ':: reference' not found: 'type_id'
   18 |                      t = BUSTYPE::type_id::create("t");

@kbieganski analyzed (thanks) and: "This case seems to break because of the default type parameter. uvm_object doesn't have type_id, but we try to link BUSTYPE::type_id (=uvm_object::type_id) in LinkDot which fails. We can defer it until after V3Param but then the instance with default params is still around, so we revisit it and have the same problem. We'd have to delete the default instances if unused after V3Param. I'm not familiar enough with that stage to know how difficult that is.

Which also sounds related to #4581 et al.

`define stop $stop
`define checks(gotv,expv) do if ((gotv) != (expv)) begin $write("%%Error: %s:%0d:  got='%s' exp='%s'\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);

package uvm_pkg;
   virtual class uvm_void;
   endclass
   virtual class uvm_object extends uvm_void;
   endclass
   class uvm_report_object extends uvm_object;
   endclass
   virtual class uvm_component extends uvm_report_object;
   endclass
   class uvm_reg_predictor #(type BUSTYPE=uvm_object) extends uvm_component;
      static function string type_name();
         static string m_type_name;
                  if (m_type_name == "") begin
                     BUSTYPE t;
                     t = BUSTYPE::type_id::create("t");
                     m_type_name = {"uvm_reg_predictor #(", t.get_type_name(), ")"};
                  end
         return m_type_name;
      endfunction
   endclass
endpackage

class my_bus extends uvm_pkg::uvm_component;
   typedef my_bus type_id;
   static function type_id create(string name);
   endfunction
   static function string get_type_name();
      return "my_bus";
   endfunction
endclass

module t;
   initial begin
      string s;
      uvm_pkg::uvm_reg_predictor #(my_bus) rp;
      rp = new;
      s = rp.type_name();
      `checks(s, "uvm_reg_predictor #(my_bus)");
      $display("*-* All Finished *-*");
      $finish;
   end
endmodule

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: elaborationIssue involves elaboration phasestatus: readyIssue is ready for someone to fix; then goes to 'status: assigned'

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0