In reply to UVM_LOVE:
In reply to chr_sue:
Sir can you explain this?
module test_module ();
`include "uvm_macros.svh"
import uvm_pkg::*;
class A; endclass
class B extends A; endclass
class C extends A; endclass
A a_h;
B b_h;
C c_h;
initial begin
b_h = new;
a_h = b_h; // always legal to go up the inheritance tree
$cast(b_h, a_h); // $cast required - will succeed
c_h = new();
b_h = c_h;
$cast(c_h, b_h);
end
endmodule : test_module
I got xrun: 20.09-s003: (c) Copyright 1995-2020 Cadence Design Systems, Inc.
b_h = c_h;
|
xmvlog: *E,TYCMPAT (testbench.sv,20|12): assignment operator type check failed (expecting datatype compatible with 'class test_module::B' but found 'class test_module::C' instead).
Error message.
I thought b_h and c_h are extended by same class.
But b_h and c_h are not same class type so.
I assign b_h = c_h;
But why does assign make error?