An abstract class cannot be instantiated in module

82 views Asked by At

I am seeing following error while trying to instantiate a new() function.

Error-[SV-ACCNBI] An abstract class cannot be instantiated model_dpi_module, "umc_uvc_ptr = new("umc_uvc_ptr", null);" Instantiation of the object 'umc_uvc_ptr' can not be done because its type 'uvm_component' is an abstract base class. Perhaps there is a derived class that should be used.

Code is as follows:

  module model_dpi_module
  task abc_model_dpi(int pkg,int inst);
  uvm_component umc_uvc_ptr;
  **umc_uvc_ptr = new("umc_uvc_ptr", null);**
  umc_uvc_ptr = uvm_top.find($sformatf("uvm_test_top.example_uvc.export_uvc_%0d_%0d_%0d", 0, inst,  inst));
  umc_uvc[pkg][inst].if_env[0].run_model_init(0, 0,0);
 endtask : abc_model_dpi

Thanks,

1

There are 1 answers

4
dave_59 On

Being in a module has nothing to do with it. You cannot construct (call new) on an instance of uvm_component. It is meaningless.

You do not need to construct anything as the next line is going to put a handle into umc_uvc_ptr anyways. Simply remove the line that is giving you an error.