Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / pli / src / SS_RegCompare.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: SS_RegCompare.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named 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 work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
#ifndef __SS_RegCompare_h__
#define __SS_RegCompare_h__
#include "SS_Strand.h"
#include "SS_PliSocket.h"
class SS_RegCompare
{
public:
// make sure CTR_CMPR_MAX is larger than the registers in RegId
// (of bin/SS_RegCompare.h).
enum { CTR_G=0, CTR_W=1, CTR_F=2, CTR_INSTR=254, CTR_OPCODE=255, CTR_CMPR_MAX=256 };
SS_RegCompare( SS_Strand* _strand, SS_PliSocket* _socket );
void debug_output( FILE* _dbg_out ) { dbg_out = _dbg_out; }
void initialise();
void compare();
void dump_regs();
bool is_initialise() { return inited; }
void cmpr_on() { for (int i=0; i<CTR_CMPR_MAX; i++) cmpr_list[i]=true; }
void cmpr_on( int ii ) { assert(ii<CTR_CMPR_MAX); cmpr_list[ii]=true; }
void cmpr_off() { for (int i=0; i<CTR_CMPR_MAX; i++) cmpr_list[i]=false; }
void cmpr_off( int ii ) { assert(ii<CTR_CMPR_MAX); cmpr_list[ii]=false; }
bool is_cmpr( int ii ) { return cmpr_list[ii]; }
protected:
uint64_t grf[(1 + SS_Strand::MAX_GL) * 8];
uint64_t wrf[(1 + SS_Strand::MAX_WP) * 16];
uint32_t frf[64];
FILE* dbg_out;
SS_PliSocket* socket;
bool inited;
// 'true' to one entry means its corresponding register will be included
// in delta generation and replay comparison.
bool cmpr_list[CTR_CMPR_MAX];
// 'true' mean an instruction has generate one or more register delta
bool new_delta;
private:
SS_Strand* strand;
};
#endif