summaryrefslogtreecommitdiff
path: root/src/mem/ruby/tester/XactRequestGenerator.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2009-05-11 10:38:43 -0700
committerNathan Binkert <nate@binkert.org>2009-05-11 10:38:43 -0700
commit2f30950143cc70bc42a3c8a4111d7cf8198ec881 (patch)
tree708f6c22edb3c6feb31dd82866c26623a5329580 /src/mem/ruby/tester/XactRequestGenerator.hh
parentc70241810d4e4f523f173c1646b008dc40faad8e (diff)
downloadgem5-2f30950143cc70bc42a3c8a4111d7cf8198ec881.tar.xz
ruby: Import ruby and slicc from GEMS
We eventually plan to replace the m5 cache hierarchy with the GEMS hierarchy, but for now we will make both live alongside eachother.
Diffstat (limited to 'src/mem/ruby/tester/XactRequestGenerator.hh')
-rw-r--r--src/mem/ruby/tester/XactRequestGenerator.hh134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/mem/ruby/tester/XactRequestGenerator.hh b/src/mem/ruby/tester/XactRequestGenerator.hh
new file mode 100644
index 000000000..826a257ce
--- /dev/null
+++ b/src/mem/ruby/tester/XactRequestGenerator.hh
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 1999 by Mark Hill and David Wood for the Wisconsin
+ * Multifacet Project. ALL RIGHTS RESERVED.
+ *
+ * ##HEADER##
+ *
+ * This software is furnished under a license and may be used and
+ * copied only in accordance with the terms of such license and the
+ * inclusion of the above copyright notice. This software or any
+ * other copies thereof or any derivative works may not be provided or
+ * otherwise made available to any other persons. Title to and
+ * ownership of the software is retained by Mark Hill and David Wood.
+ * Any use of this software must include the above copyright notice.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS". THE LICENSOR MAKES NO
+ * WARRANTIES ABOUT ITS CORRECTNESS OR PERFORMANCE.
+ * */
+
+/*
+ * $Id: XactRequestGenerator.h 1.4 05/07/07 10:35:32-05:00 kmoore@s0-30.cs.wisc.edu $
+ *
+ * Description:
+ *
+ */
+
+#ifndef XACTREQUESTGENERATOR_H
+#define XACTREQUESTGENERATOR_H
+
+#include "global.hh"
+#include "RequestGenerator.hh"
+#include "Consumer.hh"
+#include "NodeID.hh"
+#include "Address.hh"
+#include "TransactionManager.hh"
+
+class Sequencer;
+class SubBlock;
+class SyntheticDriver;
+class Instruction;
+class TransactionManager;
+
+#define MAX_ADDRESS 16777216
+const int TESTER_MAX_DEPTH = 16;
+
+enum XactRequestGeneratorStatus {
+ XactRequestGeneratorStatus_Waiting,
+ XactRequestGeneratorStatus_Ready,
+ XactRequestGeneratorStatus_Blocked,
+ XactRequestGeneratorStatus_Aborted,
+ XactRequestGeneratorStatus_Done
+};
+
+class XactRequestGenerator : public RequestGenerator {
+public:
+ // Constructors
+ XactRequestGenerator(NodeID node, SyntheticDriver& driver);
+
+ // Destructor
+ ~XactRequestGenerator();
+
+ // Public Methods
+ void wakeup();
+ void performCallback(NodeID proc, SubBlock& data);
+ void abortTransaction();
+
+ void print(ostream& out) const;
+
+ // For dealing with NACKs/retries
+ void notifySendNack(const Address & addr, uint64 remote_timestamp, const MachineID & remote_id);
+ void notifyReceiveNack(const Address & addr, uint64 remote_timestamp, const MachineID & remote_id);
+ void notifyReceiveNackFinal(const Address & addr);
+private:
+ // Private Methods
+ int thinkTime() const;
+ int waitTime() const;
+ int holdTime() const;
+ void initiateBeginTransaction();
+ void initiateStore(Address a);
+ void initiateCommit();
+ void initiateInc(Address a);
+ void initiateLoad(Address a);
+ void initiateDone();
+ void pickAddress();
+ Sequencer* sequencer() const;
+ TransactionManager* transactionManager() const;
+ void execute();
+ void scheduleEvent(int time);
+ void checkCorrectness();
+
+ // Private copy constructor and assignment operator
+ XactRequestGenerator(const XactRequestGenerator& obj);
+ XactRequestGenerator& operator=(const XactRequestGenerator& obj);
+
+ void newTransaction(bool init);
+ void printPcStack(int depth);
+
+ // Data Members (m_ prefix)
+ SyntheticDriver& m_driver;
+ NodeID m_node;
+ XactRequestGeneratorStatus m_status;
+ int m_counter;
+ int m_size;
+ Time m_last_transition;
+ Address m_address;
+
+ Instruction *m_instructions;
+ int m_pc;
+ int pc_stack[TESTER_MAX_DEPTH];
+ bool m_transaction;
+ uint8 m_register;
+ uint8 * testArray;
+ //static uint8 dataArray[];
+ bool m_eventPending;
+
+ // for pending aborts
+ bool m_abortPending;
+};
+
+// Output operator declaration
+ostream& operator<<(ostream& out, const XactRequestGenerator& obj);
+
+// ******************* Definitions *******************
+
+// Output operator definition
+extern inline
+ostream& operator<<(ostream& out, const XactRequestGenerator& obj)
+{
+ obj.print(out);
+ out << flush;
+ return out;
+}
+
+#endif //XACTREQUESTGENERATOR_H
+