diff options
author | Nathan Binkert <nate@binkert.org> | 2010-03-22 18:43:53 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2010-03-22 18:43:53 -0700 |
commit | 5ab13e2deb8f904ef2a233749193fa09ea7013c4 (patch) | |
tree | 07f5f02902f9e719fe58d1a9419b5a1d51f7a2ce /src/mem/ruby/slicc_interface | |
parent | 2620e08722b38660658d46cdb76c337db18e877c (diff) | |
download | gem5-5ab13e2deb8f904ef2a233749193fa09ea7013c4.tar.xz |
ruby: style pass
Diffstat (limited to 'src/mem/ruby/slicc_interface')
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractCacheEntry.cc | 19 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractCacheEntry.hh | 53 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractController.hh | 45 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractEntry.cc | 9 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractEntry.hh | 49 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractProtocol.hh | 36 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/Message.hh | 90 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/NetworkMessage.hh | 99 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.cc | 2 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh | 129 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.cc | 78 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh | 44 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_Util.hh | 159 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_includes.hh | 6 |
14 files changed, 387 insertions, 431 deletions
diff --git a/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc b/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc index 83039a9b0..3d8972c40 100644 --- a/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc +++ b/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,21 +26,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * $Id$ - * - * Description: See AbstractCacheEntry.hh - * - */ - #include "mem/ruby/slicc_interface/AbstractCacheEntry.hh" -AbstractCacheEntry::AbstractCacheEntry() { - m_Address.setAddress(0); - m_Permission = AccessPermission_NotPresent; +AbstractCacheEntry::AbstractCacheEntry() +{ + m_Address.setAddress(0); + m_Permission = AccessPermission_NotPresent; } -// still need to define destructor for subclasses -AbstractCacheEntry::~AbstractCacheEntry() { +AbstractCacheEntry::~AbstractCacheEntry() +{ } diff --git a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh index b98e1fa07..223bc6fc8 100644 --- a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh +++ b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -28,49 +27,39 @@ */ /* - * $Id$ - * - * Description: Common base class for a machine node. - * + * Common base class for a machine node. */ -#ifndef AbstractCacheEntry_H -#define AbstractCacheEntry_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__ -#include "mem/ruby/common/Global.hh" -#include "mem/ruby/common/Address.hh" #include "mem/protocol/AccessPermission.hh" +#include "mem/ruby/common/Address.hh" +#include "mem/ruby/common/Global.hh" #include "mem/ruby/slicc_interface/AbstractEntry.hh" class DataBlock; -class AbstractCacheEntry : public AbstractEntry { -public: - // Constructors - AbstractCacheEntry(); - - // Destructor, prevent it from instantiation - virtual ~AbstractCacheEntry() = 0; +class AbstractCacheEntry : public AbstractEntry +{ + public: + AbstractCacheEntry(); + virtual ~AbstractCacheEntry() = 0; - // Data Members (m_ prefix) - Address m_Address; // Address of this block, required by CacheMemory - Time m_LastRef; // Last time this block was referenced, required by CacheMemory - AccessPermission m_Permission; // Access permission for this block, required by CacheMemory + Address m_Address; // Address of this block, required by CacheMemory + Time m_LastRef; // Last time this block was referenced, required + // by CacheMemory + AccessPermission m_Permission; // Access permission for this + // block, required by CacheMemory }; -// Output operator declaration -ostream& operator<<(ostream& out, const AbstractCacheEntry& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const AbstractCacheEntry& obj) +inline ostream& +operator<<(ostream& out, const AbstractCacheEntry& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << flush; + return out; } -#endif //AbstractCacheEntry_H +#endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__ diff --git a/src/mem/ruby/slicc_interface/AbstractController.hh b/src/mem/ruby/slicc_interface/AbstractController.hh index 390b7f730..facaf2adf 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.hh +++ b/src/mem/ruby/slicc_interface/AbstractController.hh @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ABSTRACTCONTROLLER_H -#define ABSTRACTCONTROLLER_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__ #include "sim/sim_object.hh" #include "params/RubyController.hh" @@ -40,29 +40,30 @@ class MessageBuffer; class Network; -class AbstractController : public SimObject, public Consumer { -public: +class AbstractController : public SimObject, public Consumer +{ + public: typedef RubyControllerParams Params; AbstractController(const Params *p) : SimObject(p) {} - // returns the number of controllers created of the specific subtype - // virtual int getNumberOfControllers() const = 0; - virtual MessageBuffer* getMandatoryQueue() const = 0; - virtual const int & getVersion() const = 0; - virtual const string toString() const = 0; // returns text version of controller type - virtual const string getName() const = 0; // return instance name - virtual const MachineType getMachineType() const = 0; - virtual void blockOnQueue(Address, MessageBuffer*) = 0; - virtual void unblock(Address) = 0; - virtual void initNetworkPtr(Network* net_ptr) = 0; - - virtual void print(ostream & out) const = 0; - virtual void printStats(ostream & out) const = 0; - virtual void printConfig(ostream & out) const = 0; - virtual void wakeup() = 0; - // virtual void dumpStats(ostream & out) = 0; - virtual void clearStats() = 0; + // returns the number of controllers created of the specific subtype + // virtual int getNumberOfControllers() const = 0; + virtual MessageBuffer* getMandatoryQueue() const = 0; + virtual const int & getVersion() const = 0; + virtual const string toString() const = 0; // returns text version of + // controller type + virtual const string getName() const = 0; // return instance name + virtual const MachineType getMachineType() const = 0; + virtual void blockOnQueue(Address, MessageBuffer*) = 0; + virtual void unblock(Address) = 0; + virtual void initNetworkPtr(Network* net_ptr) = 0; + virtual void print(ostream & out) const = 0; + virtual void printStats(ostream & out) const = 0; + virtual void printConfig(ostream & out) const = 0; + virtual void wakeup() = 0; + // virtual void dumpStats(ostream & out) = 0; + virtual void clearStats() = 0; }; -#endif +#endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__ diff --git a/src/mem/ruby/slicc_interface/AbstractEntry.cc b/src/mem/ruby/slicc_interface/AbstractEntry.cc index 914d4a37e..d66258eef 100644 --- a/src/mem/ruby/slicc_interface/AbstractEntry.cc +++ b/src/mem/ruby/slicc_interface/AbstractEntry.cc @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -29,10 +28,10 @@ #include "mem/ruby/slicc_interface/AbstractEntry.hh" -// Must define constructor and destructor in subclasses -AbstractEntry::AbstractEntry() { +AbstractEntry::AbstractEntry() +{ } -AbstractEntry::~AbstractEntry() { +AbstractEntry::~AbstractEntry() +{ } - diff --git a/src/mem/ruby/slicc_interface/AbstractEntry.hh b/src/mem/ruby/slicc_interface/AbstractEntry.hh index 8e1968d62..eef9a5227 100644 --- a/src/mem/ruby/slicc_interface/AbstractEntry.hh +++ b/src/mem/ruby/slicc_interface/AbstractEntry.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,47 +26,35 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AbstractEntry_H -#define AbstractEntry_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTENTRY_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTENTRY_HH__ -#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Address.hh" +#include "mem/ruby/common/Global.hh" #include "mem/protocol/AccessPermission.hh" class DataBlock; -class AbstractEntry { -public: - // Constructors - AbstractEntry(); - - // Destructor, prevent it from instantiation - virtual ~AbstractEntry() = 0; - - // Public Methods - - // The methods below are those called by ruby runtime, add when it is - // absolutely necessary and should all be virtual function. - virtual DataBlock& getDataBlk() = 0; - +class AbstractEntry +{ + public: + AbstractEntry(); + virtual ~AbstractEntry() = 0; - virtual void print(ostream& out) const = 0; + // The methods below are those called by ruby runtime, add when it + // is absolutely necessary and should all be virtual function. + virtual DataBlock& getDataBlk() = 0; + virtual void print(ostream& out) const = 0; }; -// Output operator declaration -ostream& operator<<(ostream& out, const AbstractEntry& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const AbstractEntry& obj) +inline ostream& +operator<<(ostream& out, const AbstractEntry& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << flush; + return out; } -#endif //AbstractEntry_H +#endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTENTRY_HH__ diff --git a/src/mem/ruby/slicc_interface/AbstractProtocol.hh b/src/mem/ruby/slicc_interface/AbstractProtocol.hh index d602f5e54..2cc64a258 100644 --- a/src/mem/ruby/slicc_interface/AbstractProtocol.hh +++ b/src/mem/ruby/slicc_interface/AbstractProtocol.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -28,33 +27,24 @@ */ /* - * $Id$ - * - * Description: Define all possible protocol parameters and their - * default value here. Normally, all parameters should - * have default value "false" means the feature of the - * protocol is turned off. - * + * Define all possible protocol parameters and their default value + * here. Normally, all parameters should have default value "false" + * means the feature of the protocol is turned off. */ -#ifndef AbstractProtocol_H -#define AbstractProtocol_H - -class AbstractProtocol { -public: - // Constructors - AbstractProtocol() {}; +#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTPROTOCOL_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTPROTOCOL_HH__ - // Destructor, no instantiation - // No definition also, so no subclass can be instantiated also - virtual ~AbstractProtocol() = 0; +class AbstractProtocol +{ + public: + AbstractProtocol() {} - // Public Methods + virtual ~AbstractProtocol() = 0; - // Data Members (m_ prefix) - static const bool m_CMP = false ; - static const bool m_TwoLevelCache = false ; + static const bool m_CMP = false ; + static const bool m_TwoLevelCache = false ; }; -#endif //AbstractProtocol_H +#endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTPROTOCOL_HH__ diff --git a/src/mem/ruby/slicc_interface/Message.hh b/src/mem/ruby/slicc_interface/Message.hh index fef4bdf59..d9df6f131 100644 --- a/src/mem/ruby/slicc_interface/Message.hh +++ b/src/mem/ruby/slicc_interface/Message.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,67 +26,58 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * $Id$ - */ - -#ifndef MESSAGE_H -#define MESSAGE_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_MESSAGE_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_MESSAGE_HH__ #include <iostream> -#include "mem/ruby/common/Global.hh" #include "mem/gems_common/RefCnt.hh" #include "mem/gems_common/RefCountable.hh" +#include "mem/ruby/common/Global.hh" #include "mem/ruby/eventqueue/RubyEventQueue.hh" class Message; typedef RefCnt<Message> MsgPtr; -class Message : public RefCountable { -public: - // Constructors - Message() : RefCountable() { m_time = g_eventQueue_ptr->getTime(); m_LastEnqueueTime = g_eventQueue_ptr->getTime(); m_DelayedCycles = 0;} - - // Destructor - virtual ~Message() { } - - // Public Methods - virtual Message* clone() const = 0; - virtual void destroy() = 0; - virtual void print(std::ostream& out) const = 0; - - void setDelayedCycles(const int& cycles) { m_DelayedCycles = cycles; } - const int& getDelayedCycles() const {return m_DelayedCycles;} - int& getDelayedCycles() {return m_DelayedCycles;} - void setLastEnqueueTime(const Time& time) { m_LastEnqueueTime = time; } - const Time& getLastEnqueueTime() const {return m_LastEnqueueTime;} - Time& getLastEnqueueTime() {return m_LastEnqueueTime;} - - const Time& getTime() const { return m_time; } - void setTime(const Time& new_time) { m_time = new_time; } -private: - // Private Methods - - // Data Members (m_ prefix) - Time m_time; - Time m_LastEnqueueTime; // my last enqueue time - int m_DelayedCycles; // my delayed cycles - +class Message : public RefCountable +{ + public: + Message() + : RefCountable() + { + m_time = g_eventQueue_ptr->getTime(); + m_LastEnqueueTime = g_eventQueue_ptr->getTime(); + m_DelayedCycles = 0; + } + + virtual ~Message() { } + + virtual Message* clone() const = 0; + virtual void destroy() = 0; + virtual void print(std::ostream& out) const = 0; + + void setDelayedCycles(const int& cycles) { m_DelayedCycles = cycles; } + const int& getDelayedCycles() const {return m_DelayedCycles;} + int& getDelayedCycles() {return m_DelayedCycles;} + void setLastEnqueueTime(const Time& time) { m_LastEnqueueTime = time; } + const Time& getLastEnqueueTime() const {return m_LastEnqueueTime;} + Time& getLastEnqueueTime() {return m_LastEnqueueTime;} + + const Time& getTime() const { return m_time; } + void setTime(const Time& new_time) { m_time = new_time; } + + private: + Time m_time; + Time m_LastEnqueueTime; // my last enqueue time + int m_DelayedCycles; // my delayed cycles }; -// Output operator declaration -std::ostream& operator<<(std::ostream& out, const Message& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -std::ostream& operator<<(std::ostream& out, const Message& obj) +inline std::ostream& +operator<<(std::ostream& out, const Message& obj) { - obj.print(out); - out << std::flush; - return out; + obj.print(out); + out << std::flush; + return out; } -#endif //MESSAGE_H +#endif // __MEM_RUBY_SLICC_INTERFACE_MESSAGE_HH__ diff --git a/src/mem/ruby/slicc_interface/NetworkMessage.hh b/src/mem/ruby/slicc_interface/NetworkMessage.hh index 150fd70fc..8a7c00094 100644 --- a/src/mem/ruby/slicc_interface/NetworkMessage.hh +++ b/src/mem/ruby/slicc_interface/NetworkMessage.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,89 +26,69 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * NetworkMessage.hh - * - * Description: - * - * $Id$ - * - */ - -#ifndef NetworkMessage_H -#define NetworkMessage_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_NETWORKMESSAGE_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_NETWORKMESSAGE_HH__ -#include "mem/ruby/common/Global.hh" #include "mem/gems_common/RefCnt.hh" #include "mem/gems_common/RefCountable.hh" -#include "mem/ruby/slicc_interface/Message.hh" #include "mem/protocol/MessageSizeType.hh" +#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/NetDest.hh" +#include "mem/ruby/slicc_interface/Message.hh" class Address; class NetworkMessage; typedef RefCnt<NetworkMessage> NetMsgPtr; -class NetworkMessage : public Message { -public: - // Constructors - NetworkMessage() - :Message() +class NetworkMessage : public Message +{ + public: + NetworkMessage() + : Message() { - m_internal_dest_valid = false; + m_internal_dest_valid = false; } - // Destructor - virtual ~NetworkMessage() { } + virtual ~NetworkMessage() { } - // Public Methods + virtual const NetDest& getDestination() const = 0; + virtual NetDest& getDestination() = 0; + virtual const MessageSizeType& getMessageSize() const = 0; + virtual MessageSizeType& getMessageSize() = 0; - virtual const NetDest& getDestination() const = 0; - virtual NetDest& getDestination() = 0; - virtual const MessageSizeType& getMessageSize() const = 0; - virtual MessageSizeType& getMessageSize() = 0; - // virtual const Address& getAddress() const = 0; - // virtual Address& getAddress() = 0; + const NetDest& + getInternalDestination() const + { + if (m_internal_dest_valid == false) + return getDestination(); - const NetDest& getInternalDestination() const { - if (m_internal_dest_valid == false) { - return getDestination(); - } else { - return m_internal_dest; + return m_internal_dest; } - } - NetDest& getInternalDestination() { - if (m_internal_dest_valid == false) { - m_internal_dest = getDestination(); - m_internal_dest_valid = true; + NetDest& + getInternalDestination() + { + if (m_internal_dest_valid == false) { + m_internal_dest = getDestination(); + m_internal_dest_valid = true; + } + return m_internal_dest; } - return m_internal_dest; - } - - virtual void print(ostream& out) const = 0; -private: - // Private Methods + virtual void print(ostream& out) const = 0; - // Data Members (m_ prefix) - NetDest m_internal_dest; - bool m_internal_dest_valid; + private: + NetDest m_internal_dest; + bool m_internal_dest_valid; }; -// Output operator declaration -ostream& operator<<(ostream& out, const NetworkMessage& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const NetworkMessage& obj) +inline ostream& +operator<<(ostream& out, const NetworkMessage& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << flush; + return out; } -#endif //NetworkMessage_H +#endif // __MEM_RUBY_SLICC_INTERFACE_NETWORKMESSAGE_HH__ diff --git a/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.cc b/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.cc index 0821201e7..79b9821ba 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.cc +++ b/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.cc @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,7 +26,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh" #include "mem/ruby/system/CacheMemory.hh" diff --git a/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh b/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh index 5ffd0f295..c96667028 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,22 +26,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * $Id$ - */ - -#ifndef COMPONENTMAPPINGFNS_H -#define COMPONENTMAPPINGFNS_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_COMPONENTMAPPINGS_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_COMPONENTMAPPINGS_HH__ -#include "mem/ruby/common/Global.hh" -#include "mem/ruby/system/NodeID.hh" -#include "mem/ruby/system/MachineID.hh" +#include "mem/protocol/GenericMachineType.hh" +#include "mem/protocol/MachineType.hh" #include "mem/ruby/common/Address.hh" -#include "mem/ruby/common/Set.hh" +#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/NetDest.hh" -#include "mem/protocol/GenericMachineType.hh" +#include "mem/ruby/common/Set.hh" #include "mem/ruby/system/DirectoryMemory.hh" -#include "mem/protocol/MachineType.hh" +#include "mem/ruby/system/MachineID.hh" +#include "mem/ruby/system/NodeID.hh" #ifdef MACHINETYPE_L1Cache #define MACHINETYPE_L1CACHE_ENUM MachineType_L1Cache @@ -70,88 +65,100 @@ // used to determine the home directory // returns a value between 0 and total_directories_within_the_system -inline -NodeID map_Address_to_DirectoryNode(const Address& addr) +inline NodeID +map_Address_to_DirectoryNode(const Address& addr) { - return DirectoryMemory::mapAddressToDirectoryVersion(addr); + return DirectoryMemory::mapAddressToDirectoryVersion(addr); } // used to determine the home directory // returns a value between 0 and total_directories_within_the_system -inline -MachineID map_Address_to_Directory(const Address &addr) +inline MachineID +map_Address_to_Directory(const Address &addr) { - MachineID mach = {MachineType_Directory, map_Address_to_DirectoryNode(addr)}; - return mach; + MachineID mach = + {MachineType_Directory, map_Address_to_DirectoryNode(addr)}; + return mach; } -inline -MachineID map_Address_to_DMA(const Address & addr) +inline MachineID +map_Address_to_DMA(const Address & addr) { - MachineID dma = {MACHINETYPE_DMA_ENUM, 0}; - return dma; + MachineID dma = {MACHINETYPE_DMA_ENUM, 0}; + return dma; } -inline -NetDest broadcast(MachineType type) +inline NetDest +broadcast(MachineType type) { - NetDest dest; - for (int i=0; i<MachineType_base_count(type); i++) { - MachineID mach = {type, i}; - dest.add(mach); - } - return dest; + NetDest dest; + for (int i = 0; i < MachineType_base_count(type); i++) { + MachineID mach = {type, i}; + dest.add(mach); + } + return dest; } -inline -MachineID mapAddressToRange(const Address & addr, MachineType type, int low_bit, int num_bits) +inline MachineID +mapAddressToRange(const Address & addr, MachineType type, int low_bit, + int num_bits) { - MachineID mach = {type, 0}; - if (num_bits == 0) + MachineID mach = {type, 0}; + if (num_bits == 0) + return mach; + mach.num = addr.bitSelect(low_bit, low_bit + num_bits - 1); return mach; - mach.num = addr.bitSelect(low_bit, low_bit+num_bits-1); - return mach; } -extern inline NodeID machineIDToNodeID(MachineID machID) +inline NodeID +machineIDToNodeID(MachineID machID) { - return machID.num; + return machID.num; } -extern inline MachineType machineIDToMachineType(MachineID machID) +inline MachineType +machineIDToMachineType(MachineID machID) { - return machID.type; + return machID.type; } -extern inline NodeID L1CacheMachIDToProcessorNum(MachineID machID) +inline NodeID +L1CacheMachIDToProcessorNum(MachineID machID) { - assert(machID.type == MachineType_L1Cache); - return machID.num; + assert(machID.type == MachineType_L1Cache); + return machID.num; } -extern inline MachineID getL1MachineID(NodeID L1RubyNode) +inline MachineID +getL1MachineID(NodeID L1RubyNode) { - MachineID mach = {MACHINETYPE_L1CACHE_ENUM, L1RubyNode}; - return mach; + MachineID mach = {MACHINETYPE_L1CACHE_ENUM, L1RubyNode}; + return mach; } -extern inline GenericMachineType ConvertMachToGenericMach(MachineType machType) { - if (machType == MACHINETYPE_L1CACHE_ENUM) { - return GenericMachineType_L1Cache; - } else if (machType == MACHINETYPE_L2CACHE_ENUM) { - return GenericMachineType_L2Cache; - } else if (machType == MACHINETYPE_L3CACHE_ENUM) { - return GenericMachineType_L3Cache; - } else if (machType == MachineType_Directory) { - return GenericMachineType_Directory; - } else { +inline GenericMachineType +ConvertMachToGenericMach(MachineType machType) +{ + if (machType == MACHINETYPE_L1CACHE_ENUM) + return GenericMachineType_L1Cache; + + if (machType == MACHINETYPE_L2CACHE_ENUM) + return GenericMachineType_L2Cache; + + if (machType == MACHINETYPE_L3CACHE_ENUM) + return GenericMachineType_L3Cache; + + if (machType == MachineType_Directory) + return GenericMachineType_Directory; + ERROR_MSG("cannot convert to a GenericMachineType"); return GenericMachineType_NULL; - } } -extern inline int machineCount(MachineType machType) { +inline int +machineCount(MachineType machType) +{ return MachineType_base_count(machType); } -#endif // COMPONENTMAPPINGFNS_H +#endif // __MEM_RUBY_SLICC_INTERFACE_COMPONENTMAPPINGS_HH__ diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.cc b/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.cc index 54d38c187..6ffc7fdb4 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.cc +++ b/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.cc @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,66 +26,75 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * slicc_util.cc - * - * Description: See slicc_util.hh - * - * $Id$ - * - */ - +#include "mem/protocol/Protocol.hh" #include "mem/ruby/common/Global.hh" -#include "mem/ruby/system/System.hh" -#include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/profiler/AddressProfiler.hh" -#include "mem/protocol/Protocol.hh" -#include "mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh" +#include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh" -// #include "TransactionInterfaceManager.hh" +#include "mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh" +#include "mem/ruby/system/System.hh" -void profile_request(int cache_state, Directory_State directory_state, GenericRequestType request_type) +void +profile_request(int cache_state, Directory_State directory_state, + GenericRequestType request_type) { - string requestStr = L1Cache_State_to_string(L1Cache_State(cache_state))+":"+ - Directory_State_to_string(directory_state)+":"+ - GenericRequestType_to_string(request_type); - g_system_ptr->getProfiler()->profileRequest(requestStr); + string requestStr = L1Cache_State_to_string(L1Cache_State(cache_state))+ + ":" + + Directory_State_to_string(directory_state) + ":" + + GenericRequestType_to_string(request_type); + g_system_ptr->getProfiler()->profileRequest(requestStr); } -void profile_request(const string& L1CacheState, const string& L2CacheState, const string& directoryState, const string& requestType) +void +profile_request(const string& L1CacheState, const string& L2CacheState, + const string& directoryState, const string& requestType) { - string requestStr = L1CacheState+":"+L2CacheState+":"+directoryState+":"+requestType; - g_system_ptr->getProfiler()->profileRequest(requestStr); + string requestStr = L1CacheState + ":" + L2CacheState + ":" + + directoryState + ":" + requestType; + + g_system_ptr->getProfiler()->profileRequest(requestStr); } -void profile_outstanding_request(int outstanding) +void +profile_outstanding_request(int outstanding) { - g_system_ptr->getProfiler()->profileOutstandingRequest(outstanding); + g_system_ptr->getProfiler()->profileOutstandingRequest(outstanding); } -void profile_average_latency_estimate(int latency) +void +profile_average_latency_estimate(int latency) { - g_system_ptr->getProfiler()->profileAverageLatencyEstimate(latency); + g_system_ptr->getProfiler()->profileAverageLatencyEstimate(latency); } -void profile_sharing(const Address& addr, AccessType type, NodeID requestor, const Set& sharers, const Set& owner) +void +profile_sharing(const Address& addr, AccessType type, NodeID requestor, + const Set& sharers, const Set& owner) { - g_system_ptr->getProfiler()->profileSharing(addr, type, requestor, sharers, owner); + g_system_ptr->getProfiler()-> + profileSharing(addr, type, requestor, sharers, owner); } -void profileMsgDelay(int virtualNetwork, int delayCycles) +void +profileMsgDelay(int virtualNetwork, int delayCycles) { - g_system_ptr->getProfiler()->profileMsgDelay(virtualNetwork, delayCycles); + g_system_ptr->getProfiler()->profileMsgDelay(virtualNetwork, delayCycles); } -void profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor) +void +profileGetX(const Address& datablock, const Address& PC, const Set& owner, + const Set& sharers, NodeID requestor) { - g_system_ptr->getProfiler()->getAddressProfiler()->profileGetX(datablock, PC, owner, sharers, requestor); + g_system_ptr->getProfiler()->getAddressProfiler()-> + profileGetX(datablock, PC, owner, sharers, requestor); } -void profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor) +void +profileGetS(const Address& datablock, const Address& PC, const Set& owner, + const Set& sharers, NodeID requestor) { - g_system_ptr->getProfiler()->getAddressProfiler()->profileGetS(datablock, PC, owner, sharers, requestor); + g_system_ptr->getProfiler()->getAddressProfiler()-> + profileGetS(datablock, PC, owner, sharers, requestor); } diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh b/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh index 1529e6317..25495b6fa 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -28,36 +27,37 @@ */ /* - * slicc_util.hh - * - * Description: These are the functions that exported to slicc from ruby. - * - * $Id$ - * + * These are the functions that exported to slicc from ruby. */ -#ifndef RUBYSLICC_PROFILER_INTERFACE_H -#define RUBYSLICC_PROFILER_INTERFACE_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_PROFILER_INTERFACE_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_PROFILER_INTERFACE_HH__ -#include "mem/ruby/common/Global.hh" -#include "mem/ruby/profiler/Profiler.hh" -#include "mem/ruby/common/Address.hh" -#include "mem/protocol/L1Cache_State.hh" #include "mem/protocol/AccessType.hh" -#include "mem/protocol/GenericRequestType.hh" #include "mem/protocol/Directory_State.hh" +#include "mem/protocol/GenericRequestType.hh" +#include "mem/protocol/L1Cache_State.hh" +#include "mem/ruby/common/Address.hh" +#include "mem/ruby/common/Global.hh" +#include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/system/NodeID.hh" class Set; -void profile_request(int cache_state, Directory_State directory_state, GenericRequestType request_type); +void profile_request(int cache_state, Directory_State directory_state, + GenericRequestType request_type); void profile_outstanding_persistent_request(int outstanding); void profile_outstanding_request(int outstanding); -void profile_sharing(const Address& addr, AccessType type, NodeID requestor, const Set& sharers, const Set& owner); -void profile_request(const string& L1CacheStateStr, const string& L2CacheStateStr, const string& directoryStateStr, const string& requestTypeStr); +void profile_sharing(const Address& addr, AccessType type, NodeID requestor, + const Set& sharers, const Set& owner); +void profile_request(const string& L1CacheStateStr, + const string& L2CacheStateStr, + const string& directoryStateStr, + const string& requestTypeStr); void profile_miss(const CacheMsg& msg, NodeID id); void profile_L1Cache_miss(const CacheMsg& msg, NodeID id); -void profile_L2Cache_miss(GenericRequestType requestType, AccessModeType type, int msgSize, PrefetchBit pfBit, NodeID l2cacheID); +void profile_L2Cache_miss(GenericRequestType requestType, AccessModeType type, + int msgSize, PrefetchBit pfBit, NodeID l2cacheID); void profile_token_retry(const Address& addr, AccessType type, int count); void profile_filter_action(int action); void profile_persistent_prediction(const Address& addr, AccessType type); @@ -65,9 +65,11 @@ void profile_average_latency_estimate(int latency); void profileMsgDelay(int virtualNetwork, int delayCycles); void profile_multicast_retry(const Address& addr, int count); -void profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor); -void profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor); +void profileGetX(const Address& datablock, const Address& PC, const Set& owner, + const Set& sharers, NodeID requestor); +void profileGetS(const Address& datablock, const Address& PC, const Set& owner, + const Set& sharers, NodeID requestor); void profileOverflow(const Address & addr, MachineID mach); -#endif // RUBYSLICC_PROFILER_INTERFACE_H +#endif // __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_PROFILER_INTERFACE_HH__ diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh index 3d4fa3e5c..24240dc52 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -28,149 +27,163 @@ */ /* - * slicc_util.hh - * - * Description: These are the functions that exported to slicc from ruby. - * - * $Id$ - * + * These are the functions that exported to slicc from ruby. */ -#ifndef SLICC_UTIL_H -#define SLICC_UTIL_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYSLICCUTIL_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_RUBYSLICCUTIL_HH__ -#include "mem/ruby/common/Global.hh" -#include "mem/ruby/common/Address.hh" -#include "mem/ruby/system/NodeID.hh" -#include "mem/ruby/system/MachineID.hh" +#include "mem/protocol/AccessType.hh" #include "mem/protocol/CacheMsg.hh" -#include "mem/protocol/GenericRequestType.hh" #include "mem/protocol/CacheRequestType.hh" -#include "mem/protocol/AccessType.hh" -#include "mem/protocol/MachineType.hh" #include "mem/protocol/Directory_State.hh" +#include "mem/protocol/GenericRequestType.hh" #include "mem/protocol/L1Cache_State.hh" +#include "mem/protocol/MachineType.hh" #include "mem/protocol/MessageSizeType.hh" -#include "mem/ruby/network/Network.hh" #include "mem/protocol/PrefetchBit.hh" -#include "mem/ruby/system/System.hh" - +#include "mem/ruby/common/Address.hh" +#include "mem/ruby/common/Global.hh" +#include "mem/ruby/network/Network.hh" #include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh" +#include "mem/ruby/system/MachineID.hh" +#include "mem/ruby/system/NodeID.hh" +#include "mem/ruby/system/System.hh" class Set; class NetDest; -extern inline int random(int n) +inline int +random(int n) { return random() % n; } -extern inline bool multicast_retry() +inline bool +multicast_retry() { - if (RubySystem::getRandomization()) { - return (random() & 0x1); - } else { - return true; - } + if (RubySystem::getRandomization()) { + return (random() & 0x1); + } else { + return true; + } } -extern inline int cache_state_to_int(L1Cache_State state) +inline int +cache_state_to_int(L1Cache_State state) { - return state; + return state; } -extern inline Time get_time() +inline Time +get_time() { - return g_eventQueue_ptr->getTime(); + return g_eventQueue_ptr->getTime(); } -extern inline Time zero_time() +inline Time +zero_time() { - return 0; + return 0; } -extern inline NodeID intToID(int nodenum) +inline NodeID +intToID(int nodenum) { - NodeID id = nodenum; - return id; + NodeID id = nodenum; + return id; } -extern inline int IDToInt(NodeID id) +inline int +IDToInt(NodeID id) { - int nodenum = id; - return nodenum; + int nodenum = id; + return nodenum; } -extern inline int addressToInt(Address addr) +inline int +addressToInt(Address addr) { - return (int) addr.getLineAddress(); + return (int)addr.getLineAddress(); } -extern inline bool long_enough_ago(Time event) +inline bool +long_enough_ago(Time event) { - return ((get_time() - event) > 200); + return ((get_time() - event) > 200); } -extern inline int getAddThenMod(int addend1, int addend2, int modulus) +inline int +getAddThenMod(int addend1, int addend2, int modulus) { - return (addend1 + addend2) % modulus; + return (addend1 + addend2) % modulus; } -extern inline Time getTimeModInt(Time time, int modulus) +inline Time +getTimeModInt(Time time, int modulus) { - return time % modulus; + return time % modulus; } -extern inline Time getTimePlusInt(Time addend1, int addend2) +inline Time +getTimePlusInt(Time addend1, int addend2) { - return (Time) addend1 + addend2; + return (Time) addend1 + addend2; } -extern inline Time getTimeMinusTime(Time t1, Time t2) +inline Time +getTimeMinusTime(Time t1, Time t2) { - ASSERT(t1 >= t2); - return t1 - t2; + ASSERT(t1 >= t2); + return t1 - t2; } -extern inline Time getPreviousDelayedCycles(Time t1, Time t2) +inline Time +getPreviousDelayedCycles(Time t1, Time t2) { - if (RubySystem::getRandomization()) { // when randomizing delayed - return 0; - } else { - return getTimeMinusTime(t1, t2); - } + if (RubySystem::getRandomization()) { // when randomizing delayed + return 0; + } else { + return getTimeMinusTime(t1, t2); + } } -extern inline void WARN_ERROR_TIME(Time time) +inline void +WARN_ERROR_TIME(Time time) { - WARN_EXPR(time); + WARN_EXPR(time); } -// Return type for time_to_int is "Time" and not "int" so we get a 64-bit integer -extern inline Time time_to_int(Time time) +// Return type for time_to_int is "Time" and not "int" so we get a +// 64-bit integer +inline Time +time_to_int(Time time) { - return time; + return time; } // Appends an offset to an address -extern inline Address setOffset(Address addr, int offset) +inline Address +setOffset(Address addr, int offset) { - Address result = addr; - result.setOffset(offset); - return result; + Address result = addr; + result.setOffset(offset); + return result; } // Makes an address into a line address -extern inline Address makeLineAddress(Address addr) +inline Address +makeLineAddress(Address addr) { - Address result = addr; - result.makeLineAddress(); - return result; + Address result = addr; + result.makeLineAddress(); + return result; } -extern inline int addressOffset(Address addr) +inline int +addressOffset(Address addr) { - return addr.getOffset(); + return addr.getOffset(); } -#endif //SLICC_UTIL_H +#endif // __MEM_RUBY_SLICC_INTERFACE_RUBYSLICCUTIL_HH__ diff --git a/src/mem/ruby/slicc_interface/RubySlicc_includes.hh b/src/mem/ruby/slicc_interface/RubySlicc_includes.hh index 76858ddba..ae98b3084 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_includes.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_includes.hh @@ -26,12 +26,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef RUBYSLICC_INCLUDES_H -#define RUBYSLICC_INCLUDES_H +#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_INCLUDES_HH__ +#define __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_INCLUDES_HH__ #include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh" #include "mem/ruby/slicc_interface/RubySlicc_Util.hh" #include "mem/ruby/slicc_interface/RubySlicc_Profiler_interface.hh" -#endif +#endif // __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_INCLUDES_HH__ |