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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [examples/] [bridge/] [rtl/] [fib_lookup_fsm.v] - Diff between revs 4 and 5

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

Rev 4 Rev 5
Line 1... Line 1...
module fib_lookup_fsm
module fib_lookup_fsm
  (/*AUTOARG*/
  (/*AUTOARG*/
  // Outputs
  // Outputs
  lpp_drdy, ft_wdata, ft_rd_n, ft_wr_n, ft_addr, lout_data, lout_srdy,
  lpp_drdy, ft_wdata, ft_rd_en, ft_wr_en, ft_addr, lout_data,
 
  lout_srdy, lout_dst_vld,
  // Inputs
  // Inputs
  clk, reset, lpp_data, lpp_srdy, ft_rdata, lout_drdy
  clk, reset, lpp_data, lpp_srdy, ft_rdata, lout_drdy
  );
  );
 
 
  input clk, reset;
  input clk, reset;
Line 12... Line 13...
  input                    lpp_srdy;
  input                    lpp_srdy;
  output reg               lpp_drdy;
  output reg               lpp_drdy;
 
 
  input [`FIB_ENTRY_SZ-1:0]       ft_rdata;
  input [`FIB_ENTRY_SZ-1:0]       ft_rdata;
  output reg [`FIB_ENTRY_SZ-1:0]  ft_wdata;
  output reg [`FIB_ENTRY_SZ-1:0]  ft_wdata;
  output reg                      ft_rd_n, ft_wr_n;
  output reg                      ft_rd_en, ft_wr_en;
  output reg [`FIB_ASZ-1:0]       ft_addr;
  output reg [`FIB_ASZ-1:0]       ft_addr;
 
 
  output reg [`NUM_PORTS-1:0]     lout_data;
  output reg [`NUM_PORTS-1:0]     lout_data;
  output reg                      lout_srdy;
  output reg                      lout_srdy;
  input                           lout_drdy;
  input                           lout_drdy;
 
  output [`NUM_PORTS-1:0]         lout_dst_vld;
 
 
  wire [`FIB_ASZ-1:0]             hf_out;
  wire [`FIB_ASZ-1:0]             hf_out;
  reg [47:0]                      hf_in;
  reg [47:0]                      hf_in;
 
 
  wire [`NUM_PORTS-1:0]           source_port_mask;
  wire [`NUM_PORTS-1:0]           source_port_mask;
Line 41... Line 43...
  localparam s_idle = 0, s_da_lookup = 1, s_sa_lookup = 2,
  localparam s_idle = 0, s_da_lookup = 1, s_sa_lookup = 2,
    s_init0 = 3, s_init1 = 4;
    s_init0 = 3, s_init1 = 4;
  localparam ns_idle = 1, ns_da_lookup = 2, ns_sa_lookup = 4,
  localparam ns_idle = 1, ns_da_lookup = 2, ns_sa_lookup = 4,
    ns_init0 = 8, ns_init1 = 16;
    ns_init0 = 8, ns_init1 = 16;
 
 
 
  // send all results back to their originating port
 
  assign lout_dst_vld = source_port_mask;
 
 
  always @*
  always @*
    begin
    begin
      hf_in = 0;
      hf_in = 0;
      nxt_state = state;
      nxt_state = state;
      ft_rd_n = 1;
      ft_rd_en = 0;
      ft_wr_n = 1;
      ft_wr_en = 0;
      ft_addr = hf_out;
      ft_addr = hf_out;
      lout_data = 0;
      lout_data = 0;
      lout_srdy = 0;
      lout_srdy = 0;
      lpp_drdy = 0;
      lpp_drdy = 0;
      nxt_init_ctr = init_ctr;
      nxt_init_ctr = init_ctr;
Line 68... Line 73...
                  nxt_state = ns_sa_lookup;
                  nxt_state = ns_sa_lookup;
              end
              end
            else if (lpp_srdy)
            else if (lpp_srdy)
              begin
              begin
                hf_in = lpp_data[`PAR_MACDA];
                hf_in = lpp_data[`PAR_MACDA];
                ft_rd_n = 0;
                ft_rd_en = 1;
                nxt_state = ns_da_lookup;
                nxt_state = ns_da_lookup;
              end
              end
          end
          end
 
 
        // results from DA lookup are available this
        // results from DA lookup are available this
Line 97... Line 102...
 
 
        // blind write out MACSA to FIB table
        // blind write out MACSA to FIB table
        // will bump out current occupant and update
        // will bump out current occupant and update
        state[s_sa_lookup] :
        state[s_sa_lookup] :
          begin
          begin
            ft_wr_n = 0;
            ft_wr_en = 1;
            hf_in = lpp_data[`PAR_MACSA];
            hf_in = lpp_data[`PAR_MACSA];
            ft_wdata[`FIB_MACADDR] = lpp_data[`PAR_MACSA];
            ft_wdata[`FIB_MACADDR] = lpp_data[`PAR_MACSA];
            ft_wdata[`FIB_AGE]  = `FIB_MAX_AGE;
            ft_wdata[`FIB_AGE]  = `FIB_MAX_AGE;
            ft_wdata[`FIB_PORT] = lpp_data[`PAR_SRCPORT];
            ft_wdata[`FIB_PORT] = lpp_data[`PAR_SRCPORT];
            nxt_state = ns_idle;
            nxt_state = ns_idle;
Line 115... Line 120...
          end
          end
 
 
        state[s_init1] :
        state[s_init1] :
          begin
          begin
            nxt_init_ctr = init_ctr + 1;
            nxt_init_ctr = init_ctr + 1;
            ft_wr_n = 0;
            ft_wr_en = 1;
            ft_addr = init_ctr;
            ft_addr = init_ctr;
            ft_wdata = 0;
            ft_wdata = 0;
            if (ft_addr == (`FIB_ENTRIES-1))
            if (ft_addr == (`FIB_ENTRIES-1))
              nxt_state = ns_idle;
              nxt_state = ns_idle;
          end
          end

powered by: WebSVN 2.1.0

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