diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-10-15 17:51:57 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-10-15 17:51:57 -0500 |
commit | 5ffc16593997b35f4f1abbd149e01169e6bbcff5 (patch) | |
tree | 647411a3d027f2bdfaf750f65107affb6d9c002d /src/mem/slicc | |
parent | 07ce90f7aa28a507493da905ba1881972250bb3a (diff) | |
download | gem5-5ffc16593997b35f4f1abbd149e01169e6bbcff5.tar.xz |
ruby: improved support for functional accesses
This patch adds support to different entities in the ruby memory system
for more reliable functional read/write accesses. Only the simple network
has been augmented as of now. Later on Garnet will also support functional
accesses.
The patch adds functional access code to all the different types of messages
that protocols can send around. These messages are functionally accessed
by going through the buffers maintained by the network entities.
The patch also rectifies some of the bugs found in coherence protocols while
testing the patch.
With this patch applied, functional writes always succeed. But functional
reads can still fail.
Diffstat (limited to 'src/mem/slicc')
-rw-r--r-- | src/mem/slicc/ast/TypeDeclAST.py | 3 | ||||
-rw-r--r-- | src/mem/slicc/symbols/StateMachine.py | 36 | ||||
-rw-r--r-- | src/mem/slicc/symbols/SymbolTable.py | 3 | ||||
-rw-r--r-- | src/mem/slicc/symbols/Type.py | 5 |
4 files changed, 45 insertions, 2 deletions
diff --git a/src/mem/slicc/ast/TypeDeclAST.py b/src/mem/slicc/ast/TypeDeclAST.py index 983e86882..8a58853ac 100644 --- a/src/mem/slicc/ast/TypeDeclAST.py +++ b/src/mem/slicc/ast/TypeDeclAST.py @@ -60,7 +60,10 @@ class TypeDeclAST(DeclAST): machine.addType(new_type) self.symtab.newSymbol(new_type) + self.symtab.pushFrame() # Add all of the fields of the type to it for field in self.field_asts: field.generate(new_type) + + self.symtab.popFrame() diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index bb69b70bf..427dbf700 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -269,6 +269,9 @@ class $c_ident : public AbstractController void recordCacheTrace(int cntrl, CacheRecorder* tr); Sequencer* getSequencer() const; + bool functionalReadBuffers(PacketPtr&); + uint32_t functionalWriteBuffers(PacketPtr&); + private: ''') @@ -987,6 +990,39 @@ $c_ident::${{action.ident}}(const Address& addr) for func in self.functions: code(func.generateCode()) + # Function for functional reads from messages buffered in the controller + code(''' +bool +$c_ident::functionalReadBuffers(PacketPtr& pkt) +{ +''') + for var in self.objects: + vtype = var.type + if vtype.isBuffer: + vid = "m_%s_ptr" % var.c_ident + code('if ($vid->functionalRead(pkt)) { return true; }') + code(''' + return false; +} +''') + + # Function for functional writes to messages buffered in the controller + code(''' +uint32_t +$c_ident::functionalWriteBuffers(PacketPtr& pkt) +{ + uint32_t num_functional_writes = 0; +''') + for var in self.objects: + vtype = var.type + if vtype.isBuffer: + vid = "m_%s_ptr" % var.c_ident + code('num_functional_writes += $vid->functionalWrite(pkt);') + code(''' + return num_functional_writes; +} +''') + code.write(path, "%s.cc" % c_ident) def printCWakeup(self, path, includes): diff --git a/src/mem/slicc/symbols/SymbolTable.py b/src/mem/slicc/symbols/SymbolTable.py index d2c9337f1..43cfe8740 100644 --- a/src/mem/slicc/symbols/SymbolTable.py +++ b/src/mem/slicc/symbols/SymbolTable.py @@ -81,8 +81,7 @@ class SymbolTable(object): if types is not None: if not isinstance(symbol, types): symbol.error("Symbol '%s' is not of types '%s'.", - symbol, - types) + symbol, types) return symbol diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py index 383291911..19c144048 100644 --- a/src/mem/slicc/symbols/Type.py +++ b/src/mem/slicc/symbols/Type.py @@ -29,6 +29,7 @@ from m5.util import orderdict from slicc.util import PairContainer from slicc.symbols.Symbol import Symbol +from slicc.symbols.Var import Var class DataMember(PairContainer): def __init__(self, ident, type, pairs, init_code): @@ -151,6 +152,9 @@ class Type(Symbol): member = DataMember(ident, type, pairs, init_code) self.data_members[ident] = member + var = Var(self.symtab, ident, self.location, type, + "m_%s" % ident, {}, None) + self.symtab.registerSym(ident, var) return True def dataMemberType(self, ident): @@ -415,6 +419,7 @@ operator<<(std::ostream& out, const ${{self.c_ident}}& obj) #include <iostream> #include "mem/protocol/${{self.c_ident}}.hh" +#include "mem/ruby/slicc_interface/RubySlicc_Util.hh" using namespace std; ''') |