Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / lib / cpu / src / N2_Model.cc
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: N2_Model.cc
4// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21/************************************************************************
22**
23** Copyright (C) 2006, Sun Microsystems, Inc.
24**
25** Sun considers its source code as an unpublished, proprietary
26** trade secret and it is available only under strict license provisions.
27** This copyright notice is placed here only to protect Sun in the event
28** the source is deemed a published work. Disassembly, decompilation,
29** or other means of reducing the object code to human readable form
30** is prohibited by the license agreement under which this code is
31** provided to the user or company in possession of this copy.
32**
33*************************************************************************/
34#include <iostream>
35#include "N2_Model.h"
36#include "N2_Cpu.h"
37#include "SS_Io.h"
38#include "SS_CKMemory.h"
39
40using namespace std;
41
42N2_Model::N2_Model()/*{{{*/
43 :
44 SS_Model(),
45 ck_memory(NULL)
46{
47 // make sure only register those I/O ranges once
48 //TODO inform blaze that these I/O ranges are taken.
49 csr.reg_addr_space();
50}
51/*}}}*/
52
53void N2_Model::create_cpu( uint_t no_cpu ) /*{{{*/
54{
55 char s[8];
56 uint_t n = cpu_count;
57 cpu_count += no_cpu;
58 assert(cpu_count <= MAX_CPU_COUNT);
59 for (; n < cpu_count; n++)
60 {
61 sprintf(s,"p%d",n);
62 cpu[n] = new N2_Cpu(*this,s,(n*NO_STRANDS_PER_CPU));
63 }
64}
65/*}}}*/
66
67void N2_Model::ras_enable(char* cmd)/*{{{*/
68{
69 uint_t n = 0;
70
71 /* Create Chip-Kill memory from one of the strand memory pointers */
72 if(!ck_memory)
73 ck_memory = new SS_CKMemory((SS_Memory*)(cpu[0]->strand[0]->memory));
74 for (uint_t i=0; i < cpu_count; i++)
75 cpu[i]->ras_enable(cmd);
76
77}
78/*}}}*/