add_hdl_path_slice and add_hdl_path are both used to set the hierarchy path of a register in the test bench. This XMR (cross module reference) path is used to do back door access to the register. My question is this: Is there a way to print this XMR path for a register in the log file when running the simulation by adding some code to the sequence that is trying to do a write and read to the register?
The reason I am asking this question is that I want to be able to find the register in the DUT by knowing its XMR.
add_hdl_path_slice and add_hdl_path are both used to set the hierarchy path of a register in the test bench. This XMR (cross module reference) path is used to do back door access to the register. My question is this: Is there a way to print this XMR path for a register in the log file when running the simulation by adding some code to the sequence that is trying to do a write and read to the register?
The reason I am asking this question is that I want to be able to find the register in the DUT by knowing its XMR.
Pls help!
uvm_hdl_path_concat paths[$];
register.get_full_hdl_path(.paths(paths));
foreach(paths[i]) begin
`uvm_info(get_name(), $sformatf("HDL path: %s", paths[i]), UVM_MEDIUM)
end
it complains the %s does not match the type uvm_hdl_path_concat.
I tried to do cast paths[] to paths_s[] like this:
string paths_s[$] ;
$cast(paths_s[i], paths[i]) ; (inside the foreach)
and then used paths_s[i] instead of paths[i] in the `uvm_info and it failed due to
$cast did not succeed.
In reply to manning999:
The vcs compilier does not like this: uvm_info(get_name(), $sformatf("HDL path: %s", paths[i]), UVM_MEDIUM) it complains the %s does not match the type uvm_hdl_path_concat. I tried to do cast paths[$] to paths_s[$] like this: string paths_s[$] ; $cast(paths_s[i], paths[i]) ; (inside the foreach) and then used paths_s[i] instead of paths[i] in the uvm_info and it failed due to
$cast did not succeed.
How to fix this issue?
Pls help.
Sorry, my mistake. For each uvm_hdl_path_concat object, you also need to iterate the slices, which is an array and a public member of the uvm_hdl_path_concat class. The code should be
uvm_hdl_path_concat paths[$];
register.get_full_hdl_path(.paths(paths));
foreach(paths[i]) begin
foreach(paths[i].slices[j]) begin
`uvm_info(get_name(), $sformatf("HDL path: %s", paths[i].slices[j].path), UVM_MEDIUM)
end
end
Each slice is a struct with 3 members - path, offset, and size. The path is what you want in this example. The offset and size are for the register field corresponding to the HDL path slice.