Func.py (6657:ef5fae93a3b2) | Func.py (6999:f226c098c393) |
---|---|
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 11 unchanged lines hidden (view full) --- 20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 11 unchanged lines hidden (view full) --- 20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 |
28from m5.util import code_formatter 29 | |
30from slicc.symbols.Symbol import Symbol 31from slicc.symbols.Type import Type 32 33class Func(Symbol): 34 def __init__(self, table, ident, location, return_type, param_types, 35 param_strings, body, pairs, machine): 36 super(Func, self).__init__(table, ident, location, pairs) 37 self.return_type = return_type --- 28 unchanged lines hidden (view full) --- 66 return "%s %s(%s);" % (return_type, self.c_ident, 67 ", ".join(self.param_strings)) 68 69 def writeCodeFiles(self, path): 70 '''This write a function of object Chip''' 71 if "external" in self: 72 return 73 | 28from slicc.symbols.Symbol import Symbol 29from slicc.symbols.Type import Type 30 31class Func(Symbol): 32 def __init__(self, table, ident, location, return_type, param_types, 33 param_strings, body, pairs, machine): 34 super(Func, self).__init__(table, ident, location, pairs) 35 self.return_type = return_type --- 28 unchanged lines hidden (view full) --- 64 return "%s %s(%s);" % (return_type, self.c_ident, 65 ", ".join(self.param_strings)) 66 67 def writeCodeFiles(self, path): 68 '''This write a function of object Chip''' 69 if "external" in self: 70 return 71 |
74 code = code_formatter() | 72 code = self.symtab.codeFormatter() |
75 76 # Header 77 code(''' 78/** Auto generated C++ code started by $__file__:$__line__ */ 79 80#include "mem/protocol/Types.hh" 81''') 82 --- 25 unchanged lines hidden --- | 73 74 # Header 75 code(''' 76/** Auto generated C++ code started by $__file__:$__line__ */ 77 78#include "mem/protocol/Types.hh" 79''') 80 --- 25 unchanged lines hidden --- |