summaryrefslogtreecommitdiff
path: root/src/mem/slicc
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-06-25 00:32:03 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2013-06-25 00:32:03 -0500
commitbeb6e57c6f6141ad959bb97b49daad7f1fa54af3 (patch)
tree3221c7605fee55dc272fc4ba86ad384db9ad41ca /src/mem/slicc
parentbeee57070a1fecfe4b854af0c525b454a472202f (diff)
downloadgem5-beb6e57c6f6141ad959bb97b49daad7f1fa54af3.tar.xz
ruby: profiler: lots of inter-related changes
The patch started of with removing the global variables from the profiler for profiling the miss latency of requests made to the cache. The corrresponding histograms have been moved to the Sequencer. These are combined together when the histograms are printed. Separate histograms are now maintained for tracking latency of all requests together, of hits only and of misses only. A particular set of histograms used to use the type GenericMachineType defined in one of the protocol files. This patch removes this type. Now, everything that relied on this type would use MachineType instead. To do this, SLICC has been changed so that multiple machine types can be declared by a controller in its preamble.
Diffstat (limited to 'src/mem/slicc')
-rw-r--r--src/mem/slicc/ast/MachineAST.py21
-rw-r--r--src/mem/slicc/parser.py8
-rw-r--r--src/mem/slicc/symbols/Type.py36
3 files changed, 33 insertions, 32 deletions
diff --git a/src/mem/slicc/ast/MachineAST.py b/src/mem/slicc/ast/MachineAST.py
index d494cb7ce..5d14f7688 100644
--- a/src/mem/slicc/ast/MachineAST.py
+++ b/src/mem/slicc/ast/MachineAST.py
@@ -29,10 +29,11 @@ from slicc.ast.DeclAST import DeclAST
from slicc.symbols import StateMachine, Type
class MachineAST(DeclAST):
- def __init__(self, slicc, ident, pairs_ast, config_parameters, decls):
+ def __init__(self, slicc, idents, pairs_ast, config_parameters, decls):
super(MachineAST, self).__init__(slicc, pairs_ast)
- self.ident = ident
+ self.ident = idents[0]
+ self.machine_types = idents
self.pairs_ast = pairs_ast
self.config_parameters = config_parameters
self.decls = decls
@@ -71,10 +72,18 @@ class MachineAST(DeclAST):
def findMachines(self):
# Add to MachineType enumeration
- machine_type = self.symtab.find("MachineType", Type)
- if not machine_type.addEnum(self.ident, self.pairs_ast.pairs):
- self.error("Duplicate machine name: %s:%s" % (machine_type,
- self.ident))
+ for mtype in self.machine_types:
+ machine_type = self.symtab.find("MachineType", Type)
+ pairs = self.pairs_ast.pairs
+
+ if mtype == self.ident:
+ pairs["Primary"] = True
+ else:
+ pairs["Primary"] = False
+
+ if not machine_type.addEnum(mtype, pairs):
+ self.error("Duplicate machine name: %s:%s" % (
+ machine_type, mtype))
# Generate code for all the internal decls
self.decls.findMachines()
diff --git a/src/mem/slicc/parser.py b/src/mem/slicc/parser.py
index 96e029ecf..aa96ceef1 100644
--- a/src/mem/slicc/parser.py
+++ b/src/mem/slicc/parser.py
@@ -258,8 +258,12 @@ class SLICC(Grammar):
filename = os.path.join(self.base_dir, p[2])
p[0] = self.parse_file(filename)
- def p_decl__machine(self, p):
- "decl : MACHINE '(' ident pairs ')' ':' params '{' decls '}'"
+ def p_decl__machine0(self, p):
+ "decl : MACHINE '(' idents ')' ':' params '{' decls '}'"
+ p[0] = ast.MachineAST(self, p[3], [], p[7], p[9])
+
+ def p_decl__machine1(self, p):
+ "decl : MACHINE '(' idents pairs ')' ':' params '{' decls '}'"
p[0] = ast.MachineAST(self, p[3], p[4], p[7], p[9])
def p_decl__action(self, p):
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py
index 1c2177ce1..29b68f2c5 100644
--- a/src/mem/slicc/symbols/Type.py
+++ b/src/mem/slicc/symbols/Type.py
@@ -477,7 +477,6 @@ ${{self.c_ident}}::print(ostream& out) const
if self.isMachineType:
code('#include "base/misc.hh"')
- code('#include "mem/protocol/GenericMachineType.hh"')
code('#include "mem/ruby/common/Address.hh"')
code('struct MachineID;')
@@ -534,23 +533,6 @@ MachineID map_Address_to_DMA(const Address &addr);
MachineID get${{enum.ident}}MachineID(NodeID RubyNode);
''')
- code('''
-inline GenericMachineType
-ConvertMachToGenericMach(MachineType machType)
-{
-''')
- for enum in self.enums.itervalues():
- genericType = self.enums[enum.ident].get('genericType',
- enum.ident)
- code('''
- if (machType == MachineType_${{enum.ident}})
- return GenericMachineType_${{genericType}};
-''')
- code('''
- panic("cannot convert to a GenericMachineType");
-}
-''')
-
if self.isStateDecl:
code('''
@@ -610,7 +592,8 @@ 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"')
+ if enum.get("Primary"):
+ code('#include "mem/protocol/${{enum.ident}}_Controller.hh"')
code('#include "mem/ruby/system/MachineID.hh"')
code('''
@@ -747,7 +730,11 @@ ${{self.c_ident}}_base_number(const ${{self.c_ident}}& obj)
code.indent()
code(' case ${{self.c_ident}}_NUM:')
for enum in reversed(self.enums.values()):
- code(' base += ${{enum.ident}}_Controller::getNumControllers();')
+ # Check if there is a defined machine with this type
+ if enum.get("Primary"):
+ code(' base += ${{enum.ident}}_Controller::getNumControllers();')
+ else:
+ code(' base += 0;')
code(' case ${{self.c_ident}}_${{enum.ident}}:')
code(' break;')
code.dedent()
@@ -771,10 +758,11 @@ ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj)
# For each field
for enum in self.enums.itervalues():
- code('''
- case ${{self.c_ident}}_${{enum.ident}}:
- return ${{enum.ident}}_Controller::getNumControllers();
-''')
+ code('case ${{self.c_ident}}_${{enum.ident}}:')
+ if enum.get("Primary"):
+ code('return ${{enum.ident}}_Controller::getNumControllers();')
+ else:
+ code('return 0;')
# total num
code('''