// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: FNXPCIEXactorFCEngine.vr
// 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 ============================================
#include "DenaliPCIE.vri"
#include "FNXPCIEXactorDefines.vri"
#include "FNXPCIEXactorReportMacros.vri"
class FNXPCIEXactorFCEngine {
// Base Class and Method Names For QR Macros
local string ClassName = "FNXPCIEXactorFCEngine";
local string MethodName = null;
local ReportClass MyReport;
local FNXPCIEXactorSignalInterface SignalInterface;
local FNXPCIEXactorDenaliClkPort DenaliClkPort;
local FNXPCIEXactorUtilities Util;
protected bit FCTimerEnable[FNX_PCIE_XTR_NUM_FC_TYPES];
protected integer FCTimerMax[FNX_PCIE_XTR_NUM_FC_TYPES];
protected integer FCTimerVal[FNX_PCIE_XTR_NUM_FC_TYPES];
protected integer FCUpdateIncMin[FNX_PCIE_XTR_NUM_FC_TYPES];
protected integer FCUpdateIncMax[FNX_PCIE_XTR_NUM_FC_TYPES];
task new( ReportClass _Report,
FNXPCIEXactorSignalInterface _SignalInterface,
FNXPCIEXactorDenaliClkPort _DenaliClkPort,
FNXPCIEXactorUtilities _Util,
task EnableFCTimer( denaliPcieFcTypeT denFcType );
task DisableFCTimer( denaliPcieFcTypeT denFcType );
task SetFCTimerMax( denaliPcieFcTypeT denFcType, integer fcTimerMax );
task SetFCUpdateRange( denaliPcieFcTypeT denFcType, integer fcUpdateMin, integer fcUpdateMax );
task SetFCData( denaliPcieFcTypeT denFcType, denaliPcieFcIdT denFcId,
bit [FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_WIDTH-1:0] fcData );
function bit[FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_WIDTH-1:0] GetFCData( denaliPcieFcTypeT denFcType,
denaliPcieFcIdT denFcId );
task FNXPCIEXactorFCEngine::new( ReportClass _Report,
FNXPCIEXactorSignalInterface _SignalInterface,
FNXPCIEXactorDenaliClkPort _DenaliClkPort,
FNXPCIEXactorUtilities _Util,
string MethodName = "new";
SignalInterface = _SignalInterface;
DenaliClkPort = _DenaliClkPort;
XactorName = _XactorName;
// Start FC Update Engine
task FNXPCIEXactorFCEngine::Reset() {
string MethodName = "Reset";
for (i=0; i < FNX_PCIE_XTR_NUM_FC_TYPES; i++) {
task FNXPCIEXactorFCEngine::GenFCUpdates() {
string MethodName = "GenFCUpdates";
bit [FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_WIDTH-1:0] fcUpdateInc;
denaliPcieFcTypeT denFcType;
for (i=0; i < FNX_PCIE_XTR_NUM_FC_TYPES; i++) {
if (FCTimerVal[i] === 0) {
denFcType = Util.FCEncToDenaliType(i);
fcUpdateInc = Util.RandUtil.Rand32( FCUpdateIncMin[i], FCUpdateIncMax[i] );
SetFCData( denFcType, PCIE_FCID_RX_ALLOCATED,
GetFCData( denFcType, PCIE_FCID_RX_ALLOCATED ) + fcUpdateInc );
PCIEX_QR_I( "%s-> Set Inc=%h For Next %s Update",
XactorName, fcUpdateInc, denFcType );
FCTimerVal[i] = FCTimerMax[i];
@(posedge DenaliClkPort.$tx_clk); // Clock At Same Rate As Denali FC Timers (250 MHz PCIE, Not Raptor Clock)
task FNXPCIEXactorFCEngine::SetFCData( denaliPcieFcTypeT denFcType,
bit [FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_WIDTH-1:0] fcData ) {
string MethodName = "SetFCData";
bit [FNX_PCIE_XTR_REG_DEN_WIDTH-1:0] fcRegVal;
integer idenFcType, iFcOp, iVc, iFcId;
iVc = PCIE_VCID_VC0; // FNX Only Implements VC 0
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_FC_TYPE_SLC] = idenFcType;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_VC_SLC] = iVc;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_FC_CMD_SLC] = iFcOp;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_FC_ID_SLC] = iFcId;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_SLC] = fcData;
SignalInterface.WriteDenaliReg( PCIE_REG_DEN_FC_CTRL, fcRegVal );
function bit[FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_WIDTH-1:0] FNXPCIEXactorFCEngine::GetFCData( denaliPcieFcTypeT denFcType,
denaliPcieFcIdT denFcId ) {
string MethodName = "GetFCData";
bit [FNX_PCIE_XTR_REG_DEN_WIDTH-1:0] fcRegVal;
integer idenFcType, iFcOp, iVc, iFcId;
iVc = PCIE_VCID_VC0; // FNX Only Implements VC 0
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_FC_TYPE_SLC] = idenFcType;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_VC_SLC] = iVc;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_FC_CMD_SLC] = iFcOp;
fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_FC_ID_SLC] = iFcId;
SignalInterface.WriteDenaliReg( PCIE_REG_DEN_FC_CTRL, fcRegVal );
fcRegVal = SignalInterface.ReadDenaliReg( PCIE_REG_DEN_FC_CTRL );
GetFCData = fcRegVal[FNX_PCIE_XTR_REG_DEN_FC_CTRL_DATA_VAL_SLC];
task FNXPCIEXactorFCEngine::EnableFCTimer( denaliPcieFcTypeT denFcType ) {
string MethodName = "EnableFCTimer";
idx = Util.denaliFCTypeToInt(denFcType);
for (i=0; i < FNX_PCIE_XTR_NUM_FC_TYPES; i++) {
task FNXPCIEXactorFCEngine::DisableFCTimer( denaliPcieFcTypeT denFcType ) {
string MethodName = "DisableFCTimer";
idx = Util.denaliFCTypeToInt(denFcType);
for (i=0; i < FNX_PCIE_XTR_NUM_FC_TYPES; i++) {
task FNXPCIEXactorFCEngine::SetFCTimerMax( denaliPcieFcTypeT denFcType, integer fcTimerMax ) {
string MethodName = "SetFCTimerMax";
idx = Util.denaliFCTypeToInt(denFcType);
for (i=0; i < FNX_PCIE_XTR_NUM_FC_TYPES; i++) {
FCTimerMax[i] = fcTimerMax;
FCTimerMax[idx] = fcTimerMax;
task FNXPCIEXactorFCEngine::SetFCUpdateRange( denaliPcieFcTypeT denFcType, integer fcUpdateMin, integer fcUpdateMax ) {
string MethodName = "SetFCUpdateRange";
idx = Util.denaliFCTypeToInt(denFcType);
for (i=0; i < FNX_PCIE_XTR_NUM_FC_TYPES; i++) {
FCUpdateIncMin[i] = fcUpdateMin;
FCUpdateIncMax[i] = fcUpdateMax;
FCUpdateIncMin[idx] = fcUpdateMin;
FCUpdateIncMax[idx] = fcUpdateMax;