Common Reg model access for uvm env and virtual seq library

In reply to nivas:

I believe you are doing som things wrong and others complicated.
(1) I do not see where you are getting the ral-model object from.
(2) What are you doing here:

db_name = drive_me;
uvm_config_db #(uvm_reg_block)::set(null, "toy_tc_top", db_name, ral_model);

db_name has to be a string. This is not shown.
You are setting the ral-model but it seems there is no object.
(3) In the virtual sequencer you do not need the ral-model, but you might need it in the virtual sequence. You can directly connect the ral-model in the virtual sequence when after creating it in the test, by passing the path to the env.
(3) You do not need the functions get_reg_by_name and get_field_by_name. You can directly call
reg-model.my_reg.my_field.write(…);

When you are using a ‘write’ from the testbench, this is a ral-model write which will be converted to an AXI write.