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

**URL:** <https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842>\
**Category:** UVM\
**Tags:** UVM\
**Created:** [March 21, 2012, 9:53am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842 "2012-03-21T09:53:29Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![meenu2k11](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@meenu2k11](https://verificationacademy.com/forums/u/meenu2k11)\
**Post date:** [March 21, 2012, 9:53am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/1 "2012-03-21T09:53:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [March 21, 2012, 1:45pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/2 "2012-03-21T13:45:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![meenu2k11](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@meenu2k11](https://verificationacademy.com/forums/u/meenu2k11)\
**Post date:** [March 22, 2012, 5:09am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/3 "2012-03-22T05:09:05Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/2):_

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.

---

<div class="post-metadata">

**Author:** ![vineethvs](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/vineethvs/32/1621_2.png) [@vineethvs](https://verificationacademy.com/forums/u/vineethvs)\
**Post date:** [March 22, 2012, 9:01am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/4 "2012-03-22T09:01:09Z")

</div>

_In reply to [meenu2k11](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/3):_

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

---

<div class="post-metadata">

**Author:** ![mperyer](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@mperyer](https://verificationacademy.com/forums/u/mperyer)\
**Post date:** [March 22, 2012, 10:53pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/5 "2012-03-22T22:53:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![meenu2k11](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@meenu2k11](https://verificationacademy.com/forums/u/meenu2k11)\
**Post date:** [March 26, 2012, 6:58am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/6 "2012-03-26T06:58:26Z")

</div>

_In reply to [mperyer](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/5):_

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?

---

<div class="post-metadata">

**Author:** ![mperyer](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@mperyer](https://verificationacademy.com/forums/u/mperyer)\
**Post date:** [March 26, 2012, 7:35am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/7 "2012-03-26T07:35:53Z")

</div>

Does the package containing the class that extends uvm\_test import uvm\_pkg::\*?

If not, then that might account for the problem.

---

<div class="post-metadata">

**Author:** ![dv\_engr](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@dv\_engr](https://verificationacademy.com/forums/u/dv_engr)\
**Post date:** [April 16, 2012, 3:22pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/8 "2012-04-16T15:22:03Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![suyog](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/suyog/32/2132_2.png) [@suyog](https://verificationacademy.com/forums/u/suyog)\
**Post date:** [May 19, 2014, 1:28pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/9 "2014-05-19T13:28:20Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [May 19, 2014, 1:47pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/10 "2014-05-19T13:47:04Z")

</div>

_In reply to [suyog](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/9):_

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.

---

<div class="post-metadata">

**Author:** ![suyog](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/suyog/32/2132_2.png) [@suyog](https://verificationacademy.com/forums/u/suyog)\
**Post date:** [May 19, 2014, 1:49pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/11 "2014-05-19T13:49:50Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/10):_

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

---

<div class="post-metadata">

**Author:** ![zala\_mayur2020](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/z/ecc23a/32.png) [@zala\_mayur2020](https://verificationacademy.com/forums/u/zala_mayur2020)\
**Post date:** [December 24, 2014, 10:16am UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/12 "2014-12-24T10:16:30Z")

</div>

_In reply to [suyog](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/11):_

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

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [December 24, 2014, 2:18pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/13 "2014-12-24T14:18:26Z")

</div>

_In reply to [zala\_mayur2020](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/12):_

Make sure you read everything in this post and try some of the factory debug features. [Debugging/BuiltInDebug | Verification Academy](https://verificationacademy.com/cookbook/builtindebug#Factory_Debug_Features)

---

<div class="post-metadata">

**Author:** ![Sturekha](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@Sturekha](https://verificationacademy.com/forums/u/Sturekha)\
**Post date:** [April 30, 2017, 5:46pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/14 "2017-04-30T17:46:55Z")

</div>

_In reply to [zala\_mayur2020](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/13):_  
Hi!  
I am also getting the same error,please help!

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [April 30, 2017, 8:11pm UTC](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/15 "2017-04-30T20:11:41Z")

</div>

_In reply to [Sturekha](https://verificationacademy.com/forums/t/cannot-create-a-component-as-it-is-not-registered-with-a-factory/27842/14):_  
Make sure you read everything in this post and try some of the factory debug features. [Debugging/BuiltInDebug | Verification Academy](https://verificationacademy.com/cookbook/builtindebug#Factory_Debug_Features)
