Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / lib / cpu / src / SS_AsiInfo.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: SS_AsiInfo.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 __SS_AsiInfo_h__
#define __SS_AsiInfo_h__
#include "SS_Types.h"
class SS_AsiInfo
{
public:
enum Flags
{
INVALID = 0,
PROTECTION_OFFSET = 0, // 0=user, 1=priv, 2=hyper
PROTECTION_MASK = 3, // 0=user, 1=priv, 2=hyper
PRIVILEGED = 1 << PROTECTION_OFFSET, // priviledged access, cause privileged_action trap
HYPERPRIVILEGED = 2 << PROTECTION_OFFSET, // hyper-privileged access ,cause privileged_action trap
CLASS_LD = 1 << 2, // Valid asi for ld[us][bhw]a? ldxa? ldd?fa?
CLASS_ST = 1 << 3, // Valid asi for st[bhwx]a?
CLASS_STF = 1 << 4, // Valid asi for st[df]a?
CLASS_LDX = 1 << 5, // Valid asi for ldxa
CLASS_STX = 1 << 6, // Valid asi for stxa
CLASS_ATOMIC = 1 << 7, // Valid asi for ldstuba, swapa, casa, casxa
CLASS_PREFETCH = 1 << 8, // Valid asi for prefetcha
PRIMARY = 1 << 9, // Translate with primary context
SECONDARY = 1 << 10, // Translate with secondary context
NUCLEUS = 1 << 11, // Translate with nucleus context
REAL = 1 << 12, // Translate as RA->PA (ignore context), only when nonprivileged.
BYPASS = 1 << 13, // Translate as PA=VA (bypass), only when hpstate.hpriv=1
LITTLE_ENDIAN = 1 << 14, // The asi is a little endian memory access
NOFAULT = 1 << 15, // The asi is a non faulting asi
AS_IF_USER = 1 << 16, // The asi is an as_if_user asi
AS_IF_PRIV = 1 << 17, // The asi is an as_if_user asi
QUAD_LOAD = 1 << 18, // The asi is a quad_load (only valid for ldd)
BLOCK_LOAD = 1 << 19, // The asi is a block load (only valid for lddfa)
BLOCK_STORE = 1 << 20, // The asi is a block store (only valid for stdfa)
SHORTF_8 = 1 << 21, // The asi is a short float 8 load/store (only valid for lddfa and stdfa)
SHORTF_16 = 1 << 22, // The asi is a short float 16 load/store (only valid for lddfa and stdfa)
PARTIAL_8 = 1 << 23, // The asi is a partial float store 8 (only valid for stdfa)
PARTIAL_16 = 1 << 24, // The asi is a partial float store 16 (only valid for stdfa)
PARTIAL_32 = 1 << 25, // The asi is a partial float store 32 (only valid for stdfa)
BLOCK_INIT = 1 << 26, // The asi is a block init store (valid with all store)
NONTRANS = 1 << 27 // The asi is a nontransacional asi
};
friend Flags operator|( Flags a, Flags b ) { return Flags(uint_t(a) | uint_t(b)); }
friend Flags operator&( Flags a, Flags b ) { return Flags(uint_t(a) & uint_t(b)); }
SS_AsiInfo( Flags f=INVALID ) : flags(f) {}
void set_flags( Flags f ) { flags = f; }
Flags get_flags() { return flags; }
void clr_flags( Flags f ) { flags = flags & Flags(~uint_t(f)); }
bool is_valid_ld_asi() const { return flags & CLASS_LD; }
bool is_valid_ldx_asi() const { return flags & CLASS_LDX; }
bool is_valid_st_asi() const { return flags & CLASS_ST; }
bool is_valid_stf_asi() const { return flags & CLASS_STF; }
bool is_valid_stx_asi() const { return flags & CLASS_STX; }
bool is_valid_atomic_asi() const { return flags & CLASS_ATOMIC; }
bool is_valid_prefetch_asi() const { return flags & CLASS_PREFETCH; }
bool is_valid_flush_asi() const { return flags & CLASS_ATOMIC; }
bool is_translating() const { return flags & (PRIMARY|SECONDARY|NUCLEUS|REAL); }
bool is_primary() const { return flags & PRIMARY; }
bool is_secondary() const { return flags & SECONDARY; }
bool is_nucleus() const { return flags & NUCLEUS; }
bool is_real() const { return flags & REAL; }
bool is_bypass() const { return flags & BYPASS; }
uint_t get_protection() const { return (flags >> PROTECTION_OFFSET) & PROTECTION_MASK; }
bool is_little_endian() const { return flags & LITTLE_ENDIAN; }
bool is_nofault() const { return flags & NOFAULT; }
bool is_as_if_user() const { return flags & AS_IF_USER; }
bool is_as_if_priv() const { return flags & AS_IF_PRIV; }
bool is_quad_load_asi() const { return flags & QUAD_LOAD; }
bool is_partial8_asi() const { return flags & PARTIAL_8; }
bool is_partial16_asi() const { return flags & PARTIAL_16; }
bool is_partial32_asi() const { return flags & PARTIAL_32; }
bool is_shortf8_asi() const { return flags & SHORTF_8; }
bool is_shortf16_asi() const { return flags & SHORTF_16; }
bool is_block_load_asi() const { return flags & BLOCK_LOAD; }
bool is_block_store_asi() const { return flags & BLOCK_STORE; }
bool is_block_init_asi() const { return flags & BLOCK_INIT; }
bool is_block_asi() const { return flags & (BLOCK_INIT|BLOCK_LOAD|BLOCK_STORE); }
bool is_nontrans_asi() const { return flags & NONTRANS; }
private:
Flags flags;
};
#endif