I’m writing an interface to be bound to a module which instantiated multiple times in my dut. In order to control the assertions included in the interface I’ve found inspiration from a post from Tudor Timisescu (My Take on SVA Usage with UVM) which in turns build on the notion of a “phase aware interface” introduced by Litterick (SVA Encapsulation in UVM) and other papers.
Unfortunately is not that straightforward to register the interface in the config_db since we don’t have an handle on all the instantiated interfaces as a result of the bind directive.
So I thought about the idea of a self-published interface introduced by Vance and others (My Testbench Used to Break! Now it Bends: Adapting to Changing Design Configurations, where we can use the %m
to have a unique id in the config_db:
initial begin
string s;
s = $sformatf("%m");
uvm_config_db #(sva_checker_wrapper)::set(null, s, "checker_wrapper", checker_wrapper);
end
In this case though I don’t want to register the interface, but rather an object called sva_checker_wrapper
that it is used by the agent in the build phase so that we can fake the checker_proxy to be under the agent hierarchy.
The agent is a very simple one and has the following code in the build_phase:
virtual function void build_phase(uvm_phase phase);
sva_checker_wrapper checker_wrapper;
super.build_phase(phase);
if (!uvm_config_db #(sva_checker_wrapper)::get(null, $sformatf("*%0d*%s", id, target_scope), "checker_wrapper", checker_wrapper))
`uvm_fatal("CFGERR", $sformatf("*%0d*%s", id, target_scope))
sva_checker = checker_wrapper.get_proxy("sva_checker", this);
endfunction: build_phase
the id
and the target_scope
are set by the environment when the agents are created in order to facilitate the retrieval of the checker_wrapper object stored by the bound interface.
I’ve added the wildcards so that it would match the instance of the interface, but unfortunately we don’t seem to have a match and the get fails to find the object in the config db.
Any idea or suggestion? My assumption is that this two strings should match when I’m trying to get the object from the config_db:
tb.dut.module[0].another_module.bound_intf
*0*bound_intf
while apparently they don’t…