Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / api / pfe / src / N2_Python.i
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: N2_Python.i
* 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 ============================================
*/
%module N2_Python
%{
#include "N2_Tlb.h"
#include "N2_Model.h"
#include "N2_Cpu.h"
#include "N2_Core.h"
#include "N2_Strand.h"
%}
%include "SS_Python.i"
class N2_Tlb : public SS_Tlb
{
public:
void insert( SS_Tte* tte );
};
class N2_Strand : public SS_Strand
{
public:
};
class N2_Core : public SS_Node
{
public:
%extend {
int strand_cnt() { return N2_Model::NO_STRANDS_PER_CORE; }
N2_Strand* strand_ptr( int i ) { return self->strand[i]; }
}
N2_Tlb inst_tlb;
N2_Tlb data_tlb;
};
class N2_Cpu : public SS_Node
{
public:
void hard_reset();
%extend {
void snapshot( SS_SnapShot& ss ){}
int core_cnt() { return N2_Model::NO_CORES_PER_CPU; }
N2_Core* core_ptr( int i ) { return self->core[i]; }
}
};
%inline %{
/* n2_cpu() is used when we already have created a N2_Cpu elsewhere
and we have a long value representing its pointer. n2_cpu() casts
it to a proper SWIG pointer */
N2_Cpu* n2_cpu( int64_t p )
{
return val2ptr<N2_Cpu>(p);
}
N2_Model* n2_model( int64_t p )
{
return val2ptr<N2_Model>(p);
}
%}
class N2_Model : public SS_Model
{
public:
N2_Model();
void create_cpu( uint_t no_cpu );
N2_Cpu* cpu_ptr( uint_t i );
};