gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RubySlicc_ComponentMapping.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_COMPONENTMAPPINGS_HH__
30 #define __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_COMPONENTMAPPINGS_HH__
31 
32 #include "mem/protocol/MachineType.hh"
37 
38 // used to determine the home directory
39 // returns a value between 0 and total_directories_within_the_system
40 inline NodeID
42 {
44 }
45 
46 inline NodeID
48 {
50 }
51 
52 // used to determine the home directory
53 // returns a value between 0 and total_directories_within_the_system
54 inline MachineID
56 {
57  MachineID mach =
58  {MachineType_Directory, map_Address_to_DirectoryNode(addr)};
59  return mach;
60 }
61 
62 inline MachineID
64 {
65  MachineID mach = {MachineType_RegionDir,
67  return mach;
68 }
69 
70 inline MachineID
72 {
73  MachineID mach =
74  {MachineType_TCCdir, map_Address_to_TCCdirNode(addr)};
75  return mach;
76 }
77 
78 inline NetDest
79 broadcast(MachineType type)
80 {
81  NetDest dest;
82  for (NodeID i = 0; i < MachineType_base_count(type); i++) {
83  MachineID mach = {type, i};
84  dest.add(mach);
85  }
86  return dest;
87 }
88 
89 inline MachineID
90 mapAddressToRange(Addr addr, MachineType type, int low_bit,
91  int num_bits, int cluster_id = 0)
92 {
93  MachineID mach = {type, 0};
94  if (num_bits == 0)
95  mach.num = cluster_id;
96  else
97  mach.num = bitSelect(addr, low_bit, low_bit + num_bits - 1)
98  + (1 << num_bits) * cluster_id;
99  return mach;
100 }
101 
102 inline NodeID
104 {
105  return machID.num;
106 }
107 
108 inline MachineType
110 {
111  return machID.type;
112 }
113 
114 inline int
115 machineCount(MachineType machType)
116 {
117  return MachineType_base_count(machType);
118 }
119 
120 inline MachineID
121 createMachineID(MachineType type, NodeID id)
122 {
123  MachineID mach = {type, id};
124  return mach;
125 }
126 
127 inline MachineID
129 {
130  MachineID mach = {type, node};
131  return mach;
132 }
133 
134 #endif // __MEM_RUBY_SLICC_INTERFACE_COMPONENTMAPPINGS_HH__
Addr bitSelect(Addr addr, unsigned int small, unsigned int big)
Definition: Address.cc:34
Bitfield< 7 > i
Definition: miscregs.hh:1378
ip6_addr_t addr
Definition: inet.hh:335
void add(MachineID newElement)
Definition: NetDest.cc:39
MachineType type
Definition: MachineID.hh:44
MachineID map_Address_to_Directory(Addr addr)
MachineID mapAddressToRange(Addr addr, MachineType type, int low_bit, int num_bits, int cluster_id=0)
MachineID map_Address_to_RegionDir(Addr addr)
unsigned int NodeID
Definition: TypeDefines.hh:34
MachineID MachineTypeAndNodeIDToMachineID(MachineType type, NodeID node)
NodeID machineIDToNodeID(MachineID machID)
int machineCount(MachineType machType)
MachineID map_Address_to_TCCdir(Addr addr)
static uint64_t mapAddressToDirectoryVersion(Addr address)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
type
Definition: misc.hh:728
NodeID map_Address_to_TCCdirNode(Addr addr)
NetDest broadcast(MachineType type)
NodeID map_Address_to_DirectoryNode(Addr addr)
MachineID createMachineID(MachineType type, NodeID id)
NodeID num
range: 0 ... number of this machine's components in system - 1
Definition: MachineID.hh:46
MachineType machineIDToMachineType(MachineID machID)

Generated on Fri Jun 9 2017 13:03:50 for gem5 by doxygen 1.8.6