gem5  v21.1.0.2
NetDest.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_COMMON_NETDEST_HH__
30 #define __MEM_RUBY_COMMON_NETDEST_HH__
31 
32 #include <iostream>
33 #include <vector>
34 
35 #include "mem/ruby/common/Set.hh"
37 
38 namespace gem5
39 {
40 
41 namespace ruby
42 {
43 
44 // NetDest specifies the network destination of a Message
45 class NetDest
46 {
47  public:
48  // Constructors
49  // creates and empty set
50  NetDest();
51  explicit NetDest(int bit_size);
52 
53  NetDest& operator=(const Set& obj);
54 
56  { }
57 
58  void add(MachineID newElement);
59  void addNetDest(const NetDest& netDest);
60  void setNetDest(MachineType machine, const Set& set);
61  void remove(MachineID oldElement);
62  void removeNetDest(const NetDest& netDest);
63  void clear();
64  void broadcast();
65  void broadcast(MachineType machine);
66  int count() const;
67  bool isEqual(const NetDest& netDest) const;
68 
69  // return the logical OR of this netDest and orNetDest
70  NetDest OR(const NetDest& orNetDest) const;
71 
72  // return the logical AND of this netDest and andNetDest
73  NetDest AND(const NetDest& andNetDest) const;
74 
75  // Returns true if the intersection of the two netDests is non-empty
76  bool intersectionIsNotEmpty(const NetDest& other_netDest) const;
77 
78  // Returns true if the intersection of the two netDests is empty
79  bool intersectionIsEmpty(const NetDest& other_netDest) const;
80 
81  bool isSuperset(const NetDest& test) const;
82  bool isSubset(const NetDest& test) const { return test.isSuperset(*this); }
83  bool isElement(MachineID element) const;
84  bool isBroadcast() const;
85  bool isEmpty() const;
86 
87  // For Princeton Network
89 
90  MachineID smallestElement() const;
91  MachineID smallestElement(MachineType machine) const;
92 
93  void resize();
94  int getSize() const { return m_bits.size(); }
95 
96  // get element for a index
98 
99  void print(std::ostream& out) const;
100 
101  private:
102  // returns a value >= MachineType_base_level("this machine")
103  // and < MachineType_base_level("next highest machine")
104  int
106  {
107  int vec_index = MachineType_base_level(m.type);
108  assert(vec_index < m_bits.size());
109  return vec_index;
110  }
111 
112  NodeID bitIndex(NodeID index) const { return index; }
113 
114  std::vector<Set> m_bits; // a vector of bit vectors - i.e. Sets
115 };
116 
117 inline std::ostream&
118 operator<<(std::ostream& out, const NetDest& obj)
119 {
120  obj.print(out);
121  out << std::flush;
122  return out;
123 }
124 
125 } // namespace ruby
126 } // namespace gem5
127 
128 #endif // __MEM_RUBY_COMMON_NETDEST_HH__
MachineID.hh
gem5::ruby::NetDest::addNetDest
void addNetDest(const NetDest &netDest)
Definition: NetDest.cc:52
gem5::ruby::NetDest::AND
NetDest AND(const NetDest &andNetDest) const
Definition: NetDest.cc:210
gem5::ruby::NetDest::isEmpty
bool isEmpty() const
Definition: NetDest.cc:186
gem5::ruby::NetDest::getSize
int getSize() const
Definition: NetDest.hh:94
gem5::ruby::NetDest::elementAt
NodeID elementAt(MachineID index)
Definition: NetDest.cc:138
gem5::ruby::Set
Definition: Set.hh:48
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
test
Definition: test.h:38
gem5::ruby::operator<<
std::ostream & operator<<(std::ostream &os, const BoolVec &myvector)
Definition: BoolVec.cc:49
gem5::ruby::NetDest::operator=
NetDest & operator=(const Set &obj)
std::vector
STL vector class.
Definition: stl.hh:37
gem5::ruby::NetDest::bitIndex
NodeID bitIndex(NodeID index) const
Definition: NetDest.hh:112
gem5::ruby::NetDest::isEqual
bool isEqual(const NetDest &netDest) const
Definition: NetDest.cc:278
gem5::ruby::NetDest::removeNetDest
void removeNetDest(const NetDest &netDest)
Definition: NetDest.cc:76
gem5::ruby::NetDest::smallestElement
MachineID smallestElement() const
Definition: NetDest.cc:144
gem5::ruby::NetDest::OR
NetDest OR(const NetDest &orNetDest) const
Definition: NetDest.cc:198
gem5::ruby::NetDest::m_bits
std::vector< Set > m_bits
Definition: NetDest.hh:114
gem5::ruby::NetDest::print
void print(std::ostream &out) const
Definition: NetDest.cc:264
gem5::ruby::NetDest::clear
void clear()
Definition: NetDest.cc:85
gem5::ruby::NetDest::getAllDest
std::vector< NodeID > getAllDest()
Definition: NetDest.cc:112
gem5::ruby::NetDest::broadcast
void broadcast()
Definition: NetDest.cc:93
gem5::ruby::NetDest::count
int count() const
Definition: NetDest.cc:128
gem5::ruby::NetDest::remove
void remove(MachineID oldElement)
Definition: NetDest.cc:70
gem5::ruby::NetDest::isSuperset
bool isSuperset(const NetDest &test) const
Definition: NetDest.cc:234
Set.hh
gem5::ruby::NetDest::isSubset
bool isSubset(const NetDest &test) const
Definition: NetDest.hh:82
gem5::ruby::NetDest::~NetDest
~NetDest()
Definition: NetDest.hh:55
gem5::ruby::NetDest
Definition: NetDest.hh:45
gem5::ruby::NetDest::NetDest
NetDest()
Definition: NetDest.cc:39
gem5::ArmISA::m
Bitfield< 0 > m
Definition: misc_types.hh:394
gem5::ruby::NetDest::vecIndex
int vecIndex(MachineID m) const
Definition: NetDest.hh:105
gem5::ruby::NetDest::resize
void resize()
Definition: NetDest.cc:253
gem5::ruby::NodeID
unsigned int NodeID
Definition: TypeDefines.hh:40
gem5::ruby::NetDest::isElement
bool isElement(MachineID element) const
Definition: NetDest.cc:247
gem5::ruby::NetDest::add
void add(MachineID newElement)
Definition: NetDest.cc:45
gem5::ruby::NetDest::intersectionIsNotEmpty
bool intersectionIsNotEmpty(const NetDest &other_netDest) const
Definition: NetDest.cc:222
gem5::ruby::NetDest::isBroadcast
bool isBroadcast() const
Definition: NetDest.cc:174
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::MachineID
Definition: MachineID.hh:56
gem5::ruby::NetDest::intersectionIsEmpty
bool intersectionIsEmpty(const NetDest &other_netDest) const
gem5::ruby::NetDest::setNetDest
void setNetDest(MachineType machine, const Set &set)
Definition: NetDest.cc:61

Generated on Tue Sep 21 2021 12:25:40 for gem5 by doxygen 1.8.17