From 5ffc16593997b35f4f1abbd149e01169e6bbcff5 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Mon, 15 Oct 2012 17:51:57 -0500 Subject: 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. --- src/mem/slicc/symbols/StateMachine.py | 36 +++++++++++++++++++++++++++++++++++ src/mem/slicc/symbols/SymbolTable.py | 3 +-- src/mem/slicc/symbols/Type.py | 5 +++++ 3 files changed, 42 insertions(+), 2 deletions(-) (limited to 'src/mem/slicc/symbols') 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 #include "mem/protocol/${{self.c_ident}}.hh" +#include "mem/ruby/slicc_interface/RubySlicc_Util.hh" using namespace std; ''') -- cgit v1.2.3