// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: dmu_common_ccc_arb.v
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
module dmu_common_ccc_arb
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
parameter IDLE = 2'b00, // state machine states
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
output [`FIRE_CSR_SRCB_BITS] arb2cdp_sel;
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
reg [3:0] done, nxt_done;
reg [1:0] grant, new_grant, nxt_grant;
reg [1:0] state, nxt_state;
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
wire csr_host_0_done = done[0];
wire csr_host_1_done = done[1];
wire csr_host_2_done = done[2];
wire csr_host_3_done = done[3];
// cdp select and fsm valid
assign arb2cdp_sel = grant;
wire arb2fsm_valid = valid;
assign req[0] = csr_host_0_req;
assign req[1] = csr_host_1_req;
assign req[2] = csr_host_2_req;
assign req[3] = csr_host_3_req;
always @ (req or grant) begin
casez ({grant, req}) // synopsys parallel_case
6'b00_zz1z : new_grant = 2'b01;
6'b00_z10z : new_grant = 2'b10;
6'b00_100z : new_grant = 2'b11;
6'b00_000z : new_grant = 2'b00;
6'b01_z1zz : new_grant = 2'b10;
6'b01_10zz : new_grant = 2'b11;
6'b01_00z1 : new_grant = 2'b00;
6'b01_00z0 : new_grant = 2'b01;
6'b10_1zzz : new_grant = 2'b00;
6'b10_0zz1 : new_grant = 2'b00;
6'b10_0z10 : new_grant = 2'b00;
6'b10_0z00 : new_grant = 2'b00;
6'b11_zzz1 : new_grant = 2'b00;
6'b11_zz10 : new_grant = 2'b00;
6'b11_z100 : new_grant = 2'b00;
6'b11_z000 : new_grant = 2'b00;
always @ (state or any_req or fsm2arb_done) begin
case (state) // synopsys parallel_case
if (any_req) nxt_state = BUSY;
if (fsm2arb_done) nxt_state = DONE;
default : nxt_state = IDLE;
always @ (state or nxt_state or new_grant or grant) begin
case (state) // synopsys parallel_case
case (nxt_state) // synopsys parallel_case
case (nxt_state) // synopsys parallel_case
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
always @(posedge clk) begin
endmodule // dmu_common_ccc_arb