Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / dev / ram / src / SS_Ram.i
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: SS_Ram.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 SS_Ram
%{
#include "SS_Ram.h"
#include "SS_Memory.h"
%}
/*============================================================================*\
* get_memory() - return swig pointer to c++ SS_Memory *
\*============================================================================*/
%inline %{
SS_Memory* get_memory() { return &SS_Memory::memory; }
%}
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef unsigned int uint_t;
typedef signed int int32_t;
typedef unsigned long uint64_t;
typedef signed long int64_t;
typedef uint64_t SS_Paddr;
/*============================================================================*\
* SS_Memory - This is the swig wrapper class around the C++ SS_Memory class *
* The file SS_Memory.py implement the PFE memory object, that uses this swig *
\*============================================================================*/
class SS_Memory
{
public:
void allocate( uint64_t _ram_size, uint64_t _rom_size, uint_t pa_bits );
void load( const char* filename );
void load( const char* filename, uint64_t addr );
void save( const char* filename, uint64_t addr, uint64_t size );
void poke8( uint64_t addr, uint8_t data );
void poke16( uint64_t addr, uint16_t data );
%extend { /* python 2.4 became pedantic about int values with signbit set, this avoids the nagging */
void poke32( uint64_t addr, uint64_t data ) { self->poke32(addr,uint32_t(data)); }
}
void poke64( uint64_t addr, uint64_t data );
uint8_t peek8u ( uint64_t addr );
int8_t peek8s ( uint64_t addr );
uint16_t peek16u( uint64_t addr );
int16_t peek16s( uint64_t addr );
uint32_t peek32u( uint64_t addr );
int32_t peek32s( uint64_t addr );
uint64_t peek64 ( uint64_t addr );
};
class SS_Ram
{
public:
SS_Ram( SS_AddressMap* map, SS_Paddr lo, SS_Paddr hi );
};