StateMachine.py (13665:9c7fe3811b88) StateMachine.py (13672:2969e4d5abf4)
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# Copyright (c) 2013 Advanced Micro Devices, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# Copyright (c) 2013 Advanced Micro Devices, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29from m5.util import orderdict
29from collections import OrderedDict
30
31from slicc.symbols.Symbol import Symbol
32from slicc.symbols.Var import Var
33import slicc.generate.html as html
34import re
35
36python_class_map = {
37 "int": "Int",

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

73 var = Var(symtab, param.ident, location, param.type_ast.type,
74 "m_%s" % param.ident, {}, self)
75
76 self.symtab.registerSym(param.ident, var)
77
78 if str(param.type_ast.type) == "Prefetcher":
79 self.prefetchers.append(var)
80
30
31from slicc.symbols.Symbol import Symbol
32from slicc.symbols.Var import Var
33import slicc.generate.html as html
34import re
35
36python_class_map = {
37 "int": "Int",

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

73 var = Var(symtab, param.ident, location, param.type_ast.type,
74 "m_%s" % param.ident, {}, self)
75
76 self.symtab.registerSym(param.ident, var)
77
78 if str(param.type_ast.type) == "Prefetcher":
79 self.prefetchers.append(var)
80
81 self.states = orderdict()
82 self.events = orderdict()
83 self.actions = orderdict()
84 self.request_types = orderdict()
81 self.states = OrderedDict()
82 self.events = OrderedDict()
83 self.actions = OrderedDict()
84 self.request_types = OrderedDict()
85 self.transitions = []
86 self.in_ports = []
87 self.functions = []
88
89 # Data members in the State Machine that have been declared inside
90 # the {} machine. Note that these along with the config params
91 # form the entire set of data members of the machine.
92 self.objects = []

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

1298''')
1299 code('''
1300 Addr addr)
1301{
1302 switch(HASH_FUN(state, event)) {
1303''')
1304
1305 # This map will allow suppress generating duplicate code
85 self.transitions = []
86 self.in_ports = []
87 self.functions = []
88
89 # Data members in the State Machine that have been declared inside
90 # the {} machine. Note that these along with the config params
91 # form the entire set of data members of the machine.
92 self.objects = []

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

1298''')
1299 code('''
1300 Addr addr)
1301{
1302 switch(HASH_FUN(state, event)) {
1303''')
1304
1305 # This map will allow suppress generating duplicate code
1306 cases = orderdict()
1306 cases = OrderedDict()
1307
1308 for trans in self.transitions:
1309 case_string = "%s_State_%s, %s_Event_%s" % \
1310 (self.ident, trans.state.ident, self.ident, trans.event.ident)
1311
1312 case = self.symtab.codeFormatter()
1313 # Only set next_state if it changes
1314 if trans.state != trans.nextState:

--- 278 unchanged lines hidden ---
1307
1308 for trans in self.transitions:
1309 case_string = "%s_State_%s, %s_Event_%s" % \
1310 (self.ident, trans.state.ident, self.ident, trans.event.ident)
1311
1312 case = self.symtab.codeFormatter()
1313 # Only set next_state if it changes
1314 if trans.state != trans.nextState:

--- 278 unchanged lines hidden ---