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

Subversion Repositories ethmac10g

[/] [ethmac10g/] [tags/] [V10/] [rxLinkFaultState.v] - Diff between revs 40 and 72

Only display areas with differences | Details | Blame | View Log

Rev 40 Rev 72
`timescale 1ns / 1ps
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Company: 
// Company: 
// Engineer:
// Engineer:
//
//
// Create Date:    17:11:43 12/19/05
// Create Date:    17:11:43 12/19/05
// Design Name:    
// Design Name:    
// Module Name:    rxLinkFaultState
// Module Name:    rxLinkFaultState
// Project Name:   
// Project Name:   
// Target Device:  
// Target Device:  
// Tool versions:  
// Tool versions:  
// Description:
// Description:
//
//
// Dependencies:
// Dependencies:
// 
// 
// Revision:
// Revision:
// Revision 0.01 - File Created
// Revision 0.01 - File Created
// Additional Comments:
// Additional Comments:
// 
// 
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
module rxLinkFaultState(rxclk_2x, reset, local_fault, remote_fault, link_fault);
module rxLinkFaultState(rxclk_2x, reset, local_fault, remote_fault, link_fault);
    input rxclk_2x;
    input rxclk_2x;
    input reset;
    input reset;
    input local_fault;
    input local_fault;
    input remote_fault;
    input remote_fault;
    output[1:0] link_fault;
    output[1:0] link_fault;
 
 
         parameter TP =1;
         parameter TP =1;
         parameter IDLE = 0, LinkFaultDetect = 1, NewFaultType = 2, GetFault = 3;
         parameter IDLE = 0, LinkFaultDetect = 1, NewFaultType = 2, GetFault = 3;
 
 
         //------------------------------------------------
         //------------------------------------------------
         // Link        Fault Signalling Statemachine
         // Link        Fault Signalling Statemachine
         //------------------------------------------------
         //------------------------------------------------
         wire  fault_type;
         wire  fault_type;
         wire  get_one_fault;
         wire  get_one_fault;
         wire  no_new_type;
         wire  no_new_type;
 
 
         reg[2:0] linkstate;
         reg[2:0] linkstate;
         reg[7:0] col_cnt;
         reg[7:0] col_cnt;
         reg[1:0] seq_cnt;
         reg[1:0] seq_cnt;
         reg[1:0] seq_type;
         reg[1:0] seq_type;
         reg[1:0] last_seq_type;
         reg[1:0] last_seq_type;
         reg[1:0] link_fault;
         reg[1:0] link_fault;
         reg      reset_col_cnt;
         reg      reset_col_cnt;
 
 
         assign fault_type = {local_fault, remote_fault};
         assign fault_type = {local_fault, remote_fault};
         assign get_one_fault = local_fault | remote_fault;
         assign get_one_fault = local_fault | remote_fault;
         assign no_new_type = (seq_type == last_seq_type);
         assign no_new_type = (seq_type == last_seq_type);
         assign col_cnt_128 = (col_cnt == 127);
         assign col_cnt_128 = (col_cnt == 127);
 
 
         always@(posedge rxclk_2x or posedge reset)begin
         always@(posedge rxclk_2x or posedge reset)begin
             if (reset) begin
             if (reset) begin
                           seq_type <=#TP 0;
                           seq_type <=#TP 0;
                                seq_cnt <=#TP 0;
                                seq_cnt <=#TP 0;
                                last_seq_type <=#TP 0;
                                last_seq_type <=#TP 0;
                                reset_col_cnt<= #TP 1;
                                reset_col_cnt<= #TP 1;
                                link_fault <=#TP 2'b00;
                                link_fault <=#TP 2'b00;
                                linkstate<= #TP IDLE;
                                linkstate<= #TP IDLE;
                  end
                  end
                  else begin
                  else begin
                           seq_type <= #TP fault_type;
                           seq_type <= #TP fault_type;
                           last_seq_type <=#TP seq_type;
                           last_seq_type <=#TP seq_type;
                           case (linkstate)
                           case (linkstate)
                              IDLE: begin
                              IDLE: begin
                                             linkstate <=#TP IDLE;
                                             linkstate <=#TP IDLE;
                                             reset_col_cnt <= #TP 1;
                                             reset_col_cnt <= #TP 1;
                                                  seq_cnt <= #TP 0;
                                                  seq_cnt <= #TP 0;
                                                  link_fault <= #TP 2'b00;
                                                  link_fault <= #TP 2'b00;
                                             if (get_one_fault)
                                             if (get_one_fault)
                                                                linkstate<=#TP LinkFaultDetect;
                                                                linkstate<=#TP LinkFaultDetect;
                                        end
                                        end
 
 
                   LinkFaultDetect: begin
                   LinkFaultDetect: begin
                                             linkstate <=#TP LinkFaultDetect;
                                             linkstate <=#TP LinkFaultDetect;
                                                  reset_col_cnt <=#TP 1;
                                                  reset_col_cnt <=#TP 1;
                                             if (get_one_fault & no_new_type)
                                             if (get_one_fault & no_new_type)
                                                     if (seq_cnt < 3)
                                                     if (seq_cnt < 3)
                                                        seq_cnt <=#TP seq_cnt + 1;
                                                        seq_cnt <=#TP seq_cnt + 1;
                                                          else linkstate <=#TP GetFault;
                                                          else linkstate <=#TP GetFault;
                                                  else if(~get_one_fault)
                                                  else if(~get_one_fault)
                                                       if(col_cnt_128) begin
                                                       if(col_cnt_128) begin
                                                                    linkstate <=#TP IDLE;
                                                                    linkstate <=#TP IDLE;
                                                                         reset_col_cnt <=#TP 1;
                                                                         reset_col_cnt <=#TP 1;
                                                                 end
                                                                 end
                                                                 else reset_col_cnt <=#TP 0;
                                                                 else reset_col_cnt <=#TP 0;
                                                  else if(get_one_fault & ~no_new_type)
                                                  else if(get_one_fault & ~no_new_type)
                                                        linkstate <=#TP NewFaultType;
                                                        linkstate <=#TP NewFaultType;
                                        end
                                        end
 
 
                NewFaultType: begin
                NewFaultType: begin
                                  seq_cnt <=#TP 0;
                                  seq_cnt <=#TP 0;
                                                  linkstate <=#TP LinkFaultDetect;
                                                  linkstate <=#TP LinkFaultDetect;
                                                  reset_col_cnt<=#TP 1;
                                                  reset_col_cnt<=#TP 1;
                end
                end
 
 
                                        GetFault: begin
                                        GetFault: begin
                                                  linkstate <=#TP GetFault;
                                                  linkstate <=#TP GetFault;
                                                  reset_col_cnt <=#TP 1;
                                                  reset_col_cnt <=#TP 1;
                    if (get_one_fault & no_new_type)
                    if (get_one_fault & no_new_type)
                                                                link_fault <=#TP seq_type;
                                                                link_fault <=#TP seq_type;
                                        else if (~get_one_fault)        begin
                                        else if (~get_one_fault)        begin
                                                         reset_col_cnt<=#TP 0;
                                                         reset_col_cnt<=#TP 0;
                                                                        if(col_cnt_128)
                                                                        if(col_cnt_128)
                                                                linkstate <=#TP IDLE;
                                                                linkstate <=#TP IDLE;
                                                  end
                                                  end
                    else if (get_one_fault &    ~no_new_type)
                    else if (get_one_fault &    ~no_new_type)
                                                      linkstate <=#TP NewFaultType;
                                                      linkstate <=#TP NewFaultType;
                                        end
                                        end
                           endcase
                           endcase
            end
            end
         end
         end
 
 
         always@(posedge rxclk_2x or posedge reset) begin
         always@(posedge rxclk_2x or posedge reset) begin
                    if (reset)
                    if (reset)
                            col_cnt <=#TP 0;
                            col_cnt <=#TP 0;
          else if (reset_col_cnt)
          else if (reset_col_cnt)
                            col_cnt <=#TP 0;
                            col_cnt <=#TP 0;
          else
          else
                            col_cnt <=#TP col_cnt + 1;
                            col_cnt <=#TP col_cnt + 1;
    end
    end
 
 
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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