Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / lib / ras / src / N2_StoreBuffer.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: N2_StoreBuffer.h
* 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 ============================================
*/
#ifndef __N2_Storebuffer_h__
#define __N2_Storebuffer_h__
#include "SS_Strand.h"
#include "N2_RasState.h"
class N2_Strand;
class N2_StoreBuffer
{
public:
N2_StoreBuffer( N2_Strand& strand )
:strand(strand),
stb_flush_count(0) {}
SS_Trap::Type fill_store_buffer(bool is_asi,uint64_t addr, uint8_t asi,uint64_t data);
SS_Trap::Type check_store_buffer_RAWtrap(const MemoryTransaction &memXact);
SS_Trap::Type purge_store_buffer(uint_t ndx);
SS_Trap::Type flush_store_buffer();
uint_t get_stb_pointer();
uint64_t get_stb_value(uint64_t addr);
protected:
N2_Strand &strand;
const static uint_t STB_FLUSH_RATE = 8;
uint_t stb_flush_count;
std::map<uint64_t,N2_StbAccessDaReg> stb_access;
bool stb_entry_is_asi[1<<N2_StbAccessAddrFields::bit_size_entry];
SS_Trap::Type check_store_buffer_entry(uint_t ndx);
bool stb_entry_valid(uint ndx);
void invalidate_stb_entry(uint ndx);
uint_t incr_stb_pointer();
N2_StbAccessDaReg get_stb_data(uint_t entry);
void set_stb_data(uint_t entry,N2_StbAccessDaReg &);
N2_StbAccessEccReg get_stb_ecc(uint_t entry);
void set_stb_ecc(uint_t entry,N2_StbAccessEccReg &);
N2_StbAccessCtlReg get_stb_ctl(uint_t entry);
void set_stb_ctl(uint_t entry,N2_StbAccessCtlReg &);
N2_StbAccessCamReg get_stb_cam(uint_t entry);
void set_stb_cam(uint_t entry,N2_StbAccessCamReg &);
void set_desr(bool sw_recoverable_trap, uint32_t error_type,
uint32_t error_addr);
};
#endif