gem5  v20.1.0.0
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 
35 #include "mem/ruby/protocol/MachineType.hh"
37 
38 inline NetDest
39 broadcast(MachineType type)
40 {
41  NetDest dest;
42  for (NodeID i = 0; i < MachineType_base_count(type); i++) {
43  MachineID mach = {type, i};
44  dest.add(mach);
45  }
46  return dest;
47 }
48 
49 inline MachineID
50 mapAddressToRange(Addr addr, MachineType type, int low_bit,
51  int num_bits, int cluster_id = 0)
52 {
53  MachineID mach = {type, 0};
54  if (num_bits == 0)
55  mach.num = cluster_id;
56  else
57  mach.num = bitSelect(addr, low_bit, low_bit + num_bits - 1)
58  + (1 << num_bits) * cluster_id;
59  return mach;
60 }
61 
62 inline NodeID
64 {
65  return machID.num;
66 }
67 
68 inline MachineType
70 {
71  return machID.type;
72 }
73 
74 inline int
75 machineCount(MachineType machType)
76 {
77  return MachineType_base_count(machType);
78 }
79 
80 inline MachineID
81 createMachineID(MachineType type, NodeID id)
82 {
83  MachineID mach = {type, id};
84  return mach;
85 }
86 
87 inline MachineID
89 {
90  MachineID mach = {type, node};
91  return mach;
92 }
93 
94 #endif // __MEM_RUBY_SLICC_INTERFACE_COMPONENTMAPPINGS_HH__
MachineID.hh
NetDest::add
void add(MachineID newElement)
Definition: NetDest.cc:39
MachineID::type
MachineType type
Definition: MachineID.hh:44
broadcast
NetDest broadcast(MachineType type)
Definition: RubySlicc_ComponentMapping.hh:39
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
MachineTypeAndNodeIDToMachineID
MachineID MachineTypeAndNodeIDToMachineID(MachineType type, NodeID node)
Definition: RubySlicc_ComponentMapping.hh:88
type
uint8_t type
Definition: inet.hh:421
DirectoryMemory.hh
createMachineID
MachineID createMachineID(MachineType type, NodeID id)
Definition: RubySlicc_ComponentMapping.hh:81
MachineID
Definition: MachineID.hh:38
mapAddressToRange
MachineID mapAddressToRange(Addr addr, MachineType type, int low_bit, int num_bits, int cluster_id=0)
Definition: RubySlicc_ComponentMapping.hh:50
bitSelect
Addr bitSelect(Addr addr, unsigned int small, unsigned int big)
Definition: Address.cc:35
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
machineIDToNodeID
NodeID machineIDToNodeID(MachineID machID)
Definition: RubySlicc_ComponentMapping.hh:63
machineIDToMachineType
MachineType machineIDToMachineType(MachineID machID)
Definition: RubySlicc_ComponentMapping.hh:69
Address.hh
machineCount
int machineCount(MachineType machType)
Definition: RubySlicc_ComponentMapping.hh:75
MachineID::num
NodeID num
range: 0 ... number of this machine's components in system - 1
Definition: MachineID.hh:46
addr
ip6_addr_t addr
Definition: inet.hh:423
NodeID
unsigned int NodeID
Definition: TypeDefines.hh:34
NetDest
Definition: NetDest.hh:39
NetDest.hh

Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17