Overriding max_size of uvm_driver

Hi ,

I see that when seq_item_port of uvm_driver is instantiated in its constructor the min_size and max_size are 0 and 1 respectively .

So I decided to change max_size to UVM_UNBOUNDED_CONNECTIONS ( To connect multiple sequencers )



class user_driver extends uvm_driver#(Txn) ; // uvm_driver Requires uvm_sequence_item Type as a Parameter !!

`uvm_component_utils(user_driver)

function new (string name , uvm_component parent);
 super.new(name,parent);
 seq_item_port = new("my_seq_item_port",this,0,UVM_UNBOUNDED_CONNECTIONS); // Name Argument Changed !! 
endfunction

.....


// In agent which instantiates driver 

 user_driver drv ;
 uvm_sequencer #(Txn) seqr1 ;
 uvm_sequencer #(Txn) seqr2 ;

virtual function void build_phase ( uvm_phase phase ) ;

   drv = user_driver::type_id::create("drv",this);
 seqr1 = uvm_sequencer#(Txn)::type_id::create("seqr1",this); // Remember uvm_sequencer#(Txn)::type_id else Error !! 
 seqr2 = uvm_sequencer#(Txn)::type_id::create("seqr2",this);

endfunction



virtual function void connect_phase ( uvm_phase phase ) ;

 drv.seq_item_port.connect(seqr1.seq_item_export);
 drv.seq_item_port.connect(seqr2.seq_item_export);

endfunction

virtual function void end_of_elaboration_phase ( uvm_phase phase ) ;
uvm_root uvm_top = uvm_root::get() ;
  
  uvm_top.print_topology();

endfunction 



I see the Output ( Only driver part written down ) as ::



----------------------------------------------------------
Name                   Type                    Size  Value
----------------------------------------------------------
uvm_test_top           my_agent                -     @454 
  drv                  user_driver             -     @462 
    my_seq_item_port   uvm_seq_item_pull_port  -     @488 
    rsp_port           uvm_analysis_port       -     @479 
    seq_item_port      uvm_seq_item_pull_port  -     @470  // [Q2]


[Q1] Why was the min_size of uvm_seq_item_pull_port chosen to be 0 ?

[Q2] Why is that uvm_seq_item_pull_port gets displayed twice ? Shouldn’t the default one ( instantiated inside uvm_driver ) be null since we
call new() again on it ? ( SV LRM 8.29 ) .

[Q3] If I call null explicitly before calling new() again I still see same output , why so ?

Thanks ,

In reply to MICRO_91:

This is because you have constructed it twice, in the base uvm_driver::new() and in user_driver::new(). Once you construct a class derived from uvm_component, there’s no way to delete it because it gets linked into the UVM testbench hierarchy.

What you should do just create another pull_port and leave the existing one unconnected. The reason min_size of uvm_seq_item_pull_port chosen to be 0 is so that it can be left unconnected.

IMHO, it would be better not to use uvm_driver in the first place. The uvm_component class (which all ports/exports are derived from) creates a lot of overhead even if never used. However, you lose the connivence of grouping all your drivers by uvm_driver which many IDEs and debugging tools let you do.

In reply to MICRO_91:

Just curious, why you have 2 sequencer in your driver?

In reply to haykp:

Its just a code I was trying in reference to a question I saw on the forum about Connecting multiple sequencers connected to a driver .

In reply to MICRO_91:

Oh I see. To my opinion, when you need to create 2 sequencers in the agent, then it is clear sign that something is wrong with your TB architecture.
Any other opinions, please?~

In reply to MICRO_91:

In reply to haykp:
Its just a code I was trying in reference to a question I saw on the forum about Connecting multiple sequencers connected to a driver .

In the UVM you have alot of freedom, because there are no compliance rules. The question is why do you need this. The most important rule in constructing a UVM testbench is: make it as easy as possible!
In your driver you can serve only 1 seq_item at the same time. Why do you need 2 seq_item?
Please explain.

In reply to chr_sue:

The code intent was to see how could I change the min_size/max_size argument of uvm_seq_item_pull_port .

I didn’t think ( or mean ) about it from testbench perspective . It was more of a coding question rather than a practical application .

I have never used multiple sequencers in my limited experience .
I won’t be able to comment on application of having multiple sequencers connected to a driver .
It’s seniors on this forum that could guide me about this ( If there even is a need/application for multiple seqrs connected to same driver )

Thanks