summaryrefslogtreecommitdiff
path: root/src/mem/slicc/symbols
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/slicc/symbols')
-rw-r--r--src/mem/slicc/symbols/StateMachine.py33
-rw-r--r--src/mem/slicc/symbols/Type.py28
2 files changed, 44 insertions, 17 deletions
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py
index 5da42a6d5..e86b4245a 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -196,6 +196,10 @@ class $py_ident(RubyController):
#ifndef ${ident}_CONTROLLER_H
#define ${ident}_CONTROLLER_H
+#include <iostream>
+#include <sstream>
+#include <string>
+
#include "params/$c_ident.hh"
#include "mem/ruby/common/Global.hh"
@@ -214,7 +218,7 @@ class $py_ident(RubyController):
# for adding information to the protocol debug trace
code('''
-extern stringstream ${ident}_transitionComment;
+extern std::stringstream ${ident}_transitionComment;
class $c_ident : public AbstractController {
#ifdef CHECK_COHERENCE
@@ -226,14 +230,14 @@ public:
void init();
MessageBuffer* getMandatoryQueue() const;
const int & getVersion() const;
- const string toString() const;
- const string getName() const;
+ const std::string toString() const;
+ const std::string getName() const;
const MachineType getMachineType() const;
void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
- void print(ostream& out) const;
- void printConfig(ostream& out) const;
+ void print(std::ostream& out) const;
+ void printConfig(std::ostream& out) const;
void wakeup();
- void printStats(ostream& out) const;
+ void printStats(std::ostream& out) const;
void clearStats();
void blockOnQueue(Address addr, MessageBuffer* port);
void unblock(Address addr);
@@ -253,11 +257,11 @@ int m_number_of_TBEs;
TransitionResult doTransition(${ident}_Event event, ${ident}_State state, const Address& addr); // in ${ident}_Transitions.cc
TransitionResult doTransitionWorker(${ident}_Event event, ${ident}_State state, ${ident}_State& next_state, const Address& addr); // in ${ident}_Transitions.cc
-string m_name;
+std::string m_name;
int m_transitions_per_cycle;
int m_buffer_size;
int m_recycle_latency;
-map< string, string > m_cfg;
+map<std::string, std::string> m_cfg;
NodeID m_version;
Network* m_net_ptr;
MachineID m_machineID;
@@ -312,6 +316,9 @@ static int m_num_controllers;
* Created by slicc definition of Module "${{self.short}}"
*/
+#include <sstream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
#include "mem/protocol/${ident}_Controller.hh"
@@ -319,6 +326,8 @@ static int m_num_controllers;
#include "mem/protocol/${ident}_Event.hh"
#include "mem/protocol/Types.hh"
#include "mem/ruby/system/System.hh"
+
+using namespace std;
''')
# include object classes
@@ -863,6 +872,8 @@ if (!%s.areNSlotsAvailable(%s)) {
#ifndef ${ident}_PROFILER_H
#define ${ident}_PROFILER_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/protocol/${ident}_State.hh"
#include "mem/protocol/${ident}_Event.hh"
@@ -873,7 +884,7 @@ class ${ident}_Profiler {
void setVersion(int version);
void countTransition(${ident}_State state, ${ident}_Event event);
void possibleTransition(${ident}_State state, ${ident}_Event event);
- void dumpStats(ostream& out) const;
+ void dumpStats(std::ostream& out) const;
void clearStats();
private:
@@ -935,8 +946,10 @@ void ${ident}_Profiler::possibleTransition(${ident}_State state, ${ident}_Event
{
m_possible[state][event] = true;
}
-void ${ident}_Profiler::dumpStats(ostream& out) const
+void ${ident}_Profiler::dumpStats(std::ostream& out) const
{
+ using namespace std;
+
out << " --- ${ident} " << m_version << " ---" << endl;
out << " - Event Counts -" << endl;
for (int event = 0; event < ${ident}_Event_NUM; event++) {
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py
index 3f39ec208..a13cc2385 100644
--- a/src/mem/slicc/symbols/Type.py
+++ b/src/mem/slicc/symbols/Type.py
@@ -202,6 +202,8 @@ class Type(Symbol):
#ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Allocator.hh"
''')
@@ -323,7 +325,7 @@ ${{dm.type.c_ident}}& get${{dm.ident}}() { return m_${{dm.ident}}; }
void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm.ident}} = local_${{dm.ident}}; }
''')
- code('void print(ostream& out) const;')
+ code('void print(std::ostream& out) const;')
code.dedent()
code(' //private:')
code.indent()
@@ -358,14 +360,14 @@ void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm
code('''
// Output operator declaration
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
// Output operator definition
extern inline
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj)
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
@@ -383,7 +385,11 @@ ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj)
* Auto generated C++ code started by $__file__:$__line__
*/
+#include <iostream>
+
#include "mem/protocol/${{self.c_ident}}.hh"
+
+using namespace std;
''')
if self.isMessage:
@@ -421,6 +427,9 @@ void ${{self.c_ident}}::print(ostream& out) const
#ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
/** \\enum ${{self.c_ident}}
@@ -443,8 +452,8 @@ enum ${{self.c_ident}} {
code('''
${{self.c_ident}}_NUM
};
-${{self.c_ident}} string_to_${{self.c_ident}}(const string& str);
-string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
+${{self.c_ident}} string_to_${{self.c_ident}}(const std::string& str);
+std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
${{self.c_ident}} &operator++(${{self.c_ident}} &e);
''')
@@ -462,7 +471,7 @@ int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
# Trailer
code('''
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
#endif // ${{self.c_ident}}_H
''')
@@ -477,8 +486,13 @@ ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
* Auto generated C++ code started by $__file__:$__line__
*/
+#include <iostream>
+#include <string>
+
#include "mem/protocol/${{self.c_ident}}.hh"
+using namespace std;
+
''')
if self.isMachineType: