In reply to Amarjit pradhan:
The code given below is body method of virtual sequence. as m_sequencer is a handle of uvm_sequencer_base class which always exist for the uvm_sequence and when virtual sequence is start on the virtual sequencer (in test run_phase), start method internally does m_sequencer = virtual sequencer class handle, my doubt is why do we need to do $cast(v_seqr,m_sequencer) in virtual sequence body method ?
task body();
if(!$cast(v_sqr, m_sequencer)) begin
`uvm_error(get_full_name(), “Virtual sequencer pointer cast failed”);
end
bus = v_sqr.bus;
gpio = v_sqr.gpio;
endtask: body
I think, the reason for casting is used to check the compatibility between v_sqr and m_sequencer.