Cannot create a component as it is not registered with a factory

Hi
When I try running a test, i get an error "Cannot create a component of type TEST_DIR_PATH/test_name> because it is not registered with the factory ".
The test is registered with the factory `uvm_components_utils(“testclass name”)

What can be the possible reason for the error?

Thanks

When you register a component with the factory, you do not enclose the class name with quotes.

You should use `uvm_component_utils(testclass_name) (note no quotes).

Also, the error message seems to indicate that you are possibly including a path with the test name? You should specify only the class name with +UVM_TESTNAME (i.e. +UVM_TESTNAME=testclass_name).

–Chuck

In reply to cgales:

Hi
The quotes was a mistake in the post. I have not used quotes.
If i do not mention the path of the test in the makefile, how will it know where to pick up tests from ?
Am new to UVM. Even if i do not mention the testname but just the testclass name(ie.if the name of my test is test1.sv and the name of the class is test1 , i include only the testclass name +UVM_TESTNAME = test1) ,I get the same error.

UVM WARNING Cannot create a component of type ‘test1’ because it is registered with the factory
UVM FATAL Requested test from command line +UVM_TESTNAME = test1 was not found.

In reply to meenu2k11:

I think you needn’t create the test. Once you register with fatory, just need to call run_test.

Have you imported the package containing the test class into your top level testbench module?

This is one of the common causes of the problem you describe.

In reply to mperyer:

Hi
I tried importing the package into the test top. The not registered with the factory error is gone. But for the test which starts with

class testclass_name extends uvm_test;

I get a sytax error in the first line the error being " Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope"

Has anyone come across this error? If yes, any clue on how to resolve it?

Does the package containing the class that extends uvm_test import uvm_pkg::*?

If not, then that might account for the problem.

Might be that you forgot 'include"filename.sv" somewhere in file
I think you should include the file in the top level using 'include" file name.sv"

Hey, I am facing exactly the same issue…
Did you get an answer…
I have registered the testname with factory…But dont know still why I am getting the same error!!!

In reply to suyog:

Things to check if you are seeing this error:

  • Your test is registered with the factory using the `uvm_component_utils()
  • Your test is part of a test package and that package is imported in your testbench at the same level that run_test() is called.
  • Your +UVM_TESTNAME=my_testname argument on the simulation command line has ‘my_testname’ match exactly what is registered above.

In reply to cgales:

I fixed this…
Actually the issue was uvmgen script generates some ifdefs automatically which was skipping the code of interest(factory registration).
Chagned the ifdefs and it worked.
Thanks,
Suyog

In reply to suyog:

Hi

I am getting the same error though I have registered in factory & I am passing same name to +UVM_TEST_NAME.
Can anybody please help

Thanks,
Mayur

In reply to zala_mayur2020:

Make sure you read everything in this post and try some of the factory debug features. Debugging/BuiltInDebug | Verification Academy

In reply to zala_mayur2020:
Hi!
I am also getting the same error,please help!

In reply to Sturekha:
Make sure you read everything in this post and try some of the factory debug features. Debugging/BuiltInDebug | Verification Academy