// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: fflp_cam_sched.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 name: fflp_cam_sched */
/*description: Aabitration between CPU access and packet */
/*parent module in: none */
/*child modules in: none */
/*author name: Jeanne Cai */
/*date created: 16-03-2004 */
/* Copyright (c) 2004, Sun Microsystems, Inc. */
/* Sun Proprietary and Confidential */
/**********************************************************************/
input[3:0] cam_srch_latency;
input[3:0] cam_srch_ratio;
input fc_fifo_space_avail;
wire[3:0] fwd_wait_cnt_in;
wire[3:0] fwd_sched_cnt_in;
always @ (state or fwd_req or cpu_req_cam_acc or fc_fifo_space_avail or
fwd_wait_done or fwd_reqs_served)
case (state) //synopsys parallel_case full_case
// 0in < case -full -parallel -message "0in ERROR: case check in fflp_cam_sched:state"
if (fwd_req & fc_fifo_space_avail)
else if (cpu_req_cam_acc)
if (fwd_wait_done & fwd_reqs_served)
else if (fwd_req & fc_fifo_space_avail)
if (fwd_wait_done) //use same counter is fine here since
//cpu_srch and cam pio_wr_cost pretty much the same cycles
default: next_state = FWD_ARB;
dffr #(2) state_reg (cclk, reset, next_state, state);
dffr #(1) fwd_sched_reg (cclk, reset, fwd_sched_sm, fwd_sched);
dffr #(1) cpu_sched_reg (cclk, reset, cpu_sched_sm, cpu_sched);
dffr #(4) fwd_wait_cnt_reg (cclk, reset, fwd_wait_cnt_in, fwd_wait_cnt);
assign fwd_wait_cnt_in = {4{inc_fwd_wait_cnt}} & (fwd_wait_cnt[3:0] + 4'd1);
assign fwd_wait_done = (fwd_wait_cnt == cam_srch_latency);
/*********************************************************************/
//allocate load balance, cpu bandwidth
/*********************************************************************/
assign fwd_reqs_served = (fwd_sched_cnt == cam_srch_ratio);
assign fwd_sched_cnt_en = fwd_sched_sm | cpu_sched_sm;
assign fwd_sched_cnt_in = (cpu_sched_sm | reset_fwd_cnt) ? 4'b0000 : (fwd_sched_cnt + 1);
dffre #(4) fwd_sched_cnt_reg (cclk, reset, fwd_sched_cnt_en, fwd_sched_cnt_in, fwd_sched_cnt);