diff options
Diffstat (limited to 'src/mem/slicc')
-rw-r--r-- | src/mem/slicc/ast/EnqueueStatementAST.py | 3 | ||||
-rw-r--r-- | src/mem/slicc/symbols/Type.py | 29 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/mem/slicc/ast/EnqueueStatementAST.py b/src/mem/slicc/ast/EnqueueStatementAST.py index b27bff629..a8785c9af 100644 --- a/src/mem/slicc/ast/EnqueueStatementAST.py +++ b/src/mem/slicc/ast/EnqueueStatementAST.py @@ -53,7 +53,8 @@ class EnqueueStatementAST(StatementAST): self.symtab.newSymbol(v) # Declare message - code("${{msg_type.ident}} *out_msg = new ${{msg_type.ident}};") + code("${{msg_type.ident}} *out_msg = \ + new ${{msg_type.ident}}(curCycle());") # The other statements t = self.statements.generate(code, None) diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py index 19c144048..ebf187630 100644 --- a/src/mem/slicc/symbols/Type.py +++ b/src/mem/slicc/symbols/Type.py @@ -226,7 +226,7 @@ class Type(Symbol): #include <iostream> -#include "mem/ruby/common/Global.hh" +#include "mem/ruby/slicc_interface/RubySlicc_Util.hh" ''') for dm in self.data_members.values(): @@ -242,10 +242,14 @@ class Type(Symbol): $klass ${{self.c_ident}}$parent { public: - ${{self.c_ident}}() - { + ${{self.c_ident}} ''', klass="class") + if self.isMessage: + code('(Time curTime) : %s(curTime) {' % self["interface"]) + else: + code('()\n\t\t{') + code.indent() if not self.isGlobal: code.indent() @@ -284,13 +288,19 @@ $klass ${{self.c_ident}}$parent if not self.isGlobal: params = [ 'const %s& local_%s' % (dm.type.c_ident, dm.ident) \ for dm in self.data_members.itervalues() ] - params = ', '.join(params) + + if self.isMessage: + params = "const Time curTime, " + params + code('${{self.c_ident}}($params)') # Call superclass constructor if "interface" in self: - code(' : ${{self["interface"]}}()') + if self.isMessage: + code(' : ${{self["interface"]}}(curTime)') + else: + code(' : ${{self["interface"]}}()') code('{') code.indent() @@ -302,14 +312,8 @@ $klass ${{self.c_ident}}$parent code.dedent() code('}') - # create a static factory method and a clone member + # create a clone member code(''' -static ${{self.c_ident}}* -create() -{ - return new ${{self.c_ident}}(); -} - ${{self.c_ident}}* clone() const { @@ -419,7 +423,6 @@ 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; ''') |