Hi ,
I am currently writing a function which returns 1 only when all fields within a uvm_reg are RO . So if I have combination of fields like “RW” , “RO” , etc the function should return 0 .
function bit ONLY_RO ( uvm_field fld[$] ) ; // fld Contains all uvm_fields within a uvm_reg ( Obtained via get_fields( ) method )
foreach( fld[i] )
begin
// if ( ! fld[i].get_access inside {"RO"} ) // [QA] Compilation Error !!
if ( fld[i].get_access inside { "RW" , "W1C" , "WO" } // [QB]
begin
return 0 ;
end
end
return 1 ;
endfunction
[QA] get_access returns a string so using ! is illegal . Any alternative ?
[QB] This is what I am going for now , but this code is subject to access of the project . I want a generic code so that if I have a new access policy ( apart from RW or W1C or WO ) the logic should still work .