Hello All,
uvm_component cmp[$];
cmp.delete();
uvm_top.find_all("*driver",cmp);
if(cmp.size==1)begin
$display("one driver found");
end
else
$display("more match found q size>1");
Querry ;- Is it possible to display the contents of cmp[$] ?
Using default %p format specifier shows null
In reply to bl4ckp3rl :
If the $display is showing ‘null’ your queue is empty. Please check your search string.
Is “*driver” correct or should it be “driver”?
uvm_component comp[$];
comp.delete();
uvm_top.find_all("*driver*",comp);
if(comp.size == 1)
$display("exactly one driver found");
else if(comp.size >1)
$display(":::::::::___more than one driver found %0p::::::___",comp);
else
$display("try again");
In my TB there is only one driver ie my_driver , so queue.size should be one right ?
Not sure why there are more than one driver found.From output it seems the port connection is also being counted
OUTPUT :-
:::::::::more than one driver found @uvm_port_component__5@11 @uvm_port_component__6@2 @my_driver@1:::::::::::
The find_all method you have is seaching for all uvm_components with “driver” anywhere in their full hierarchical name since you put wildcard characters on both sides. TLM ports to connect your driiver to the sequencer are actually derived from uvm_component, so they show up as sub-components of your driver.
So remove the trailing “*”. Also, if you were only expecting one component to match, you can use the find method instead of find_all.