chenyong Posted September 16, 2011 Report Share Posted September 16, 2011 Hi, I met a problem on clone. In my code for scoreboard, I defined a variable as this: timer_pkt_item chk_pkt; the timer_pkt_item is defined as a class in other place. I then register it as: `uvm_component_utils_begin(timer_scoreboard) `uvm_field_object(chk_pkt, UVM_DEFAULT) `uvm_component_utils_end In my write function for export implementation, I would like to do this: function void write_pkt(timer_pkt_item rcv_pkt); chk_pkt = rcv_pkt.clone(); endfunction My purpose is to save received data of rcv_pkt. When I start to compile the code, irun reports error as: assignment operator type check failed (expecting datatype compatible with 'class timer_pkt_item' but found 'class uvm_object' instead). so what is the problem to the code? I think I have defined the variable type as timer_pkt_item, why there is problem? please give me some help. thanks. Quote Link to comment Share on other sites More sharing options...
arno Posted September 16, 2011 Report Share Posted September 16, 2011 clone() returns a uvm_object, which you need to cast. Your code should be : $cast ( chk_pkt , rcv_pkt.clone()) chandan and ljepson74 2 Quote Link to comment Share on other sites More sharing options...
chenyong Posted September 16, 2011 Author Report Share Posted September 16, 2011 yes, you are right. thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.