Define and print enum vector in UVM

In reply to vineet_sharma:

The first recommendation is to not use the `uvm_field_XXX macros.

Second, cacheline_state is an array of enums. You most likely want to iterate over each item to print the name.


// Implementation example:
function string convert2string();
 string s;
 
 s = super.convert2string();
 // Note the use of \t (tab) and \n (newline) to format the data in columns
 // The enumerated cacheline_state types .name() method returns a string corresponding to its value
 foreach(cacheline_state[i]) begin
   $sformat(s, "%s cacheline_state[%0d] \t%s\n", s, i, cacheline_state[i].name());
 end
 return s;
endfunction: convert2string

function void do_print(uvm_printer printer);
  printer.m_string = convert2string();   
endfunction: do_print