Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / lib / cpu / src / SS_Cpu.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: SS_Cpu.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_Cpu_h__
#define __SS_Cpu_h__
#include "SS_Types.h"
#include "SS_Node.h"
#include "SS_SnapShot.h"
#include "SS_MemErrDetector.h"
class SS_Strand;
class SS_Model;
class SS_Cpu : public SS_Node
{
public:
SS_Cpu( SS_Model& _model, const char* _name );
SS_Model& model;
virtual void hard_reset() = 0;
virtual void warm_reset(bool intp=true) = 0;
virtual void xtrn_reset() = 0;
// The current maximum number of strands per cpu is 64.
// This limit comes from the CMP spec, and from the choise
// we made to use uin64_t types as bitmaps to record which
// strands are active, enabled, runnning, and stepping.
// the upper limit has increased, so the change.
enum { MAX_STRAND_COUNT = 128 };
// strand_cnt() returns the number of stands in the cpu object
uint_t strand_cnt() { return strand_count; }
SS_Strand* strand[MAX_STRAND_COUNT];
// snapshot() is called to take a snapshot of the cpu and sibbling objects
virtual void snapshot( SS_SnapShot& );
// flush() propagates the flush from model to all strands in the cpu
void flush( SS_Paddr pa );
// flush() broadcasts the flush to all the strands in the cpu
// that are actively stepping. It's processor specific still.
// SS_Strand is the strand that issues the flush.
void flush( SS_Strand* s, SS_Paddr pa, uint_t size );
// ras_flush() propagates a call to flush RAS cache state from
// model to all strands in the cpu
void ras_flush( SS_Strand* requesting_strand, SS_Paddr pa, uint64_t size, SS_MemErrDetector::CacheType type );
// clr_stepping() is called when a cpu is created by the sam virtual
// cpu interface. After this set_stepping() is called to enable
// individual strands. Initially all strands are stepping.
void clr_stepping()
{
strand_stepping[0] = 0ull;
strand_stepping[1] = 0ull;
}
bool is_stepping( uint_t strand_id )
{
assert(strand_id < 128);
return strand_stepping[strand_id >> 6] & (1ull << (strand_id & 63));
}
// set_stepping() marks strand with id strand_id as stepping, which
// means that flush will consider it in the flush broadcast.
virtual void set_stepping( uint_t strand_id )
{
assert(strand_id < 128);
strand_stepping[strand_id >> 6] |= 1ull << (strand_id & 63);
}
// ras_enable() is called to enable ras features
virtual void ras_enable(char* cmd);
protected:
// The stepping variable holds a bit per strands that tells if the strand
// is stepping or not. Note that stepping does not mean that the strand is
// running, nor does it mean the strand is halted. It just means that the
// strand is actively part of the system setup.
uint_t strand_count; // Number of strand objects available in strand
uint64_t strand_stepping[2]; // Which strands are setup for stepping (bit vector)
// change_running() is called whenever the cmp strand running status
// changes value, to update the strandst hat receive flush oprations
void change_running( uint64_t _strand_running_status )
{
// @@ha144505 remove me when done
}
};
#endif