I have some more suggestions exploiting the advantage of UVM_CONFIG_DB
Since you are talking of interface signal (an example given in the cookbook for your reference) you can make the functions that can sit on that signal as follow:
IN UVM AGENT CONFIG you have the pointer to interface through config_db and virtual interface:
This task is a convenience method for sequences waiting for the interrupt
*// signal
task spi_env_config::wait_for_interrupt;
@(posedge INTR.IRQ);
endtask: wait_for_interrupt
// Check that interrupt has cleared:
function bit spi_env_config::is_interrupt_cleared;
if(INTR.IRQ == 0)
return 1;
else
return 0;
endfunction: is_interrupt_cleared*
so in the virtual sequence since you get the config of the agent to map the sequencer to sequences so these functions are available there as well:
// Get config
if(!uvm_config_db #(spi_env_config)::get(null, {“uvm_test_top.”, get_full_name()}, “spi_env_config”, m_cfg)) begin
`uvm_error(“body”, “Cannot find spi_env_config”)
end
// Sequence body:
*fork
begin
m_cfg.wait_for_interrupt;
wait_unload.start(apb);
if(!m_cfg.is_interrupt_cleared()) begin
`uvm_error(“INT_ERROR”, “Interrupt not cleared by register read/write”);
end
end
*
P.S: Refer cookbook example for its details**
Other way can be since you set the pointer of your interface in the uvm_config_db in your tb_top so you can get the same from uvm_config and access any signal you want.
Note: This is non recommended way but I am writing here to explain the way flexibility of use.
//---------- TB Top--------------------//
// UVM initial block:
// Put virtual interfaces into the resource db & run_test()
*initial begin
uvm_config_db #(virtual apb_if)::set(null, “uvm_test_top”, “APB_vif”, APB);
uvm_config_db #(virtual spi_if)::set(null, “uvm_test_top”, “SPI_vif”, SPI);
*
// -------- Sequence ----------//
// Interrupt Virtual Interface - used in the wait for interrupt task
//
virtual intr_if INTR;
if(!uvm_config_db #(virtual spi_if)::get(this, “”, “SPI_vif”, m_spi_cfg.SPI)) begin
`uvm_error(“RESOURCE_ERROR”, “SPI virtual interface not found”)
end