Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / memsync / src / MemoryAccessHistoryItem.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: MemoryAccessHistoryItem.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 _MEMORYACCESSHISTORYITEM_H
#define _MEMORYACCESSHISTORYITEM_H
/************************************************************************
**
** Copyright (C) 2002, Sun Microsystems, Inc.
**
** Sun considers its source code as an unpublished, proprietary
** trade secret and it is available only under strict license provisions.
** This copyright notice is placed here only to protect Sun in the event
** the source is deemed a published work. Disassembly, decompilation,
** or other means of reducing the object code to human readable form
** is prohibited by the license agreement under which this code is
** provided to the user or company in possession of this copy."
**
*************************************************************************/
#include <iostream>
#include <list>
#include "TsoCheckerDefs.h"
#include "TsoNode.h"
namespace Tso {
class MemoryAccessHistoryItem {
public:
/**
* Default constructor
*/
MemoryAccessHistoryItem();
/**
* Copy constructor
*
* @param orig The MemoryAccessHistoryItem object to copy.
*/
MemoryAccessHistoryItem( const MemoryAccessHistoryItem &orig );
/**
* Destructor
*/
virtual ~MemoryAccessHistoryItem();
/**
* Equality operator
*
* @param rhs The right hand side of the equality operator
* @return Return true if this objec and rhs are equal,
* otherwise return false
*/
bool operator==( const MemoryAccessHistoryItem &rhs ) const;
/**
* Assignment operator
*
* @param rhs The right hand side of the assignment operator.
* @return The lvalue of the assignment.
*/
const MemoryAccessHistoryItem & operator=( const MemoryAccessHistoryItem &rhs );
/**
* Return a string representation of this MemoryAccessHistoryItem object.
*/
std::string toString() const;
/**
* Get the begin iterator of the stNodeList_
*/
std::list<TsoNode*>::iterator stNodeBegin() { return stNodeList_.begin(); }
/**
* Get the end iterator of the stNodeList_
*/
std::list<TsoNode*>::iterator stNodeEnd() { return stNodeList_.end(); }
/**
* Get the begin iterator of the ldNodeList_
*/
std::list<TsoNode*>::iterator ldNodeBegin() { return ldNodeList_.begin(); }
/**
* Get the end iterator of the ldNodeList_
*/
std::list<TsoNode*>::iterator ldNodeEnd() { return ldNodeList_.end(); }
/**
* Get the size of the stNodeList_
*/
std::list<TsoNode*>::size_type stNodeSize() { return stNodeList_.size(); }
/**
* Erase stNodeList_ entry
* @param ni The iterator whose corresponding entry is to be erased
*/
void stNodeErase (std::list<TsoNode*>::iterator ni) { stNodeList_.erase(ni); }
/**
* Push to the front of the stNodeList_
* @param node The node pointer to be pushed
*/
void stNodePushFront (TsoNode* node) { stNodeList_.push_front(node); }
/**
* Push to the front of the ldNodeList_
* @param node The node pointer to be pushed
*/
void ldNodePushFront (TsoNode* node) { ldNodeList_.push_front(node); }
/**
* Clear all entries in the ldNodeList_
*/
void ldNodeClear () { ldNodeList_.clear(); }
/******************************************************************
* Private variable get/set methods
******************************************************************/
void setAddr (uint64_t addr) { addr_ = addr; }
void setData (uint8_t data) { data_ = data; }
uint64_t getAddr() const { return addr_; }
uint8_t getData() const { return data_; }
protected:
private:
/**
* addr_ is the byte address of this MemoryAccessHistoryItem
*/
uint64_t addr_;
/**
* data_ is the data of this MemoryAccessHistoryItem
*/
uint8_t data_;
/**
* stNodeList_ contains the TsoNode pointers of stores that write to this address <br>
* Head node is the latest one.
*/
std::list<TsoNode*> stNodeList_; // store list, front is the latest
/**
* ldNodeList_ contains the TsoNode pointers of loads that reference to the data
* written by the head node in the stNodeList_
*/
std::list<TsoNode*> ldNodeList_; // loads that is flow dependent to the latest store node
};
} /* namespace Tso */
#endif /* _MEMORYACCESSHISTORYITEM_H */