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/RubySlicc_ComponentMapping.hh | |
parent | 2620e08722b38660658d46cdb76c337db18e877c (diff) | |
download | gem5-5ab13e2deb8f904ef2a233749193fa09ea7013c4.tar.xz |
ruby: style pass
Diffstat (limited to 'src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh')
-rw-r--r-- | src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh | 129 |
1 files changed, 68 insertions, 61 deletions
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__ |