I wanted to print out a structure used in a ovm_sequence_item. Since the structure is long, I plan to override table printer knobs by using tbl_printer.knobs.value_width = 100;
Here is the code snipper
virtual function void do_print(ovm_printer printer);
ovm_table_printer tbl_printer;
super.do_print(printer); //print all other fields
$cast(tbl_printer, printer);
tbl_printer.knobs.value_width = 100;
tbl_printer.print_generic("ppid","CppPpid_t",$bits(CppPpid_t),
$psprintf("A=%0b,B=%0b,C=%0d,D=%0d,E=%0d,F=%0x",
struct.A,
struct.B,
struct.C,
struct.D,
struct.E,
struct.F)
);
endfunction: do_print
I am getting this casting error. Error-[DCF] Dynamic cast failed *.sv, 58 Casting of source class type 'SIP_SHARED_LIB.ovm_pkg.ovm_tree_printer' to destination class type 'SIP_SHARED_LIB.ovm_pkg.ovm_table_printer' failed due to type mismatch. Please ensure matching types for dynamic cast
Can someone help me what I am doing wrong? How is it getting ovm_tree_printer when I am trying to use ovm_printer?