Hi,
I am trying to print a vector of enum type as shown below in code, but getting errors:
class mem_seq_item extends uvm_sequence_item;
typedef enum logic [2:0] {
CL_INVALID = 2'b00,
CL_CLEAN = 2'b01,
CL_DIRTY = 2'b10
} t_cacheline_state;
typedef t_cacheline_state [3:0] v_cacheline_state;
rand v_cacheline_state cacheline_state;
//expectation is that cacheline_state should store value of 4 lines like {CL_INVALID,CL_CLEAN,CL_INVALID,CL_DIRTY}, it gets this value in uvm_monitor from interface. interface signal store the value in above format.
//Utility and Field macros,
`uvm_object_utils_begin(mem_seq_item)
`uvm_field_enum(t_cacheline_state ,cacheline_state,UVM_DEFAULT)
`uvm_object_utils_end
//Constructor
function new(string name = "mem_seq_item");
super.new(name);
endfunction
virtual function void do_print(uvm_printer printer);
printer.print_string("curent_CL_STATE",cacheline_state.name());
endfunction
endclass
module seq_item_tb;
//instance
mem_seq_item seq_item;
initial begin
//create method
seq_item = mem_seq_item::type_id::create();
//randomizing the seq_item
seq_item.randomize();
//printing the seq_item
seq_item.print();
end
endmodule
I’m getting the below error for uvm_field_enum and do_print() both:
$unit, “this.cacheline_state.name”
The expression ‘this.cacheline_state’ is not an instance of an enum
variable.
Please refer to Section 6.19.5 ‘Enumerated type methods’ of the
SystemVerilog LRM Std. 1800-2012
is there any way to define the enum type to store multiple values of cache_line and print them?
Thanks,
Vineet