| 1 | 2 | peteralieb | //-----------------------------------------------------------------------------
 | 
      
         | 2 |  |  | // Title      : 10/100/1G Ethernet FIFO for 8-bit client I/F
 | 
      
         | 3 |  |  | // Project    : Virtex-4 Embedded Tri-Mode Ethernet MAC Wrapper
 | 
      
         | 4 |  |  | // File       : eth_fifo_8.v
 | 
      
         | 5 |  |  | // Version    : 4.8
 | 
      
         | 6 |  |  | //-----------------------------------------------------------------------------
 | 
      
         | 7 |  |  | //
 | 
      
         | 8 |  |  | // (c) Copyright 2004-2010 Xilinx, Inc. All rights reserved.
 | 
      
         | 9 |  |  | //
 | 
      
         | 10 |  |  | // This file contains confidential and proprietary information
 | 
      
         | 11 |  |  | // of Xilinx, Inc. and is protected under U.S. and
 | 
      
         | 12 |  |  | // international copyright and other intellectual property
 | 
      
         | 13 |  |  | // laws.
 | 
      
         | 14 |  |  | //
 | 
      
         | 15 |  |  | // DISCLAIMER
 | 
      
         | 16 |  |  | // This disclaimer is not a license and does not grant any
 | 
      
         | 17 |  |  | // rights to the materials distributed herewith. Except as
 | 
      
         | 18 |  |  | // otherwise provided in a valid license issued to you by
 | 
      
         | 19 |  |  | // Xilinx, and to the maximum extent permitted by applicable
 | 
      
         | 20 |  |  | // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
 | 
      
         | 21 |  |  | // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
 | 
      
         | 22 |  |  | // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
 | 
      
         | 23 |  |  | // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
 | 
      
         | 24 |  |  | // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
 | 
      
         | 25 |  |  | // (2) Xilinx shall not be liable (whether in contract or tort,
 | 
      
         | 26 |  |  | // including negligence, or under any other theory of
 | 
      
         | 27 |  |  | // liability) for any loss or damage of any kind or nature
 | 
      
         | 28 |  |  | // related to, arising under or in connection with these
 | 
      
         | 29 |  |  | // materials, including for any direct, or any indirect,
 | 
      
         | 30 |  |  | // special, incidental, or consequential loss or damage
 | 
      
         | 31 |  |  | // (including loss of data, profits, goodwill, or any type of
 | 
      
         | 32 |  |  | // loss or damage suffered as a result of any action brought
 | 
      
         | 33 |  |  | // by a third party) even if such damage or loss was
 | 
      
         | 34 |  |  | // reasonably foreseeable or Xilinx had been advised of the
 | 
      
         | 35 |  |  | // possibility of the same.
 | 
      
         | 36 |  |  | //
 | 
      
         | 37 |  |  | // CRITICAL APPLICATIONS
 | 
      
         | 38 |  |  | // Xilinx products are not designed or intended to be fail-
 | 
      
         | 39 |  |  | // safe, or for use in any application requiring fail-safe
 | 
      
         | 40 |  |  | // performance, such as life-support or safety devices or
 | 
      
         | 41 |  |  | // systems, Class III medical devices, nuclear facilities,
 | 
      
         | 42 |  |  | // applications related to the deployment of airbags, or any
 | 
      
         | 43 |  |  | // other applications that could lead to death, personal
 | 
      
         | 44 |  |  | // injury, or severe property or environmental damage
 | 
      
         | 45 |  |  | // (individually and collectively, "Critical
 | 
      
         | 46 |  |  | // Applications"). Customer assumes the sole risk and
 | 
      
         | 47 |  |  | // liability of any use of Xilinx products in Critical
 | 
      
         | 48 |  |  | // Applications, subject only to applicable laws and
 | 
      
         | 49 |  |  | // regulations governing limitations on product liability.
 | 
      
         | 50 |  |  | //
 | 
      
         | 51 |  |  | // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
 | 
      
         | 52 |  |  | // PART OF THIS FILE AT ALL TIMES.
 | 
      
         | 53 |  |  | //
 | 
      
         | 54 |  |  | //-----------------------------------------------------------------------------
 | 
      
         | 55 |  |  | // Description: This is the top level wrapper for the 10/100/1G Ethernet FIFO.
 | 
      
         | 56 |  |  | //              The top level wrapper consists of individual fifos on the 
 | 
      
         | 57 |  |  | //              transmitter path and on the receiver path.
 | 
      
         | 58 |  |  | //
 | 
      
         | 59 |  |  | //              Each path consists of an 8 bit local link to 8 bit client
 | 
      
         | 60 |  |  | //              interface FIFO.
 | 
      
         | 61 |  |  | //-----------------------------------------------------------------------------
 | 
      
         | 62 |  |  |  
 | 
      
         | 63 |  |  |  
 | 
      
         | 64 |  |  | `timescale 1ps / 1ps
 | 
      
         | 65 |  |  |  
 | 
      
         | 66 |  |  |  
 | 
      
         | 67 |  |  | module eth_fifo_8
 | 
      
         | 68 |  |  |     (
 | 
      
         | 69 |  |  |         // Transmit FIFO MAC TX Interface
 | 
      
         | 70 |  |  |         tx_clk,              // MAC transmit clock
 | 
      
         | 71 |  |  |         tx_reset,            // Synchronous reset (tx_clk)
 | 
      
         | 72 |  |  |         tx_enable,           // Clock enable for tx_clk
 | 
      
         | 73 |  |  |         tx_data,             // Data to MAC transmitter
 | 
      
         | 74 |  |  |         tx_data_valid,       // Valid signal to MAC transmitter
 | 
      
         | 75 |  |  |         tx_ack,              // Ack signal from MAC transmitter
 | 
      
         | 76 |  |  |         tx_underrun,         // Underrun signal to MAC transmitter
 | 
      
         | 77 |  |  |         tx_collision,        // Collsion signal from MAC transmitter
 | 
      
         | 78 |  |  |         tx_retransmit,       // Retransmit signal from MAC transmitter
 | 
      
         | 79 |  |  |  
 | 
      
         | 80 |  |  |         // Transmit FIFO Local-link Interface
 | 
      
         | 81 |  |  |         tx_ll_clock,         // Local link write clock
 | 
      
         | 82 |  |  |         tx_ll_reset,         // synchronous reset (tx_ll_clock)
 | 
      
         | 83 |  |  |         tx_ll_data_in,       // Data to Tx FIFO
 | 
      
         | 84 |  |  |         tx_ll_sof_in_n,      // sof indicator to FIFO
 | 
      
         | 85 |  |  |         tx_ll_eof_in_n,      // eof indicator to FIFO
 | 
      
         | 86 |  |  |         tx_ll_src_rdy_in_n,  // src ready indicator to FIFO
 | 
      
         | 87 |  |  |         tx_ll_dst_rdy_out_n, // dst ready indicator from FIFO
 | 
      
         | 88 |  |  |         tx_fifo_status,      // FIFO memory status
 | 
      
         | 89 |  |  |         tx_overflow,         // FIFO overflow indicator from FIFO
 | 
      
         | 90 |  |  |  
 | 
      
         | 91 |  |  |         // Receive FIFO MAC RX Interface
 | 
      
         | 92 |  |  |         rx_clk,              // MAC receive clock 
 | 
      
         | 93 |  |  |         rx_reset,            // Synchronous reset (rx_clk)
 | 
      
         | 94 |  |  |         rx_enable,           // Clock enable for rx_clk
 | 
      
         | 95 |  |  |         rx_data,             // Data from MAC receiver
 | 
      
         | 96 |  |  |         rx_data_valid,       // Valid signal from MAC receiver
 | 
      
         | 97 |  |  |         rx_good_frame,       // Good frame indicator from MAC receiver
 | 
      
         | 98 |  |  |         rx_bad_frame,        // Bad frame indicator from MAC receiver
 | 
      
         | 99 |  |  |         rx_overflow,         // FIFO overflow indicator from FIFO
 | 
      
         | 100 |  |  |  
 | 
      
         | 101 |  |  |         // Receive FIFO Local-link Interface
 | 
      
         | 102 |  |  |         rx_ll_clock,         // Local link read clock
 | 
      
         | 103 |  |  |         rx_ll_reset,         // synchronous reset (rx_ll_clock)
 | 
      
         | 104 |  |  |         rx_ll_data_out,      // Data from Rx FIFO
 | 
      
         | 105 |  |  |         rx_ll_sof_out_n,     // sof indicator from FIFO
 | 
      
         | 106 |  |  |         rx_ll_eof_out_n,     // eof indicator from FIFO
 | 
      
         | 107 |  |  |         rx_ll_src_rdy_out_n, // src ready indicator from FIFO
 | 
      
         | 108 |  |  |         rx_ll_dst_rdy_in_n,  // dst ready indicator to FIFO
 | 
      
         | 109 |  |  |         rx_fifo_status       // FIFO memory status
 | 
      
         | 110 |  |  |         );
 | 
      
         | 111 |  |  |  
 | 
      
         | 112 |  |  |   //---------------------------------------------------------------------------
 | 
      
         | 113 |  |  |   // Define Interface Signals
 | 
      
         | 114 |  |  |   //---------------------------------------------------------------------------
 | 
      
         | 115 |  |  |  
 | 
      
         | 116 |  |  |    parameter FULL_DUPLEX_ONLY = 0;
 | 
      
         | 117 |  |  |  
 | 
      
         | 118 |  |  |    // Transmit FIFO MAC TX Interface
 | 
      
         | 119 |  |  |    input        tx_clk;
 | 
      
         | 120 |  |  |    input        tx_reset;
 | 
      
         | 121 |  |  |    input        tx_enable;
 | 
      
         | 122 |  |  |    output [7:0] tx_data;
 | 
      
         | 123 |  |  |    output       tx_data_valid;
 | 
      
         | 124 |  |  |    input        tx_ack;
 | 
      
         | 125 |  |  |    output       tx_underrun;
 | 
      
         | 126 |  |  |    input        tx_collision;
 | 
      
         | 127 |  |  |    input        tx_retransmit;
 | 
      
         | 128 |  |  |  
 | 
      
         | 129 |  |  |    // Transmit FIFO Local-link Interface  
 | 
      
         | 130 |  |  |    input        tx_ll_clock;
 | 
      
         | 131 |  |  |    input        tx_ll_reset;
 | 
      
         | 132 |  |  |    input  [7:0]  tx_ll_data_in;
 | 
      
         | 133 |  |  |    input        tx_ll_sof_in_n;
 | 
      
         | 134 |  |  |    input        tx_ll_eof_in_n;
 | 
      
         | 135 |  |  |    input        tx_ll_src_rdy_in_n;
 | 
      
         | 136 |  |  |    output       tx_ll_dst_rdy_out_n;
 | 
      
         | 137 |  |  |    output [3:0] tx_fifo_status;
 | 
      
         | 138 |  |  |    output       tx_overflow;
 | 
      
         | 139 |  |  |  
 | 
      
         | 140 |  |  |    // Receive FIFO MAC RX Interface   
 | 
      
         | 141 |  |  |    input        rx_clk;
 | 
      
         | 142 |  |  |    input        rx_reset;
 | 
      
         | 143 |  |  |    input        rx_enable;
 | 
      
         | 144 |  |  |    input [7:0]   rx_data;
 | 
      
         | 145 |  |  |    input        rx_data_valid;
 | 
      
         | 146 |  |  |    input        rx_good_frame;
 | 
      
         | 147 |  |  |    input        rx_bad_frame;
 | 
      
         | 148 |  |  |    output       rx_overflow;
 | 
      
         | 149 |  |  |  
 | 
      
         | 150 |  |  |    // Receive FIFO Local-link Interface
 | 
      
         | 151 |  |  |    input        rx_ll_clock;
 | 
      
         | 152 |  |  |    input        rx_ll_reset;
 | 
      
         | 153 |  |  |    output [7:0] rx_ll_data_out;
 | 
      
         | 154 |  |  |    output       rx_ll_sof_out_n;
 | 
      
         | 155 |  |  |    output       rx_ll_eof_out_n;
 | 
      
         | 156 |  |  |    output       rx_ll_src_rdy_out_n;
 | 
      
         | 157 |  |  |    input        rx_ll_dst_rdy_in_n;
 | 
      
         | 158 |  |  |    output [3:0] rx_fifo_status;
 | 
      
         | 159 |  |  |  
 | 
      
         | 160 |  |  |  
 | 
      
         | 161 |  |  |  
 | 
      
         | 162 |  |  |    assign tx_underrun = 1'b0;
 | 
      
         | 163 |  |  |  
 | 
      
         | 164 |  |  |    // Transmitter FIFO
 | 
      
         | 165 |  |  |    defparam tx_fifo_i.FULL_DUPLEX_ONLY = FULL_DUPLEX_ONLY;
 | 
      
         | 166 |  |  |    tx_client_fifo_8 tx_fifo_i (
 | 
      
         | 167 |  |  |         .rd_clk           (tx_clk),
 | 
      
         | 168 |  |  |         .rd_sreset        (tx_reset),
 | 
      
         | 169 |  |  |         .rd_enable        (tx_enable),
 | 
      
         | 170 |  |  |         .tx_data          (tx_data),
 | 
      
         | 171 |  |  |         .tx_data_valid    (tx_data_valid),
 | 
      
         | 172 |  |  |         .tx_ack           (tx_ack),
 | 
      
         | 173 |  |  |         .tx_collision     (tx_collision),
 | 
      
         | 174 |  |  |         .tx_retransmit    (tx_retransmit),
 | 
      
         | 175 |  |  |         .overflow         (tx_overflow),
 | 
      
         | 176 |  |  |         .wr_clk           (tx_ll_clock),
 | 
      
         | 177 |  |  |         .wr_sreset        (tx_ll_reset),
 | 
      
         | 178 |  |  |         .wr_data          (tx_ll_data_in),
 | 
      
         | 179 |  |  |         .wr_sof_n         (tx_ll_sof_in_n),
 | 
      
         | 180 |  |  |         .wr_eof_n         (tx_ll_eof_in_n),
 | 
      
         | 181 |  |  |         .wr_src_rdy_n     (tx_ll_src_rdy_in_n),
 | 
      
         | 182 |  |  |         .wr_dst_rdy_n     (tx_ll_dst_rdy_out_n),
 | 
      
         | 183 |  |  |         .wr_fifo_status   (tx_fifo_status)
 | 
      
         | 184 |  |  |         );
 | 
      
         | 185 |  |  |  
 | 
      
         | 186 |  |  |  
 | 
      
         | 187 |  |  |    // Receiver FIFO
 | 
      
         | 188 |  |  |    rx_client_fifo_8 rx_fifo_i (
 | 
      
         | 189 |  |  |         .wr_clk          (rx_clk),
 | 
      
         | 190 |  |  |         .wr_enable       (rx_enable),
 | 
      
         | 191 |  |  |         .wr_sreset       (rx_reset),
 | 
      
         | 192 |  |  |         .rx_data         (rx_data),
 | 
      
         | 193 |  |  |         .rx_data_valid   (rx_data_valid),
 | 
      
         | 194 |  |  |         .rx_good_frame   (rx_good_frame),
 | 
      
         | 195 |  |  |         .rx_bad_frame    (rx_bad_frame),
 | 
      
         | 196 |  |  |         .overflow        (rx_overflow),
 | 
      
         | 197 |  |  |         .rd_clk          (rx_ll_clock),
 | 
      
         | 198 |  |  |         .rd_sreset       (rx_ll_reset),
 | 
      
         | 199 |  |  |         .rd_data_out     (rx_ll_data_out),
 | 
      
         | 200 |  |  |         .rd_sof_n        (rx_ll_sof_out_n),
 | 
      
         | 201 |  |  |         .rd_eof_n        (rx_ll_eof_out_n),
 | 
      
         | 202 |  |  |         .rd_src_rdy_n    (rx_ll_src_rdy_out_n),
 | 
      
         | 203 |  |  |         .rd_dst_rdy_n    (rx_ll_dst_rdy_in_n),
 | 
      
         | 204 |  |  |         .rx_fifo_status  (rx_fifo_status)
 | 
      
         | 205 |  |  |         );
 | 
      
         | 206 |  |  |  
 | 
      
         | 207 |  |  | endmodule
 |