| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: srfifo_load.v |
| 4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 6 | // |
| 7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 8 | // |
| 9 | // This program is free software; you can redistribute it and/or modify |
| 10 | // it under the terms of the GNU General Public License as published by |
| 11 | // the Free Software Foundation; version 2 of the License. |
| 12 | // |
| 13 | // This program is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | // |
| 22 | // For the avoidance of doubt, and except that if any non-GPL license |
| 23 | // choice is available it will apply instead, Sun elects to use only |
| 24 | // the General Public License version 2 (GPLv2) at this time for any |
| 25 | // software where a choice of GPL license versions is made |
| 26 | // available with the language indicating that GPLv2 or any later version |
| 27 | // may be used, or where a choice of which version of the GPL is applied is |
| 28 | // otherwise unspecified. |
| 29 | // |
| 30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 31 | // CA 95054 USA or visit www.sun.com if you need additional information or |
| 32 | // have any questions. |
| 33 | // |
| 34 | // ========== Copyright Header End ============================================ |
| 35 | /*%W% %G%*/ |
| 36 | |
| 37 | /************************************************************************* |
| 38 | * |
| 39 | * File Name : srfifo_load |
| 40 | * Author Name : John Lo |
| 41 | * Description : |
| 42 | * Parent Module: rx_xmac |
| 43 | * Child Module: |
| 44 | * Interface Mod: |
| 45 | * Date Created : 5/9/00 |
| 46 | * |
| 47 | * Copyright (c) 2002, Sun Microsystems, Inc. |
| 48 | * Sun Proprietary and Confidential |
| 49 | * |
| 50 | * Modification : |
| 51 | * |
| 52 | * Synthesis Notes: |
| 53 | * |
| 54 | *************************************************************************/ |
| 55 | |
| 56 | `include "xmac.h" |
| 57 | |
| 58 | module srfifo_load ( |
| 59 | rx_clk, |
| 60 | rx_reset, |
| 61 | srfifo_wr_en, // .srfifo_wr_en(eop) in rx_xmac.v |
| 62 | srfifo_rd_ptr_clk, |
| 63 | srfifo_din, |
| 64 | // outputs |
| 65 | srfifo_dout, |
| 66 | srfifo_g_wr_ptr_rxclk |
| 67 | ); |
| 68 | |
| 69 | |
| 70 | input rx_clk; |
| 71 | input rx_reset; |
| 72 | input srfifo_wr_en; // .srfifo_wr_en(eop) in rx_xmac.v |
| 73 | // vlint flag_input_port_not_connected off |
| 74 | input [4:0] srfifo_rd_ptr_clk; |
| 75 | // vlint flag_input_port_not_connected on |
| 76 | input [`TBITS] srfifo_din; // 24 bits wide |
| 77 | output [`TBITS] srfifo_dout; |
| 78 | output [4:0] srfifo_g_wr_ptr_rxclk; |
| 79 | |
| 80 | wire [4:0] srfifo_g_wr_ptr_rxclk; |
| 81 | // vlint flag_dangling_net_within_module off |
| 82 | // vlint flag_net_has_no_load off |
| 83 | // vlint flag_input_port_not_connected off |
| 84 | wire [4:0] srfifo_wr_ptr_rxclk; |
| 85 | wire [4:0] srfifo_rd_ptr_clk; |
| 86 | // vlint flag_input_port_not_connected on |
| 87 | // vlint flag_net_has_no_load on |
| 88 | // vlint flag_dangling_net_within_module on |
| 89 | |
| 90 | /* --------------- start srfifo pointer Management ------------------ */ |
| 91 | |
| 92 | // srfifo G Write Pointer, g_wr_ptr to sysclk |
| 93 | g_cntr_5bit srfifo_g_wr_ptr_rxclk_g_cntr_5bit( |
| 94 | .reset(rx_reset), |
| 95 | .clk(rx_clk), |
| 96 | .ce(srfifo_wr_en), |
| 97 | .g_cnt(srfifo_g_wr_ptr_rxclk)); |
| 98 | |
| 99 | // srfifo Write Pointer |
| 100 | g2b_5bit srfifo_g2b_5bit(.g_cnt(srfifo_g_wr_ptr_rxclk), |
| 101 | .b_cnt(srfifo_wr_ptr_rxclk)); |
| 102 | /* --------------- end of srfifo pointer Management ----------------- */ |
| 103 | |
| 104 | //*********************************************** |
| 105 | //***** srfifo and associated control logic ***** |
| 106 | //*********************************************** |
| 107 | srfifo_TBITS_memory_model srfifo_TBITS_memory_model( |
| 108 | .rx_clk(rx_clk), |
| 109 | .reset(rx_reset), |
| 110 | .wp(srfifo_wr_ptr_rxclk[3:0]), |
| 111 | .rp(srfifo_rd_ptr_clk[3:0]), |
| 112 | .we(srfifo_wr_en), |
| 113 | .din(srfifo_din[`TBITS]), |
| 114 | .dout(srfifo_dout[`TBITS])); |
| 115 | |
| 116 | endmodule // srfifo_load |
| 117 | |
| 118 | |
| 119 | module srfifo_TBITS_memory_model (rx_clk,reset,wp,rp,we,din,dout); |
| 120 | input rx_clk,reset; |
| 121 | input [3:0] wp,rp; |
| 122 | input we; |
| 123 | input [`TBITS] din; |
| 124 | output [`TBITS] dout; |
| 125 | |
| 126 | |
| 127 | reg [`TBITS] srfifo_mem [0:15]; // 24 bit wide 16 deep |
| 128 | |
| 129 | always @ (posedge rx_clk) |
| 130 | begin |
| 131 | if (reset) |
| 132 | begin |
| 133 | srfifo_mem[0] <= 0; |
| 134 | srfifo_mem[1] <= 0; |
| 135 | srfifo_mem[2] <= 0; |
| 136 | srfifo_mem[3] <= 0; |
| 137 | srfifo_mem[4] <= 0; |
| 138 | srfifo_mem[5] <= 0; |
| 139 | srfifo_mem[6] <= 0; |
| 140 | srfifo_mem[7] <= 0; |
| 141 | srfifo_mem[8] <= 0; |
| 142 | srfifo_mem[9] <= 0; |
| 143 | srfifo_mem[10] <= 0; |
| 144 | srfifo_mem[11] <= 0; |
| 145 | srfifo_mem[12] <= 0; |
| 146 | srfifo_mem[13] <= 0; |
| 147 | srfifo_mem[14] <= 0; |
| 148 | srfifo_mem[15] <= 0; |
| 149 | end |
| 150 | else |
| 151 | begin |
| 152 | case (we) // synopsys parallel_case full_case infer_mux |
| 153 | 1'b1: srfifo_mem[wp] <= din; |
| 154 | 1'b0: srfifo_mem[wp] <= srfifo_mem[wp]; |
| 155 | endcase // case(we) |
| 156 | end |
| 157 | end // always @ (posedge rx_clk) |
| 158 | |
| 159 | assign dout = srfifo_mem[rp]; |
| 160 | |
| 161 | endmodule // srfifo_TBITS_memory_model |
| 162 | |
| 163 | |