summaryrefslogtreecommitdiff
path: root/src/mem/slicc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/slicc')
-rw-r--r--src/mem/slicc/symbols/StateMachine.py2
-rw-r--r--src/mem/slicc/symbols/Type.py53
2 files changed, 52 insertions, 3 deletions
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py
index fbd090d49..4d3618093 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -1355,7 +1355,7 @@ ${ident}_ProfileDumper::dumpStats(std::ostream& out) const
#include "mem/protocol/${ident}_Event.hh"
#include "mem/protocol/${ident}_State.hh"
-#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/common/TypeDefines.hh"
class ${ident}_Profiler
{
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py
index b41ecc00f..ad00f2ac1 100644
--- a/src/mem/slicc/symbols/Type.py
+++ b/src/mem/slicc/symbols/Type.py
@@ -439,11 +439,16 @@ ${{self.c_ident}}::print(ostream& out) const
#include <iostream>
#include <string>
-#include "mem/ruby/common/Global.hh"
''')
if self.isStateDecl:
code('#include "mem/protocol/AccessPermission.hh"')
+ if self.isMachineType:
+ code('#include "base/misc.hh"')
+ code('#include "mem/protocol/GenericMachineType.hh"')
+ code('#include "mem/ruby/common/Address.hh"')
+ code('struct MachineID;')
+
code('''
// Class definition
@@ -488,7 +493,29 @@ int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
''')
for enum in self.enums.itervalues():
- code('#define MACHINETYPE_${{enum.ident}} 1')
+ if enum.ident == "DMA":
+ code('''
+MachineID map_Address_to_DMA(const Address &addr);
+''')
+ code('''
+
+MachineID get${{enum.ident}}MachineID(NodeID RubyNode);
+''')
+
+ code('''
+inline GenericMachineType
+ConvertMachToGenericMach(MachineType machType)
+{
+''')
+ for enum in self.enums.itervalues():
+ code('''
+ if (machType == MachineType_${{enum.ident}})
+ return GenericMachineType_${{enum.ident}};
+''')
+ code('''
+ panic("cannot convert to a GenericMachineType");
+}
+''')
if self.isStateDecl:
code('''
@@ -550,6 +577,7 @@ AccessPermission ${{self.c_ident}}_to_permission(const ${{self.c_ident}}& obj)
if self.isMachineType:
for enum in self.enums.itervalues():
code('#include "mem/protocol/${{enum.ident}}_Controller.hh"')
+ code('#include "mem/ruby/system/MachineID.hh"')
code('''
// Code for output operator
@@ -723,6 +751,27 @@ ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj)
}
''')
+ for enum in self.enums.itervalues():
+ if enum.ident == "DMA":
+ code('''
+MachineID
+map_Address_to_DMA(const Address &addr)
+{
+ MachineID dma = {MachineType_DMA, 0};
+ return dma;
+}
+''')
+
+ code('''
+
+MachineID
+get${{enum.ident}}MachineID(NodeID RubyNode)
+{
+ MachineID mach = {MachineType_${{enum.ident}}, RubyNode};
+ return mach;
+}
+''')
+
# Write the file
code.write(path, "%s.cc" % self.c_ident)