Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / lib / cpu / src / N2_Model.cc
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T2 Processor File: N2_Model.cc
// 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 ============================================
/************************************************************************
**
** Copyright (C) 2006, Sun Microsystems, Inc.
**
** Sun considers its source code as an unpublished, proprietary
** trade secret and it is available only under strict license provisions.
** This copyright notice is placed here only to protect Sun in the event
** the source is deemed a published work. Disassembly, decompilation,
** or other means of reducing the object code to human readable form
** is prohibited by the license agreement under which this code is
** provided to the user or company in possession of this copy.
**
*************************************************************************/
#include <iostream>
#include "N2_Model.h"
#include "N2_Cpu.h"
#include "SS_Io.h"
#include "SS_CKMemory.h"
using namespace std;
N2_Model::N2_Model()/*{{{*/
:
SS_Model(),
ck_memory(NULL)
{
// make sure only register those I/O ranges once
//TODO inform blaze that these I/O ranges are taken.
csr.reg_addr_space();
}
/*}}}*/
void N2_Model::create_cpu( uint_t no_cpu ) /*{{{*/
{
char s[8];
uint_t n = cpu_count;
cpu_count += no_cpu;
assert(cpu_count <= MAX_CPU_COUNT);
for (; n < cpu_count; n++)
{
sprintf(s,"p%d",n);
cpu[n] = new N2_Cpu(*this,s,(n*NO_STRANDS_PER_CPU));
}
}
/*}}}*/
void N2_Model::ras_enable(char* cmd)/*{{{*/
{
uint_t n = 0;
/* Create Chip-Kill memory from one of the strand memory pointers */
if(!ck_memory)
ck_memory = new SS_CKMemory((SS_Memory*)(cpu[0]->strand[0]->memory));
for (uint_t i=0; i < cpu_count; i++)
cpu[i]->ras_enable(cmd);
}
/*}}}*/