I have a common class common
class common;
extern function bit get_type ( bit [1:0] xact_type );
endclass
function bit get_type ( bit [1:0] xact_type );
`uvm_info(this.get_type_name(), $sformatf("Type is %h", xact_type), UVM_NONE)
endfunction
and Class A, B, C
class A
typedef bit [1:0] {
READ = 0,
WRITE = 1
} enum_a_type
enum_a_type a_type;
function void a;
common.get_type(a_type);
endfunction
endclass
class B
typedef bit [1:0] {
READ = 0,
WRITE = 1
} enum_b_type
enum_b_type b_type;
function void b;
common.get_type(b_type);
endfunction
endclass
class C
typedef bit [1:0] {
READ = 0,
WRITE = 1
} enum_c_type
enum_c_type c_type;
function void c;
common.get_type(c_type);
endfunction
endclass
And all are work fine, but I wanna print “Type is READ/WRITE” rather than “Type is 0/1”
I try to modify the class common
class common;
typedef bit [1:0] {
READ = 0,
WRITE = 1
} enum_common_type
extern function bit get_type ( enum_common_type xact_type );
endclass
function bit get_type ( enum_common_type xact_type );
`uvm_info(this.get_type_name(), $sformatf("Type is %s", xact_type), UVM_NONE)
endfunction
But it shows compile error:cannot assign a variable type to a value of type
I can’t modify class A, B, C, for it maintained by others.
Is there any method to do this ?
Thanks.