data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v
 line:238: before: "d1011041"
1: b'%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:79: Operator SHIFTL expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'head_len\' generates 4 bits.\n                                                                             : ... In instance ip_unpack\n if(byte_cnt == ((head_len << 2) - 1))\n                           ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:85: Operator EQ expects 32 or 16 bits on the LHS, but LHS\'s VARREF \'byte_cnt\' generates 12 bits.\n                                                                             : ... In instance ip_unpack\n else if(byte_cnt == ip_pkt_len - 1)\n                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:103: Operator ASSIGNDLY expects 12 bits on the Assign RHS, but Assign RHS\'s CONST \'11\'h0\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n      byte_cnt <= 11\'d0;\n               ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:105: Operator ASSIGNDLY expects 12 bits on the Assign RHS, but Assign RHS\'s CONST \'11\'h0\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n      byte_cnt <= 11\'d0;\n               ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:117: Operator EQ expects 8 bits on the LHS, but LHS\'s SEL generates 4 bits.\n                                                                              : ... In instance ip_unpack\n if(ip_pkt_dat[7:4] == 8\'h4)ipv4 <= 1\'b1;\n                    ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:115: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h0\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d0)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:127: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h3\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d3)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:125: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h2\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d2)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:144: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h5\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d5)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:142: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h4\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d4)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:153: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h6\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d6)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:164: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h7\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d7)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:162: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h6\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d6)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:170: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h8\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d8)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:176: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h9\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d9)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:188: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'hf\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d15)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:186: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'he\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d14)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:184: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'hd\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d13)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:182: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'hc\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d12)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:200: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h13\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d19)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:198: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h12\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d18)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:196: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h11\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d17)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:194: Operator EQ expects 12 bits on the RHS, but RHS\'s CONST \'11\'h10\' generates 11 bits.\n                                                                              : ... In instance ip_unpack\n    else if(ip_pkt_en && byte_cnt == 11\'d16)\n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:206: Operator SHIFTL expects 12 bits on the LHS, but LHS\'s VARREF \'head_len\' generates 4 bits.\n                                                                              : ... In instance ip_unpack\n    else if(st_data && byte_cnt == (head_len << 2))\n                                             ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:221: Operator SHIFTL expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'head_len\' generates 4 bits.\n                                                                              : ... In instance ip_unpack\n if(st_head && is_bmp_pkt && byte_cnt == ((head_len << 2) - 1) && ~frag_sync)\n                                                    ^~\n%Warning-WIDTH: data/full_repos/permissive/154350027/rtl/tcpip/ip_unpack.v:226: Operator SHIFTL expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'head_len\' generates 4 bits.\n                                                                              : ... In instance ip_unpack\n if(st_head && is_bmp_pkt && byte_cnt == ((head_len << 2) - 1) && frag_sync)\n                                                    ^~\n%Error: Exiting due to 26 warning(s)\n'
module ip_unpack
  (
   input wire 	     rx_clk,
   input wire 	     rst_n,


   input wire 	     ip_pkt_start,
   input wire 	     ip_pkt_en,
   input wire [7:0]  ip_pkt_dat,
   input wire 	     ip_pkt_end,

   input wire [47:0] des_mac_addr,
   input wire [47:0] src_mac_addr,
   input wire [15:0] ip_prot_type,


   output reg [31:0] src_ip_addr,
   output reg [31:0] des_ip_addr,
   output reg [7:0]  trans_prot_type,
   
   output reg 	     trans_pkt_start,
   output reg 	     trans_pkt_frag_start,
   output reg [12:0] trans_pkt_frag_sft,
   output reg 	     trans_pkt_en,
   output reg [7:0]  trans_pkt_dat,
   output reg 	     trans_pkt_frag_end,
   output reg 	     trans_pkt_end
   
   );

  reg 		     ipv4;
  reg [3:0] 	     head_len;
  reg [15:0] 	     ip_pkt_len;

  reg [15:0] 	     mark;
  reg 		     mf;
  reg 		     df;
  
  reg [7:0] 	     time_of_life;
  
  reg [3:0] 	     pkt_cs;
  reg [3:0] 	     pkt_ns;

  reg [11:0] 	     byte_cnt;
  reg 		     frag_sync;
  reg            is_bmp_pkt;
	 
  parameter IDLE  = 4'd0;
  parameter START = 4'd1;
  parameter HEAD  = 4'd2;
  parameter DATA  = 4'd3;
  parameter DONE  = 4'd4;

  wire 		     st_idle;
  wire 		     st_start;
  wire 		     st_head;
  wire 		     st_data;
  wire 		     st_done;
  
  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      pkt_cs <= IDLE;
    else
      pkt_cs <= pkt_ns;

  always@(*)
    case(pkt_cs)
      IDLE:
	if(ip_pkt_start && ip_prot_type == 16'h0800)
	  pkt_ns = START;
	else
	  pkt_ns = IDLE;
      START:
	pkt_ns = HEAD;
      HEAD:
	if(byte_cnt == ((head_len << 2) - 1))
	  pkt_ns = DATA;
	else
	  pkt_ns = HEAD;
      DATA:
        if(!is_bmp_pkt)pkt_ns = IDLE;
	else if(byte_cnt == ip_pkt_len - 1)
	  pkt_ns = DONE;
	else
	  pkt_ns = DATA;
      DONE:
	pkt_ns = IDLE;
      default:
	pkt_ns = IDLE;
    endcase

  assign st_idle  = (pkt_cs == IDLE ); 
  assign st_start = (pkt_cs == START); 
  assign st_head  = (pkt_cs == HEAD ); 
  assign st_data  = (pkt_cs == DATA ); 
  assign st_done  = (pkt_cs == DONE ); 

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      byte_cnt <= 11'd0;
    else if(st_idle)
      byte_cnt <= 11'd0;
    else if(ip_pkt_en)
      byte_cnt <= byte_cnt + 1'b1;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      begin
	ipv4 <= 1'b0;
	head_len <= 4'd0;
      end
    else if(ip_pkt_en && byte_cnt == 11'd0)
      begin
	if(ip_pkt_dat[7:4] == 8'h4)ipv4 <= 1'b1;
	else ipv4 <= 1'b0;
	head_len <= ip_pkt_dat[3:0];
      end

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      ip_pkt_len <= 16'b0;
    else if(ip_pkt_en && byte_cnt == 11'd2)
      ip_pkt_len[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd3)
      ip_pkt_len[7:0] <= ip_pkt_dat;


  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
	   is_bmp_pkt <= 1'b0;
	 else if(ip_pkt_len > 1024)
	   is_bmp_pkt <= 1'b1;
	 else 
	   is_bmp_pkt <= 1'b0;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      mark <= 16'b0;
    else if(ip_pkt_en && byte_cnt == 11'd4)
      mark[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd5)
      mark[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      begin
	mf <= 1'b0;
	df <= 1'b0;
      end
    else if(ip_pkt_en && byte_cnt == 11'd6)
      begin
	mf <= ip_pkt_dat[7];
	df <= ip_pkt_dat[6];
      end

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)  
      trans_pkt_frag_sft <= 13'b0;
    else if(ip_pkt_en && byte_cnt == 11'd6)
      trans_pkt_frag_sft[12:8] <= ip_pkt_dat[4:0];
    else if(ip_pkt_en && byte_cnt == 11'd7)
      trans_pkt_frag_sft[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)   
      time_of_life <= 8'b0;
    else if(ip_pkt_en && byte_cnt == 11'd8)
      time_of_life <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)     
      trans_prot_type <= 8'b0;
    else if(ip_pkt_en && byte_cnt == 11'd9)
      trans_prot_type <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      src_ip_addr <= 32'b0;
    else if(ip_pkt_en && byte_cnt == 11'd12)
      src_ip_addr[31:24] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd13)
      src_ip_addr[23:16] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd14)
      src_ip_addr[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd15)
      src_ip_addr[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      des_ip_addr <= 32'b0;
    else if(ip_pkt_en && byte_cnt == 11'd16)
      des_ip_addr[31:24] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd17)
      des_ip_addr[23:16] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd18)
      des_ip_addr[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd19)
      des_ip_addr[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      frag_sync <= 1'b0;
    else if(st_data && byte_cnt == (head_len << 2))
      frag_sync <= (~df & mf);
  
  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      begin
	trans_pkt_start <= 1'b0;
	trans_pkt_frag_start <= 1'b0;
	trans_pkt_en <= 1'b0;
	trans_pkt_dat <= 8'b0;
	trans_pkt_frag_end <= 1'b0;
	trans_pkt_end <= 1'b0;
      end
    else
      begin
	if(st_head && is_bmp_pkt && byte_cnt == ((head_len << 2) - 1) && ~frag_sync)
	  trans_pkt_start <= 1'b1;
	else
	  trans_pkt_start <= 1'b0;

	if(st_head && is_bmp_pkt && byte_cnt == ((head_len << 2) - 1) && frag_sync)
	  trans_pkt_frag_start <= 1'b1;
	else
	  trans_pkt_frag_start <= 1'b0;
	
	trans_pkt_en <= st_data;
	if(st_data)trans_pkt_dat <= ip_pkt_dat;
	if(frag_sync)trans_pkt_frag_end <= st_done;
	else trans_pkt_end <= st_done;
      end
  
endmodule
module ip_unpack
  (
   input wire 	     rx_clk,
   input wire 	     rst_n,


   input wire 	     ip_pkt_start,
   input wire 	     ip_pkt_en,
   input wire [7:0]  ip_pkt_dat,
   input wire 	     ip_pkt_end,

   input wire [47:0] des_mac_addr,
   input wire [47:0] src_mac_addr,
   input wire [15:0] ip_prot_type,


   output reg [31:0] src_ip_addr,
   output reg [31:0] des_ip_addr,
   output reg [7:0]  trans_prot_type,
   
   output reg 	     trans_pkt_start,
   output reg 	     trans_pkt_frag_start,
   output reg [12:0] trans_pkt_frag_sft,
   output reg 	     trans_pkt_en,
   output reg [7:0]  trans_pkt_dat,
   output reg 	     trans_pkt_frag_end,
   output reg 	     trans_pkt_end
   
   );


  reg 		     ipv4;
  reg [3:0] 	     head_len;
  reg [15:0] 	     ip_pkt_len;

  reg [15:0] 	     mark;
  reg 		     mf;
  reg 		     df;
  
  reg [7:0] 	     time_of_life;
  
  reg [3:0] 	     pkt_cs;
  reg [3:0] 	     pkt_ns;

  reg [11:0] 	     byte_cnt;
  reg 		     frag_sync;
  reg            is_bmp_pkt;
	 
  parameter IDLE  = 4'd0;
  parameter START = 4'd1;
  parameter HEAD  = 4'd2;
  parameter DATA  = 4'd3;
  parameter DONE  = 4'd4;

  wire 		     st_idle;
  wire 		     st_start;
  wire 		     st_head;
  wire 		     st_data;
  wire 		     st_done;
  
  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      pkt_cs <= IDLE;
    else
      pkt_cs <= pkt_ns;

  always@(*)
    case(pkt_cs)
      IDLE:
	if(ip_pkt_start && ip_prot_type == 16'h0800)
	  pkt_ns = START;
	else
	  pkt_ns = IDLE;
      START:
	pkt_ns = HEAD;
      HEAD:
	if(byte_cnt == ((head_len << 2) - 1))
	  pkt_ns = DATA;
	else
	  pkt_ns = HEAD;
      DATA:
        if(!is_bmp_pkt)pkt_ns = IDLE;
	else if(byte_cnt == ip_pkt_len - 1)
	  pkt_ns = DONE;
	else
	  pkt_ns = DATA;
      DONE:
	pkt_ns = IDLE;
      default:
	pkt_ns = IDLE;
    endcase

  assign st_idle  = (pkt_cs == IDLE ); 
  assign st_start = (pkt_cs == START); 
  assign st_head  = (pkt_cs == HEAD ); 
  assign st_data  = (pkt_cs == DATA ); 
  assign st_done  = (pkt_cs == DONE ); 

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      byte_cnt <= 11'd0;
    else if(st_idle)
      byte_cnt <= 11'd0;
    else if(ip_pkt_en)
      byte_cnt <= byte_cnt + 1'b1;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      begin
	ipv4 <= 1'b0;
	head_len <= 4'd0;
      end
    else if(ip_pkt_en && byte_cnt == 11'd0)
      begin
	if(ip_pkt_dat[7:4] == 8'h4)ipv4 <= 1'b1;
	else ipv4 <= 1'b0;
	head_len <= ip_pkt_dat[3:0];
      end

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      ip_pkt_len <= 16'b0;
    else if(ip_pkt_en && byte_cnt == 11'd2)
      ip_pkt_len[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd3)
      ip_pkt_len[7:0] <= ip_pkt_dat;


  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
	   is_bmp_pkt <= 1'b0;
	 else if(ip_pkt_len > 1024)
	   is_bmp_pkt <= 1'b1;
	 else 
	   is_bmp_pkt <= 1'b0;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      mark <= 16'b0;
    else if(ip_pkt_en && byte_cnt == 11'd4)
      mark[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd5)
      mark[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      begin
	mf <= 1'b0;
	df <= 1'b0;
      end
    else if(ip_pkt_en && byte_cnt == 11'd6)
      begin
	mf <= ip_pkt_dat[7];
	df <= ip_pkt_dat[6];
      end

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)  
      trans_pkt_frag_sft <= 13'b0;
    else if(ip_pkt_en && byte_cnt == 11'd6)
      trans_pkt_frag_sft[12:8] <= ip_pkt_dat[4:0];
    else if(ip_pkt_en && byte_cnt == 11'd7)
      trans_pkt_frag_sft[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)   
      time_of_life <= 8'b0;
    else if(ip_pkt_en && byte_cnt == 11'd8)
      time_of_life <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)     
      trans_prot_type <= 8'b0;
    else if(ip_pkt_en && byte_cnt == 11'd9)
      trans_prot_type <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      src_ip_addr <= 32'b0;
    else if(ip_pkt_en && byte_cnt == 11'd12)
      src_ip_addr[31:24] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd13)
      src_ip_addr[23:16] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd14)
      src_ip_addr[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd15)
      src_ip_addr[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      des_ip_addr <= 32'b0;
    else if(ip_pkt_en && byte_cnt == 11'd16)
      des_ip_addr[31:24] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd17)
      des_ip_addr[23:16] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd18)
      des_ip_addr[15:8] <= ip_pkt_dat;
    else if(ip_pkt_en && byte_cnt == 11'd19)
      des_ip_addr[7:0] <= ip_pkt_dat;

  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      frag_sync <= 1'b0;
    else if(st_data && byte_cnt == (head_len << 2))
      frag_sync <= (~df & mf);
  
  always@(posedge rx_clk, negedge rst_n)
    if(!rst_n)
      begin
	trans_pkt_start <= 1'b0;
	trans_pkt_frag_start <= 1'b0;
	trans_pkt_en <= 1'b0;
	trans_pkt_dat <= 8'b0;
	trans_pkt_frag_end <= 1'b0;
	trans_pkt_end <= 1'b0;
      end
    else
      begin
	if(st_head && is_bmp_pkt && byte_cnt == ((head_len << 2) - 1) && ~frag_sync)
	  trans_pkt_start <= 1'b1;
	else
	  trans_pkt_start <= 1'b0;

	if(st_head && is_bmp_pkt && byte_cnt == ((head_len << 2) - 1) && frag_sync)
	  trans_pkt_frag_start <= 1'b1;
	else
	  trans_pkt_frag_start <= 1'b0;
	
	trans_pkt_en <= st_data;
	if(st_data)trans_pkt_dat <= ip_pkt_dat;
	if(frag_sync)trans_pkt_frag_end <= st_done;
	else trans_pkt_end <= st_done;
      end
  
endmodule