From 467093ebf238a1954e00576daf14a9f246b51e79 Mon Sep 17 00:00:00 2001 From: Joel Hestness Date: Tue, 10 Jul 2012 22:51:54 -0700 Subject: ruby: tag and data cache access support Updates to Ruby to support statistics counting of cache accesses. This feature serves multiple purposes beyond simple stats collection. It provides the foundation for ruby to model the cache tag and data arrays as physical resources, as well as provide the necessary input data for McPAT power modeling. --- src/mem/slicc/ast/TransitionDeclAST.py | 13 +++++++++++-- src/mem/slicc/ast/TypeFieldEnumAST.py | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/mem/slicc/ast') diff --git a/src/mem/slicc/ast/TransitionDeclAST.py b/src/mem/slicc/ast/TransitionDeclAST.py index a941d7b0c..41e5b9aff 100644 --- a/src/mem/slicc/ast/TransitionDeclAST.py +++ b/src/mem/slicc/ast/TransitionDeclAST.py @@ -29,9 +29,11 @@ from slicc.ast.DeclAST import DeclAST from slicc.symbols import Transition class TransitionDeclAST(DeclAST): - def __init__(self, slicc, states, events, next_state, pairs, actions): + def __init__(self, slicc, request_types, states, events, next_state, pairs, + actions): super(TransitionDeclAST, self).__init__(slicc, pairs) + self.request_types = request_types self.states = states self.events = events self.next_state = next_state @@ -51,6 +53,12 @@ class TransitionDeclAST(DeclAST): self.error("Invalid action: %s is not part of machine: %s" % \ (action, machine)) + for request_type in self.request_types: + if request_type not in machine.request_types: + self.error("Invalid protocol access type: " \ + "%s is not part of machine: %s" % \ + (request_type, machine)) + for state in self.states: if state not in machine.states: self.error("Invalid state: %s is not part of machine: %s" % \ @@ -61,5 +69,6 @@ class TransitionDeclAST(DeclAST): self.error("Invalid event: %s is not part of machine: %s" % \ (event, machine)) t = Transition(self.symtab, machine, state, event, next_state, - self.actions, self.location, self.pairs) + self.actions, self.request_types, self.location, + self.pairs) machine.addTransition(t) diff --git a/src/mem/slicc/ast/TypeFieldEnumAST.py b/src/mem/slicc/ast/TypeFieldEnumAST.py index 398604550..1255c972a 100644 --- a/src/mem/slicc/ast/TypeFieldEnumAST.py +++ b/src/mem/slicc/ast/TypeFieldEnumAST.py @@ -26,7 +26,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from slicc.ast.TypeFieldAST import TypeFieldAST -from slicc.symbols import Event, State +from slicc.symbols import Event, State, RequestType class TypeFieldEnumAST(TypeFieldAST): def __init__(self, slicc, field_id, pairs_ast): @@ -54,3 +54,10 @@ class TypeFieldEnumAST(TypeFieldAST): self.error("Event declaration not part of a machine.") e = Event(self.symtab, self.field_id, self.location, self.pairs) machine.addEvent(e) + + if str(type) == "RequestType": + if not machine: + self.error("RequestType declaration not part of a machine.") + s = RequestType(self.symtab, self.field_id, self.location, + self.pairs) + machine.addRequestType(s) -- cgit v1.2.3