OpenCores
URL https://opencores.org/ocsvn/ha1588/ha1588/trunk

Subversion Repositories ha1588

[/] [ha1588/] [trunk/] [rtl/] [tsu/] [ptp_parser.v] - Diff between revs 4 and 7

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 7
Line 5... Line 5...
  input [31:0] ptp_data,
  input [31:0] ptp_data,
  input        ptp_valid,
  input        ptp_valid,
  input        ptp_sop,
  input        ptp_sop,
  input        ptp_eop,
  input        ptp_eop,
  input [ 1:0] ptp_mod,
  input [ 1:0] ptp_mod,
  input [79:0] ptp_time,
  input [29:0] ptp_time,
 
 
  output reg        ptp_found,
  output reg        ptp_found,
  output reg [91:0] ptp_infor
  output reg [41:0] ptp_infor
);
);
 
 
reg [31:0] ptp_data_d1;
reg [31:0] ptp_data_d1;
reg        ptp_valid_d1;
reg        ptp_valid_d1;
reg        ptp_sop_d1;
reg        ptp_sop_d1;
Line 56... Line 56...
    ptp_vlan  <= 1'b0;
    ptp_vlan  <= 1'b0;
    ptp_ip    <= 1'b0;
    ptp_ip    <= 1'b0;
    ptp_udp   <= 1'b0;
    ptp_udp   <= 1'b0;
    ptp_port  <= 1'b0;
    ptp_port  <= 1'b0;
    ptp_event <= 1'b0;
    ptp_event <= 1'b0;
 
    ptp_msgid <= 4'd0;
    ptp_seqid <= 8'd0;
    ptp_seqid <= 8'd0;
  end
  end
  else if (ptp_valid_d1 && ptp_sop_d1) begin
  else if (ptp_valid_d1 && ptp_sop_d1) begin
    ptp_vlan  <= 1'b0;
    ptp_vlan  <= 1'b0;
    ptp_ip    <= 1'b0;
    ptp_ip    <= 1'b0;
    ptp_udp   <= 1'b0;
    ptp_udp   <= 1'b0;
    ptp_port  <= 1'b0;
    ptp_port  <= 1'b0;
    ptp_event <= 1'b0;
    ptp_event <= 1'b0;
 
    ptp_msgid <= 4'd0;
    ptp_seqid <= 8'd0;
    ptp_seqid <= 8'd0;
  end
  end
  else begin
  else begin
    if (ptp_valid_d1 && ptp_cnt==10'd4)  // ether_type == vlan
    if (ptp_valid_d1 && ptp_cnt==10'd4)  // ether_type == vlan
      ptp_vlan  <= ( ptp_data_d1[31:16]==16'h8100);
      ptp_vlan  <= ( ptp_data_d1[31:16]==16'h8100);
 
    else
 
      ptp_vlan  <= 1'b0;
    if (ptp_valid_d1 && ptp_cnt==10'd4)  // ether_type == ip
    if (ptp_valid_d1 && ptp_cnt==10'd4)  // ether_type == ip
      ptp_ip    <= ( ptp_data_d1[31:16]==16'h0800);
      ptp_ip    <= ( ptp_data_d1[31:16]==16'h0800);
    if (ptp_valid_d1 && ptp_cnt==10'd6)  // ip_type == udp
    if (ptp_valid_d1 && ptp_cnt==10'd6)  // ip_type == udp
      ptp_udp   <= ( ptp_data_d1[ 7: 0]== 8'h11 && ptp_ip);
      ptp_udp   <= ( ptp_data_d1[ 7: 0]== 8'h11 && ptp_ip);
    if (ptp_valid_d1 && ptp_cnt==10'd10) // udp_dest_port == ptp_event
    if (ptp_valid_d1 && ptp_cnt==10'd10) // udp_dest_port == ptp_event
Line 88... Line 92...
end
end
 
 
always @(posedge rst or posedge clk) begin
always @(posedge rst or posedge clk) begin
  if (rst) begin
  if (rst) begin
    ptp_found <=  1'b0;
    ptp_found <=  1'b0;
    ptp_infor <= 91'd0;
    ptp_infor <= 42'd0;
  end
  end
  else if (ptp_valid_d1 && ptp_sop_d1) begin
  else if (ptp_valid_d1 && ptp_sop_d1) begin
    ptp_found <=  1'b0;
    ptp_found <=  1'b0;
    ptp_infor <= 91'd0;
    ptp_infor <= 42'd0;
  end
  end
  else if (ptp_valid_d1 && ptp_eop_d1) begin
  else if (ptp_valid_d1 && ptp_eop_d1) begin
    ptp_found <=  ptp_event;
    ptp_found <=  ptp_event;
    ptp_infor <= {ptp_msgid, ptp_seqid, ptp_time};
    ptp_infor <= {ptp_msgid, ptp_seqid, ptp_time};
  end
  end
  else begin
  else begin
    ptp_found <=  1'b0;
    ptp_found <=  1'b0;
    ptp_infor <= 91'd0;
    ptp_infor <= 42'd0;
  end
  end
end
end
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.