SeriesRequestGenerator.hh revision 6386
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/*
30 * $Id$
31 *
32 * Description:
33 *
34 */
35
36// This Deterministic Generator generates GETX requests for all nodes in the system
37// The GETX requests are generated one at a time in round-robin fashion 0...1...2...etc.
38
39#ifndef DETERMGETXGENERATOR_H
40#define DETERMGETXGENERATOR_H
41
42#include "mem/ruby/tester/Tester_Globals.hh"
43#include "mem/ruby/common/Consumer.hh"
44#include "mem/protocol/DetermGETXGeneratorStatus.hh"
45#include "mem/ruby/tester/SpecifiedGenerator.hh"
46#include "mem/ruby/common/Global.hh"
47#include "mem/ruby/common/Address.hh"
48
49class DeterministicDriver;
50class DMAController;
51
52class DetermGETXGenerator : public SpecifiedGenerator {
53public:
54  // Constructors
55  DetermGETXGenerator(NodeID node, DeterministicDriver * driver);
56
57  // Destructor
58  ~DetermGETXGenerator();
59
60  // Public Methods
61  void wakeup();
62  void performCallback(NodeID proc, Address address);
63
64  void print(ostream& out) const;
65private:
66  // Private Methods
67  int thinkTime() const;
68  int waitTime() const;
69  void initiateStore();
70  void initiateDMA();
71  void pickAddress();
72
73  DMAController* dma() const;
74
75  // copy constructor and assignment operator
76  DetermGETXGenerator(const DetermGETXGenerator& obj);
77  DetermGETXGenerator& operator=(const DetermGETXGenerator& obj);
78
79  DeterministicDriver * parent_driver;
80  // Data Members (m_ prefix)
81  DetermGETXGeneratorStatus m_status;
82  int m_counter;
83  bool issued_load;
84  Address m_address;
85  NodeID m_node;
86  long int counter;
87  Time m_last_transition;
88};
89
90// Output operator declaration
91ostream& operator<<(ostream& out, const DetermGETXGenerator& obj);
92
93// ******************* Definitions *******************
94
95// Output operator definition
96extern inline
97ostream& operator<<(ostream& out, const DetermGETXGenerator& obj)
98{
99  obj.print(out);
100  out << flush;
101  return out;
102}
103
104#endif //DETERMGETXGENERATOR_H
105
106