Hello !
-
Have a scenario where I store all the sequencer handles in an associative array for easy access from the top level test.
-
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:
uvm_sequencer_base seqr_pool[string]
// 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.
- 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
"uvm_test_top.top_env.env[0].which_agt[0].seqr", uvm_test_top.top_env.env[0].which_agt[0].seqr
"uvm_test_top.top_env.env[1].which_agt[0].seqr", uvm_test_top.top_env.env[1].which_agt[0].seqr
- When I looked for the sequencer in the pool, I passed the string as regex
launch_sequence_api(".*env\\[1\\].which_agt\\[0\\]", ...);
- 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;
foreach(seqr_pool[i]) begin
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());
break;
end
else begin
seqr_found = 0;
$display("Mismatched: name: %s, seqr_pool: %s\n", name, seqr_pool[i].get_full_name());
end
end
if(!seqr_found)
begin
`uvm_error(get_type_name(), $psprintf("sqr reference is not available in common_sequencer_container for %s name", name));
return null;
end
else
begin
return seqr_temp;
end
endfunction: which_seqr
Would this be fine ? Or is there a simple way of string matching/searching for such kinda-off scenarios ? Share in your comments.
In reply to desperadorocks:
I do not understand your efforts and wasting resources with a 2nd database to store sequencers.
All what you are doing is already available from the factory.
In reply to chr_sue:
Hello @Chris,
Can you please elaborate more on your comment ? You mean to use the config_db/resource_db ? or is there anything else ?
Which would be the best case scenario as a place holder for all the sequencer handles in a single place so that we can pick-n-choose which ever sequencer we wanted at the top level test.
Also, to make sure it can sustain scalability like taking care of N-instance of env’s and other inter dependent env’s.
Please share in your comments !
@chris
It would be nice if you can add more comments from your side so that it gives a clear idea.
@All:
It would be nice if anyone can share some insight/comments/experience on this area.
Thanks !
In reply to desperadorocks:
The factory stores all your class objects (extensions from uvm_component/uvm_object). And they are sorting them with respect to belonging to the same family (inheritence).
Using the get_sequencer command (defined on the seq_item) it returns you the right sequencer.
In reply to chr_sue:
Hello! Thanks for your response.
Sorry for more question. But still for that particular sequence you need to be setting the sequencer on which you need to run right ? So how do you set that ? Ultimately you do by sequence.start(sequencer). So this will internally does the processing etc. and sets to the m_sequencer.
What I was trying is a light weight array/pool/container, which contains all the sequencer handles etc. tagged with the string names for them to access the class handle when these components gets created [not the entire list of components like factory]. So then I can use the uvm_re_match to get the sequencer handle from the pool and call the required sequence to run on respective sequencer which I wanted to run.
So instead of a person running a sequence at the test like,
// Providing the entire path of the sequencer
sequence.start(tb_env.tb_agt.tb_seqr);
What I am doing is like,
// This returns the handle for that particular sequencer.
uvm_sequencer_base local_seqr = which_sequencer_api(".*tb_agt.*");
sequence.start(local_seqr);
// Imagine if the above case expands to multiple env/agt scenario
Is there any other ways to get things done better. Please let me know.
In reply to desperadorocks:
How many different sequencers do you have? 5, 10 or 15? In any case it is a small amount of sequencers. If you have more than 1 agent you should use virtual sequences. The virtual sequence will be started from the test on a virtual sequencer or on null. You can have in the virtual sequencer handles to the local/agent sequencers. This allows you to start your local sequences like this:
agent1_seq.start(agent1_seqr);
agent2_seq.start(agent2_seqr);
You do not need any path information. I understand your concept. But it requires always to be maintained. This might be a risk.
In reply to chr_sue:
Hello @Chris,
Thanks a lot for taking time and providing your inputs. Appreciate your time !