| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: dmu_common_ccc_cdp.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 | module dmu_common_ccc_cdp |
| 36 | ( |
| 37 | clk, |
| 38 | rst_l, |
| 39 | |
| 40 | csr_host_0_addr, |
| 41 | csr_host_0_data, |
| 42 | csr_host_0_src_bus_id, |
| 43 | csr_host_0_wr, |
| 44 | |
| 45 | csr_host_1_addr, |
| 46 | csr_host_1_data, |
| 47 | csr_host_1_src_bus_id, |
| 48 | csr_host_1_wr, |
| 49 | |
| 50 | csr_host_2_addr, |
| 51 | csr_host_2_data, |
| 52 | csr_host_2_src_bus_id, |
| 53 | csr_host_2_wr, |
| 54 | |
| 55 | csr_host_3_addr, |
| 56 | csr_host_3_data, |
| 57 | csr_host_3_src_bus_id, |
| 58 | csr_host_3_wr, |
| 59 | |
| 60 | csr_host_bit_check_mask, |
| 61 | |
| 62 | arb2cdp_sel, |
| 63 | dep2cdp_data, |
| 64 | fsm2cdp_stts, |
| 65 | |
| 66 | csr_host_0_done_status, |
| 67 | csr_host_0_read_data, |
| 68 | |
| 69 | csr_host_1_done_status, |
| 70 | csr_host_1_read_data, |
| 71 | |
| 72 | csr_host_2_done_status, |
| 73 | csr_host_2_read_data, |
| 74 | |
| 75 | csr_host_3_done_status, |
| 76 | csr_host_3_read_data, |
| 77 | |
| 78 | cdp2fsm_error, |
| 79 | |
| 80 | cdp2pkt_addr, |
| 81 | cdp2pkt_data, |
| 82 | cdp2pkt_src_bus, |
| 83 | cdp2pkt_wr |
| 84 | ); |
| 85 | |
| 86 | // ---------------------------------------------------------------------------- |
| 87 | // Parameters |
| 88 | // ---------------------------------------------------------------------------- |
| 89 | |
| 90 | // ---------------------------------------------------------------------------- |
| 91 | // Ports |
| 92 | // ---------------------------------------------------------------------------- |
| 93 | input clk; |
| 94 | input rst_l; |
| 95 | |
| 96 | input [`FIRE_CSR_ADDR_BITS] csr_host_0_addr; |
| 97 | input [`FIRE_CSR_DATA_BITS] csr_host_0_data; |
| 98 | input [`FIRE_CSR_SRCB_BITS] csr_host_0_src_bus_id; |
| 99 | input csr_host_0_wr; |
| 100 | |
| 101 | input [`FIRE_CSR_ADDR_BITS] csr_host_1_addr; |
| 102 | input [`FIRE_CSR_DATA_BITS] csr_host_1_data; |
| 103 | input [`FIRE_CSR_SRCB_BITS] csr_host_1_src_bus_id; |
| 104 | input csr_host_1_wr; |
| 105 | |
| 106 | input [`FIRE_CSR_ADDR_BITS] csr_host_2_addr; |
| 107 | input [`FIRE_CSR_DATA_BITS] csr_host_2_data; |
| 108 | input [`FIRE_CSR_SRCB_BITS] csr_host_2_src_bus_id; |
| 109 | input csr_host_2_wr; |
| 110 | |
| 111 | input [`FIRE_CSR_ADDR_BITS] csr_host_3_addr; |
| 112 | input [`FIRE_CSR_DATA_BITS] csr_host_3_data; |
| 113 | input [`FIRE_CSR_SRCB_BITS] csr_host_3_src_bus_id; |
| 114 | input csr_host_3_wr; |
| 115 | |
| 116 | input [`FIRE_CSR_ADDR_BITS] csr_host_bit_check_mask; |
| 117 | |
| 118 | input [`FIRE_CSR_SRCB_BITS] arb2cdp_sel; |
| 119 | input [`FIRE_CSR_DATA_BITS] dep2cdp_data; |
| 120 | input [`FIRE_CSR_STTS_BITS] fsm2cdp_stts; |
| 121 | |
| 122 | output [`FIRE_CSR_STTS_BITS] csr_host_0_done_status; |
| 123 | output [`FIRE_CSR_DATA_BITS] csr_host_0_read_data; |
| 124 | |
| 125 | output [`FIRE_CSR_STTS_BITS] csr_host_1_done_status; |
| 126 | output [`FIRE_CSR_DATA_BITS] csr_host_1_read_data; |
| 127 | |
| 128 | output [`FIRE_CSR_STTS_BITS] csr_host_2_done_status; |
| 129 | output [`FIRE_CSR_DATA_BITS] csr_host_2_read_data; |
| 130 | |
| 131 | output [`FIRE_CSR_STTS_BITS] csr_host_3_done_status; |
| 132 | output [`FIRE_CSR_DATA_BITS] csr_host_3_read_data; |
| 133 | |
| 134 | output cdp2fsm_error; |
| 135 | |
| 136 | output [`FIRE_CSR_ADDR_BITS] cdp2pkt_addr; |
| 137 | output [`FIRE_CSR_DATA_BITS] cdp2pkt_data; |
| 138 | output [`FIRE_CSR_SRCB_BITS] cdp2pkt_src_bus; |
| 139 | output cdp2pkt_wr; |
| 140 | |
| 141 | // ---------------------------------------------------------------------------- |
| 142 | // Variables |
| 143 | // ---------------------------------------------------------------------------- |
| 144 | wire [`FIRE_CSR_STTS_BITS] csr_host_0_done_status; |
| 145 | wire [`FIRE_CSR_DATA_BITS] csr_host_0_read_data; |
| 146 | |
| 147 | wire [`FIRE_CSR_STTS_BITS] csr_host_1_done_status; |
| 148 | wire [`FIRE_CSR_DATA_BITS] csr_host_1_read_data; |
| 149 | |
| 150 | wire [`FIRE_CSR_STTS_BITS] csr_host_2_done_status; |
| 151 | wire [`FIRE_CSR_DATA_BITS] csr_host_2_read_data; |
| 152 | |
| 153 | wire [`FIRE_CSR_STTS_BITS] csr_host_3_done_status; |
| 154 | wire [`FIRE_CSR_DATA_BITS] csr_host_3_read_data; |
| 155 | |
| 156 | wire cdp2fsm_error; |
| 157 | |
| 158 | wire [`FIRE_CSR_ADDR_BITS] cdp2pkt_addr; |
| 159 | wire [`FIRE_CSR_DATA_BITS] cdp2pkt_data; |
| 160 | wire [`FIRE_CSR_SRCB_BITS] cdp2pkt_src_bus; |
| 161 | wire cdp2pkt_wr; |
| 162 | |
| 163 | reg [`FIRE_CSR_ADDR_BITS] addr, nxt_addr; |
| 164 | reg [`FIRE_CSR_DATA_BITS] data, nxt_data; |
| 165 | reg [`FIRE_CSR_SRCB_BITS] srcb, nxt_srcb; |
| 166 | reg wr, nxt_wr; |
| 167 | |
| 168 | reg [`FIRE_CSR_STTS_BITS] host_stts; |
| 169 | reg [`FIRE_CSR_DATA_BITS] host_data; |
| 170 | |
| 171 | // ---------------------------------------------------------------------------- |
| 172 | // Zero In Checkers |
| 173 | // ---------------------------------------------------------------------------- |
| 174 | |
| 175 | // ---------------------------------------------------------------------------- |
| 176 | // Combinational |
| 177 | // ---------------------------------------------------------------------------- |
| 178 | // csr host done status and read data |
| 179 | assign csr_host_0_done_status = host_stts; |
| 180 | assign csr_host_0_read_data = host_data; |
| 181 | |
| 182 | assign csr_host_1_done_status = host_stts; |
| 183 | assign csr_host_1_read_data = host_data; |
| 184 | |
| 185 | assign csr_host_2_done_status = host_stts; |
| 186 | assign csr_host_2_read_data = host_data; |
| 187 | |
| 188 | assign csr_host_3_done_status = host_stts; |
| 189 | assign csr_host_3_read_data = host_data; |
| 190 | |
| 191 | // finite state machine error |
| 192 | assign cdp2fsm_error = |(nxt_addr & csr_host_bit_check_mask); |
| 193 | |
| 194 | // packetizer address, data, source bus id, and write |
| 195 | assign cdp2pkt_addr = addr; |
| 196 | assign cdp2pkt_data = data; |
| 197 | assign cdp2pkt_src_bus = srcb; |
| 198 | assign cdp2pkt_wr = wr; |
| 199 | |
| 200 | // csr host address select |
| 201 | always @ (arb2cdp_sel or csr_host_0_addr or csr_host_1_addr or |
| 202 | csr_host_2_addr or csr_host_3_addr) begin |
| 203 | case (arb2cdp_sel) // synopsys infer_mux |
| 204 | 2'b00 : nxt_addr = csr_host_0_addr; |
| 205 | 2'b01 : nxt_addr = csr_host_1_addr; |
| 206 | 2'b10 : nxt_addr = csr_host_2_addr; |
| 207 | 2'b11 : nxt_addr = csr_host_3_addr; |
| 208 | endcase |
| 209 | end |
| 210 | |
| 211 | // csr host data select |
| 212 | always @ (arb2cdp_sel or csr_host_0_data or csr_host_1_data or |
| 213 | csr_host_2_data or csr_host_3_data) begin |
| 214 | case (arb2cdp_sel) // synopsys infer_mux |
| 215 | 2'b00 : nxt_data = csr_host_0_data; |
| 216 | 2'b01 : nxt_data = csr_host_1_data; |
| 217 | 2'b10 : nxt_data = csr_host_2_data; |
| 218 | 2'b11 : nxt_data = csr_host_3_data; |
| 219 | endcase |
| 220 | end |
| 221 | |
| 222 | // csr host source bus id select |
| 223 | always @ (arb2cdp_sel or csr_host_0_src_bus_id or csr_host_1_src_bus_id or |
| 224 | csr_host_2_src_bus_id or csr_host_3_src_bus_id) begin |
| 225 | case (arb2cdp_sel) // synopsys infer_mux |
| 226 | 2'b00 : nxt_srcb = csr_host_0_src_bus_id; |
| 227 | 2'b01 : nxt_srcb = csr_host_1_src_bus_id; |
| 228 | 2'b10 : nxt_srcb = csr_host_2_src_bus_id; |
| 229 | 2'b11 : nxt_srcb = csr_host_3_src_bus_id; |
| 230 | endcase |
| 231 | end |
| 232 | |
| 233 | // csr host write select |
| 234 | always @ (arb2cdp_sel or csr_host_0_wr or csr_host_1_wr or |
| 235 | csr_host_2_wr or csr_host_3_wr) begin |
| 236 | case (arb2cdp_sel) // synopsys infer_mux |
| 237 | 2'b00 : nxt_wr = csr_host_0_wr; |
| 238 | 2'b01 : nxt_wr = csr_host_1_wr; |
| 239 | 2'b10 : nxt_wr = csr_host_2_wr; |
| 240 | 2'b11 : nxt_wr = csr_host_3_wr; |
| 241 | endcase |
| 242 | end |
| 243 | |
| 244 | // ---------------------------------------------------------------------------- |
| 245 | // Sequential |
| 246 | // ---------------------------------------------------------------------------- |
| 247 | always @ (posedge clk) begin |
| 248 | addr <= nxt_addr; |
| 249 | data <= nxt_data; |
| 250 | srcb <= nxt_srcb; |
| 251 | wr <= nxt_wr; |
| 252 | end |
| 253 | |
| 254 | always @ (posedge clk) begin |
| 255 | if (!rst_l) begin |
| 256 | host_data <= 0; |
| 257 | host_stts <= 0; |
| 258 | end |
| 259 | else begin |
| 260 | host_data <= dep2cdp_data; |
| 261 | host_stts <= fsm2cdp_stts; |
| 262 | end |
| 263 | end |
| 264 | |
| 265 | endmodule // dmu_common_ccc_cdp |