1. Have a scenario where I store all the sequencer handles in an associative array for easy access from the top level test.
2. As the env gets created, the respective sequencer handles inside the agent in env gets added to this associative array pool. For eg, as shown below:
// Tag the sequencer handle with a string name
It was fine for single layer environments i.e. an env containing other env's. But it looked hard if the case was a top level env, containing N-instance of sub-envs, because there will be name scope collision.
3. To overcome this added the entire path of the sequencer as string search as each of them will be unique as the component gets created. For eg. like given below
// String name - Component handle : seqr_pool[name] = sequencer handle
4. When I looked for the sequencer in the pool, I passed the string as regex
5. Stumbled across this uvm_re_match DPI and put together this simple helper function to search for that string in the associative array pool.
function uvm_sequencer_base sequencer_pool::which_seqr(string name);
bit seqr_found = 0;
if (!uvm_re_match($psprintf("%s", name), $psprintf("%s", seqr_pool[i].get_full_name()))) begin
seqr_found = 1; seqr_temp = sqrtab[i];
$display("Matched: name: %s, seqr_pool: %s\n", name, seqr_pool[i].get_full_name());
seqr_found = 0;
$display("Mismatched: name: %s, seqr_pool: %s\n", name, seqr_pool[i].get_full_name());
`uvm_error(get_type_name(), $psprintf("sqr reference is not available in common_sequencer_container for %s name", name));
Would this be fine ? Or is there a simple way of string matching/searching for such kinda-off scenarios ? Share in your comments.