# UVM

**URL:** <https://verificationacademy.com/forums/t/uvm/41740>\
**Category:** UVM\
**Tags:** UVM, SystemVerilog, \-UVM-warnings-disable\
**Created:** [June 1, 2023, 1:59pm UTC](https://verificationacademy.com/forums/t/uvm/41740 "2023-06-01T13:59:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HoussamSABOUR](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/d6d6ee/32.png) [@HoussamSABOUR](https://verificationacademy.com/forums/u/HoussamSABOUR)\
**Post date:** [June 1, 2023, 1:59pm UTC](https://verificationacademy.com/forums/t/uvm/41740/1 "2023-06-01T13:59:41Z")

</div>

Hello,

I have this error but i don’t know where i have the problem :  
**test\_spi\_2\_ahb [CLDEXT] Cannot set ‘test\_spi\_2\_ahb’ as a child of ‘uvm\_test\_top’, which already has a child by that name**\*\_\_\*

this is my code :

```verilog
class e_test extends uvm_test ; 
  `uvm_component_utils(e_test) 
  spi2ahb_test test_spi_2_ahb ; 
  //=======================================================
  // function new 
  //=======================================================

  function new (input string name, uvm_component parent = null) ; 
    super.new (name,parent) ; 
  endfunction : new 

  //=======================================================
  // build_phase : Création de la classe spi2ahb 
  //=======================================================
  virtual function void build_phase(uvm_phase phase);
		super.build_phase(phase);
		test_spi_2_ahb = spi2ahb_test::type_id::create("test_spi_2_ahb",this);
    endfunction : build_phase 

endclass : e_test

class test extends uve_test;
        `uvm_component_utils(test)
        spi2ahb_test test_spi_2_ahb ;
        function new ( input string name, input uvm_component parent = null ) ;
            super . new ( name, parent ) ;
        endfunction

        virtual function void build_phase(uvm_phase phase);
            super.build_phase(phase);
            test_spi_2_ahb = spi2ahb_test::type_id::create("test_spi_2_ahb",this);
        // u_test = uve_test::type_id::create("u_test",this);
        endfunction

        // Main test sequence
        virtual task main_phase ( uvm_phase phase ) ;

            logic [`DIVE_SPI_DATA_WIDTH - 1 : 0] data;
            logic [`DIVE_SPI_DATA_WIDTH - 1 : 0] rdata[];
            logic [`DIVE_SPI_DATA_WIDTH - 1 : 0] wdata[];
            integer def_nb_data_access;
            integer def_start_addr;

            byte shift = $clog2(`DIVE_SPI_DATA_WIDTH/8);
            
       
            //------------------------------------------------------
            phase . raise_objection ( .obj ( this ) ) ;
            //------------------------------------------------------

            def_start_addr = 0;
            def_nb_data_access = 1; //TODO_RNK return to 20

            
            test_spi_2_ahb.spi_write_reg_spi_mode(TB_CICR__ADDRESS , QUAD);
            
         
            test_spi_2_ahb.spi_checksum_compare();
end class

```

spi\_checksum\_compare(),spi\_write\_reg\_spi\_mode : are methods declared on class spi2ahb\_test

---

<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:** [June 1, 2023, 2:58pm UTC](https://verificationacademy.com/forums/t/uvm/41740/2 "2023-06-01T14:58:16Z")

</div>

_In reply to [uvm\_share](https://verificationacademy.com/forums/t/uvm/41740):_

Your class **test** has duplicated the test\_spi\_2\_ahb variable and construction of the spi2ahb\_test object. There is no need to do that since it is being done the e\_test base class.
