Deleted Added
sdiff udiff text old ( 7055:4e24742201d7 ) new ( 7839:9e556fb25900 )
full compact
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;

--- 46 unchanged lines hidden (view full) ---

55 def prototype(self):
56 if "external" in self:
57 return ""
58
59 return_type = self.return_type.c_ident
60 void_type = self.symtab.find("void", Type)
61 if "return_by_ref" in self and self.return_type != void_type:
62 return_type += "&"
63
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

--- 11 unchanged lines hidden (view full) ---

82 code('#include "mem/protocol/${{self.machineStr}}_Controller.hh"')
83
84 code('using namespace std;')
85 # Generate function header
86 void_type = self.symtab.find("void", Type)
87 return_type = self.return_type.c_ident
88 if "return_by_ref" in self and self.return_type != void_type:
89 return_type += "&"
90
91 if self.isInternalMachineFunc:
92 klass = "%s_Controller" % self.machineStr
93 else:
94 klass = "Chip"
95
96 params = ', '.join(self.param_strings)
97
98 code('''
99$return_type
100${klass}::${{self.c_ident}}($params)
101{
102${{self.body}}
103}
104''')
105 code.write(path, "%s.cc" % self.c_ident)
106
107__all__ = [ "Func" ]