Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / memsync / src / MemoryAccessHistory.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: MemoryAccessHistory.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 _MEMORYACCESSHISTORY_H
#define _MEMORYACCESSHISTORY_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 <map>
#include <list>
#include "MemorySyncMessage.h"
#include "TsoCheckerDefs.h"
#include "TsoNode.h"
#include "TsoEdge.h"
#include "MemoryAccessHistoryItem.h"
namespace Tso {
class MemoryAccessHistory {
public:
/**
* Default constructor
*/
MemoryAccessHistory();
/**
* Copy constructor
*
* @param orig The MemoryAccessHistory object to copy.
*/
MemoryAccessHistory( const MemoryAccessHistory &orig );
/**
* Destructor
*/
virtual ~MemoryAccessHistory();
/**
* 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 MemoryAccessHistory &rhs ) const;
/**
* Assignment operator
*
* @param rhs The right hand side of the assignment operator.
* @return The lvalue of the assignment.
*/
const MemoryAccessHistory & operator=( const MemoryAccessHistory &rhs );
/**
* Return a string representation of this MemoryAccessHistory object.
*/
std::string toString() const;
/**
* This method performs the following tasks on a store node
* - register a store to the hist_ if its address is a new one,
* - create anti-dependence edges from all loads in the ldNodeList_ to this node,
* - create the output_dependece edge from the prior store to this node,
* - set retirement time of the prior store node
* <p>
* Note the aforementioned tasks are performed on every valid byte of the store node.
* <p>
* @param storeNode The node pointer to be handled
*/
void storeCommit (TsoNode* storeNode);
/**
* This method performs the following tasks on a load node
* - create the flow-dependence edge from the store node that is the nearest one
* (in time) before the load node to the node
* - create the anti-dependence edge from the load node to the store node that is
* the nearest (in time) after the load node
* <p>
* @param loadNode The node pointer to be handled
*/
void loadAccess (TsoNode* loadNode);
/**
* Remove a store node pointer from the stNodeList_
* @param storeNodeP The store node pointer to be removed
*/
void removeStoreNode (TsoNode* storeNodeP);
protected:
private:
/**
* hist_ contains a list of <addr, MemoryAccessHistoryItem> pair.
* Each pair is for one byte, hence, the address is a byte address.
* The corresponding MemoryAccessHistoryItem then keeps the update
* history of this address.
*/
std::map<uint64_t,MemoryAccessHistoryItem> hist_;
};
} /* namespace Tso */
#endif /* _MEMORYACCESSHISTORY_H */