Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / api / pfe / src / N2_Python.i
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: N2_Python.i
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23
24%module N2_Python
25
26%{
27#include "N2_Tlb.h"
28#include "N2_Model.h"
29#include "N2_Cpu.h"
30#include "N2_Core.h"
31#include "N2_Strand.h"
32%}
33
34%include "SS_Python.i"
35
36class N2_Tlb : public SS_Tlb
37{
38 public:
39 void insert( SS_Tte* tte );
40};
41
42class N2_Strand : public SS_Strand
43{
44 public:
45};
46
47class N2_Core : public SS_Node
48{
49 public:
50 %extend {
51 int strand_cnt() { return N2_Model::NO_STRANDS_PER_CORE; }
52 N2_Strand* strand_ptr( int i ) { return self->strand[i]; }
53 }
54
55 N2_Tlb inst_tlb;
56 N2_Tlb data_tlb;
57};
58
59class N2_Cpu : public SS_Node
60{
61 public:
62 void hard_reset();
63 %extend {
64 void snapshot( SS_SnapShot& ss ){}
65
66 int core_cnt() { return N2_Model::NO_CORES_PER_CPU; }
67 N2_Core* core_ptr( int i ) { return self->core[i]; }
68 }
69};
70
71%inline %{
72/* n2_cpu() is used when we already have created a N2_Cpu elsewhere
73 and we have a long value representing its pointer. n2_cpu() casts
74 it to a proper SWIG pointer */
75
76N2_Cpu* n2_cpu( int64_t p )
77{
78 return val2ptr<N2_Cpu>(p);
79}
80N2_Model* n2_model( int64_t p )
81{
82 return val2ptr<N2_Model>(p);
83}
84%}
85
86class N2_Model : public SS_Model
87{
88 public:
89 N2_Model();
90
91 void create_cpu( uint_t no_cpu );
92
93 N2_Cpu* cpu_ptr( uint_t i );
94};