SymbolTable.py (8453:82fc1267d3bb) SymbolTable.py (9219:258753d3bc47)
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;

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

119
120 self.sym_map_vec[0][ident] = symbol
121
122 def getAllType(self, type):
123 for symbol in self.sym_vec:
124 if isinstance(symbol, type):
125 yield symbol
126
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;

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

119
120 self.sym_map_vec[0][ident] = symbol
121
122 def getAllType(self, type):
123 for symbol in self.sym_vec:
124 if isinstance(symbol, type):
125 yield symbol
126
127 def writeCodeFiles(self, path):
127 def writeCodeFiles(self, path, includes):
128 makeDir(path)
129
130 code = self.codeFormatter()
128 makeDir(path)
129
130 code = self.codeFormatter()
131 code('''
132/** Auto generated C++ code started by $__file__:$__line__ */
131 code('/** Auto generated C++ code started by $__file__:$__line__ */')
133
132
134#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
135''')
133 for include_path in includes:
134 code('#include "${{include_path}}"')
135
136 for symbol in self.sym_vec:
137 if isinstance(symbol, Type) and not symbol.isPrimitive:
138 code('#include "mem/protocol/${{symbol.c_ident}}.hh"')
139
140 code.write(path, "Types.hh")
141
142 for symbol in self.sym_vec:
136 for symbol in self.sym_vec:
137 if isinstance(symbol, Type) and not symbol.isPrimitive:
138 code('#include "mem/protocol/${{symbol.c_ident}}.hh"')
139
140 code.write(path, "Types.hh")
141
142 for symbol in self.sym_vec:
143 symbol.writeCodeFiles(path)
143 symbol.writeCodeFiles(path, includes)
144
145 def writeHTMLFiles(self, path):
146 makeDir(path)
147
148 machines = list(self.getAllType(StateMachine))
149 if len(machines) > 1:
150 name = "%s_table.html" % machines[0].ident
151 else:

--- 24 unchanged lines hidden ---
144
145 def writeHTMLFiles(self, path):
146 makeDir(path)
147
148 machines = list(self.getAllType(StateMachine))
149 if len(machines) > 1:
150 name = "%s_table.html" % machines[0].ident
151 else:

--- 24 unchanged lines hidden ---