Brad, in case you want to have look at the changes that I made so far,
I have attached the patch with this mail.
On Sun, 12 Dec 2010, Nilay Vaish wrote:
Hi Brad,
I have added implicit variables for TBE and Cache entry pointers. These get
inserted in to the doTransition() calls made in Wakeup(). These variables are
forwarded to doTransitionWorker() which passes them on to all the action
functions.
Following is what I think needs to be done next -
1. Currently the implicit TBE and Cache Entry pointers are set to NULL in the
calls to doTransition() function. To set these, we would need to make calls
to a function that returns the pointer if the address is in the cache, NULL
otherwise.
I think we should retain the getEntry functions in the .sm files for in case
of L1 cache both instruction and the data cache needs to be checked. This is
something that I probably would prefer keeping out of SLICC. In fact, we
should add getEntry functions for TBEs where ever required.
These getEntry would now return a pointer instead of a reference. We would
need to add support for return_by_pointer to SLICC. Also, since these
functions would be used inside the Wakeup function, we would need to assume a
common name for them across all protocols, just like getState() function.
2. I still think we would need to change the changePermission function in the
CacheMemory class. Presently it calls findTagInSet() twice. Instead, we would
pass on the CacheEntry whose permissions need to be changed. This would save
one call. We should also put the variable m_locked in the AbstractCacheEntry
(may be make it part of the permission variable) to avoid the second call.
3. In the getState() and setState() functions, we need to specify that the
function assumes that implicit TBE and CacheEntry pointers have been passed
as arguments. How should we do this? I think we would need to push them in to
the symbol table before they can be used in side the function.
Thanks
Nilay
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev
# HG changeset patch
# Parent 55c51a967be100596c9a4d77514d77289eda1f44
diff -r 55c51a967be1 src/mem/slicc/ast/FuncCallExprAST.py
--- a/src/mem/slicc/ast/FuncCallExprAST.py Thu Dec 09 15:27:12 2010 -0600
+++ b/src/mem/slicc/ast/FuncCallExprAST.py Sat Dec 11 18:20:45 2010 -0600
@@ -115,8 +115,25 @@
code('''
{
Address addr = ${{cvec[1]}};
+''')
+ if machine.hasTBEType and machine.hasEntryType:
+ code('''
+ TransitionResult result = doTransition(${{cvec[0]}},
${machine}_getState(addr), NULL, NULL, addr);
+''')
+ elif machine.hasEntryType:
+ code('''
+ TransitionResult result = doTransition(${{cvec[0]}},
${machine}_getState(addr), NULL, addr);
+''')
+ elif machine.hasTBEType:
+ code('''
+ TransitionResult result = doTransition(${{cvec[0]}},
${machine}_getState(addr), NULL, addr);
+''')
+ else:
+ code('''
TransitionResult result = doTransition(${{cvec[0]}},
${machine}_getState(addr), addr);
+''')
+ code('''
if (result == TransitionResult_Valid) {
counter++;
continue; // Check the first port again
@@ -138,13 +155,13 @@
{
Address addr1 = ${{cvec[1]}};
TransitionResult result1 =
- doTransition(${{cvec[0]}}, ${machine}_getState(addr1), addr1);
+ doTransition(${{cvec[0]}}, ${machine}_getState(addr1), addr1, NULL);
if (result1 == TransitionResult_Valid) {
//this second event cannont fail because the first event
// already took effect
Address addr2 = ${{cvec[3]}};
- TransitionResult result2 = doTransition(${{cvec[2]}},
${machine}_getState(addr2), addr2);
+ TransitionResult result2 = doTransition(${{cvec[2]}},
${machine}_getState(addr2), addr2, NULL);
// ensure the event suceeded
assert(result2 == TransitionResult_Valid);
diff -r 55c51a967be1 src/mem/slicc/ast/TypeDeclAST.py
--- a/src/mem/slicc/ast/TypeDeclAST.py Thu Dec 09 15:27:12 2010 -0600
+++ b/src/mem/slicc/ast/TypeDeclAST.py Sat Dec 11 18:20:45 2010 -0600
@@ -50,10 +50,15 @@
def generate(self):
ident = str(self.type_ast)
+ machine = self.symtab.state_machine
# Make the new type
new_type = Type(self.symtab, ident, self.location, self.pairs,
self.state_machine)
+
+ if machine:
+ machine.addType(new_type)
+
self.symtab.newSymbol(new_type)
# Add all of the fields of the type to it
diff -r 55c51a967be1 src/mem/slicc/symbols/StateMachine.py
--- a/src/mem/slicc/symbols/StateMachine.py Thu Dec 09 15:27:12 2010 -0600
+++ b/src/mem/slicc/symbols/StateMachine.py Sat Dec 11 18:20:45 2010 -0600
@@ -62,6 +62,8 @@
self.in_ports = []
self.functions = []
self.objects = []
+ self.hasTBEType = False
+ self.hasEntryType = False
self.message_buffer_names = []
@@ -107,6 +109,14 @@
def addObject(self, obj):
self.objects.append(obj)
+ def addType(self, type):
+ type_ident = '%s' % type.c_ident
+
+ if type_ident == "%s_TBE" %self.ident:
+ self.hasTBEType = True
+ elif type_ident == "%s_Entry" %self.ident:
+ self.hasEntryType = True
+
# Needs to be called before accessing the table
def buildTable(self):
assert self.table is None
@@ -265,11 +275,35 @@
TransitionResult doTransition(${ident}_Event event,
${ident}_State state,
+''')
+
+ if self.hasTBEType:
+ code('''
+ ${ident}_TBE* m_tbe_ptr,
+''')
+ if self.hasEntryType:
+ code('''
+ ${ident}_Entry* m_cache_entry_ptr,
+''')
+
+ code('''
const Address& addr);
TransitionResult doTransitionWorker(${ident}_Event event,
${ident}_State state,
${ident}_State& next_state,
+''')
+
+ if self.hasTBEType:
+ code('''
+ ${ident}_TBE* m_tbe_ptr,
+''')
+ if self.hasEntryType:
+ code('''
+ ${ident}_Entry* m_cache_entry_ptr,
+''')
+
+ code('''
const Address& addr);
std::string m_name;
@@ -303,9 +337,22 @@
// Actions
''')
- for action in self.actions.itervalues():
- code('/** \\brief ${{action.desc}} */')
- code('void ${{action.ident}}(const Address& addr);')
+ if self.hasTBEType and self.hasEntryType:
+ for action in self.actions.itervalues():
+ code('/** \\brief ${{action.desc}} */')
+ code('void ${{action.ident}}(${ident}_TBE* m_tbe_ptr,
${ident}_Entry* m_cache_entry_ptr, const Address& addr);')
+ elif self.hasTBEType:
+ for action in self.actions.itervalues():
+ code('/** \\brief ${{action.desc}} */')
+ code('void ${{action.ident}}(${ident}_TBE* m_tbe_ptr, const
Address& addr);')
+ elif self.hasEntryType:
+ for action in self.actions.itervalues():
+ code('/** \\brief ${{action.desc}} */')
+ code('void ${{action.ident}}(${ident}_Entry*
m_cache_entry_ptr, const Address& addr);')
+ else:
+ for action in self.actions.itervalues():
+ code('/** \\brief ${{action.desc}} */')
+ code('void ${{action.ident}}(const Address& addr);')
# the controller internal variables
code('''
@@ -734,11 +781,57 @@
// Actions
''')
- for action in self.actions.itervalues():
- if "c_code" not in action:
- continue
+ if self.hasTBEType and self.hasEntryType:
+ for action in self.actions.itervalues():
+ if "c_code" not in action:
+ continue
- code('''
+ code('''
+/** \\brief ${{action.desc}} */
+void
+$c_ident::${{action.ident}}(${ident}_TBE* m_tbe_ptr, ${ident}_Entry*
m_cache_entry_ptr, const Address& addr)
+{
+ DPRINTF(RubyGenerated, "executing\\n");
+ ${{action["c_code"]}}
+}
+
+''')
+ elif self.hasTBEType:
+ for action in self.actions.itervalues():
+ if "c_code" not in action:
+ continue
+
+ code('''
+/** \\brief ${{action.desc}} */
+void
+$c_ident::${{action.ident}}(${ident}_TBE* m_tbe_ptr, const Address& addr)
+{
+ DPRINTF(RubyGenerated, "executing\\n");
+ ${{action["c_code"]}}
+}
+
+''')
+ elif self.hasEntryType:
+ for action in self.actions.itervalues():
+ if "c_code" not in action:
+ continue
+
+ code('''
+/** \\brief ${{action.desc}} */
+void
+$c_ident::${{action.ident}}(${ident}_Entry* m_cache_entry_ptr, const Address&
addr)
+{
+ DPRINTF(RubyGenerated, "executing\\n");
+ ${{action["c_code"]}}
+}
+
+''')
+ else:
+ for action in self.actions.itervalues():
+ if "c_code" not in action:
+ continue
+
+ code('''
/** \\brief ${{action.desc}} */
void
$c_ident::${{action.ident}}(const Address& addr)
@@ -845,6 +938,17 @@
TransitionResult
${ident}_Controller::doTransition(${ident}_Event event,
${ident}_State state,
+''')
+ if self.hasTBEType:
+ code('''
+ ${ident}_TBE* m_tbe_ptr,
+''')
+ if self.hasEntryType:
+ code('''
+ ${ident}_Entry* m_cache_entry_ptr,
+''')
+
+ code('''
const Address &addr)
{
${ident}_State next_state = state;
@@ -857,7 +961,24 @@
addr);
TransitionResult result =
+''')
+ if self.hasTBEType and self.hasEntryType:
+ code('''
+ doTransitionWorker(event, state, next_state, m_tbe_ptr,
m_cache_entry_ptr, addr);
+''')
+ elif self.hasEntryType:
+ code('''
+ doTransitionWorker(event, state, next_state, m_cache_entry_ptr, addr);
+''')
+ elif self.hasTBEType:
+ code('''
+ doTransitionWorker(event, state, next_state, m_tbe_ptr, addr);
+''')
+ else:
+ code('''
doTransitionWorker(event, state, next_state, addr);
+''')
+ code('''
if (result == TransitionResult_Valid) {
DPRINTF(RubyGenerated, "next_state: %s\\n",
@@ -902,6 +1023,18 @@
${ident}_Controller::doTransitionWorker(${ident}_Event event,
${ident}_State state,
${ident}_State& next_state,
+''')
+
+ if self.hasTBEType:
+ code('''
+ ${ident}_TBE* m_tbe_ptr,
+''')
+ if self.hasEntryType:
+ code('''
+ ${ident}_Entry* m_cache_entry_ptr,
+''')
+
+ code('''
const Address& addr)
{
switch(HASH_FUN(state, event)) {
@@ -950,8 +1083,18 @@
if stall:
case('return TransitionResult_ProtocolStall;')
else:
- for action in actions:
- case('${{action.ident}}(addr);')
+ if self.hasTBEType and self.hasEntryType:
+ for action in actions:
+ case('${{action.ident}}(m_tbe_ptr, m_cache_entry_ptr,
addr);')
+ elif self.hasTBEType:
+ for action in actions:
+ case('${{action.ident}}(m_tbe_ptr, addr);')
+ elif self.hasEntryType:
+ for action in actions:
+ case('${{action.ident}}(m_cache_entry_ptr, addr);')
+ else:
+ for action in actions:
+ case('${{action.ident}}(addr);')
case('return TransitionResult_Valid;')
case = str(case)
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev