Make connexion between Tb_if and dut_if in hdl_top

Hello everyone

I had a problem writing the file IP_hdl_top when assigning the VIP interface tb_if and the DUT interface dut_if.

Indeed, I usually do the assignment simply as the example below:
Assign dut_if_xbar.msg = tb_if_xbar2e2e_rx.data;

But this time I have a signal push_data (side TB_inf) that depends on the type of flit (either data or header) that will be pushed in TB_inf.

I solved this problem with an “IF block”, but among the types of flit there is a type (called E2E CRC) that depends on the type of the previous flit: if the previous flit is data, it will be data and if the previous type is header, it will be also a header

My question: How could I save the previous flit type so that I can check in the case of flit ERE CRC what type exactly does it match; To finally assign the push-data signal correctly ?

Other Question :
If the port mapping of an interface depends on the outputs of the ports of another interface and we have made a block if to check conditions to make an assign to this port.
Is that I have to put the “IF block” in a process or else the verification and the mapping of the ports is always done without need of “Always Block”

  ////Mapping niclet_rx Dut_if with niclet_rx tb_if

	assign { dut_if_niclet_rx.flit_data ,
        	dut_if_niclet_rx.flit_type ,
		dut_if_niclet_rx.exp_seq_nb ,
		dut_if_niclet_rx.status ,
        	dut_if_niclet_rx.flit_data_ecc   }     = tb_if_niclet_rx2e2e_rx .data;

        
        /////// VCs contains Header are pair
 	if (dut_if_niclet_rx.flit_type[2] = 1'b0) 
	begin

       		if (dut_if_niclet_rx.vn = 2'b00)  tb_if_niclet_rx2e2e_rx.val[0] = dut_if_niclet_rx.push_data ; 		//Pushing Header in Vn= 0 
 		else  if (dut_if_niclet_rx.vn = 2'b01) tb_if_niclet_rx2e2e_rx.val[2] = dut_if_niclet_rx.push_data ;	//Pushing Header in Vn= 1 
		else  if (dut_if_niclet_rx.vn = 2'b10) tb_if_niclet_rx2e2e_rx.val[4] = dut_if_niclet_rx.push_data ;	//Pushing Header in Vn= 2 
		else  if (dut_if_niclet_rx.vn = 2'b11) tb_if_niclet_rx2e2e_rx.val[6] = dut_if_niclet_rx.push_data ;	//Pushing Header in Vn= 3 
	end
	 /////// VCs contains data are impair
	else
	begin
		if (dut_if_niclet_rx.vn = 2'b00)  tb_if_niclet_rx2e2e_rx.val[1] = dut_if_niclet_rx.push_data ; 		//Pushing data in Vn= 0 
 		else  if (dut_if_niclet_rx.vn = 2'b01) tb_if_niclet_rx2e2e_rx.val[3] = dut_if_niclet_rx.push_data ;	//Pushing data in Vn= 1 
		else  if (dut_if_niclet_rx.vn = 2'b10) tb_if_niclet_rx2e2e_rx.val[5] = dut_if_niclet_rx.push_data ; 	//Pushing data in Vn= 2 
		else  if (dut_if_niclet_rx.vn = 2'b11) tb_if_niclet_rx2e2e_rx.val[7] = dut_if_niclet_rx.push_data ;	//Pushing data in Vn= 3 


	end