StateMachine.py (10968:bde347fc89ae) StateMachine.py (10972:53d63eeee46f)
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
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.
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;
9# redistributions in binary form must reproduce the above copyright
10# notice, this list of conditions and the following disclaimer in the

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

81 self.functions = []
82
83 # Data members in the State Machine that have been declared inside
84 # the {} machine. Note that these along with the config params
85 # form the entire set of data members of the machine.
86 self.objects = []
87 self.TBEType = None
88 self.EntryType = None
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
9# notice, this list of conditions and the following disclaimer;
10# redistributions in binary form must reproduce the above copyright
11# notice, this list of conditions and the following disclaimer in the

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

82 self.functions = []
83
84 # Data members in the State Machine that have been declared inside
85 # the {} machine. Note that these along with the config params
86 # form the entire set of data members of the machine.
87 self.objects = []
88 self.TBEType = None
89 self.EntryType = None
90 self.debug_flags = set()
91 self.debug_flags.add('RubyGenerated')
92 self.debug_flags.add('RubySlicc')
89
90 def __repr__(self):
91 return "[StateMachine: %s]" % self.ident
92
93 def addState(self, state):
94 assert self.table is None
95 self.states[state.ident] = state
96

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

109 if action.short == other.short:
110 other.warning("Duplicate action shorthand: %s" % other.ident)
111 other.warning(" shorthand = %s" % other.short)
112 action.warning("Duplicate action shorthand: %s" % action.ident)
113 action.error(" shorthand = %s" % action.short)
114
115 self.actions[action.ident] = action
116
93
94 def __repr__(self):
95 return "[StateMachine: %s]" % self.ident
96
97 def addState(self, state):
98 assert self.table is None
99 self.states[state.ident] = state
100

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

113 if action.short == other.short:
114 other.warning("Duplicate action shorthand: %s" % other.ident)
115 other.warning(" shorthand = %s" % other.short)
116 action.warning("Duplicate action shorthand: %s" % action.ident)
117 action.error(" shorthand = %s" % action.short)
118
119 self.actions[action.ident] = action
120
121 def addDebugFlag(self, flag):
122 self.debug_flags.add(flag)
123
117 def addRequestType(self, request_type):
118 assert self.table is None
119 self.request_types[request_type.ident] = request_type
120
121 def addTransition(self, trans):
122 assert self.table is None
123 self.transitions.append(trans)
124

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

265#include <sstream>
266#include <string>
267
268#include "mem/protocol/TransitionResult.hh"
269#include "mem/protocol/Types.hh"
270#include "mem/ruby/common/Consumer.hh"
271#include "mem/ruby/slicc_interface/AbstractController.hh"
272#include "params/$c_ident.hh"
124 def addRequestType(self, request_type):
125 assert self.table is None
126 self.request_types[request_type.ident] = request_type
127
128 def addTransition(self, trans):
129 assert self.table is None
130 self.transitions.append(trans)
131

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

272#include <sstream>
273#include <string>
274
275#include "mem/protocol/TransitionResult.hh"
276#include "mem/protocol/Types.hh"
277#include "mem/ruby/common/Consumer.hh"
278#include "mem/ruby/slicc_interface/AbstractController.hh"
279#include "params/$c_ident.hh"
280
273''')
274
275 seen_types = set()
276 for var in self.objects:
277 if var.type.ident not in seen_types and not var.type.isPrimitive:
278 code('#include "mem/protocol/${{var.type.c_ident}}.hh"')
279 seen_types.add(var.type.ident)
280

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

436 code('''
437/** \\file $c_ident.cc
438 *
439 * Auto generated C++ code started by $__file__:$__line__
440 * Created by slicc definition of Module "${{self.short}}"
441 */
442
443#include <sys/types.h>
281''')
282
283 seen_types = set()
284 for var in self.objects:
285 if var.type.ident not in seen_types and not var.type.isPrimitive:
286 code('#include "mem/protocol/${{var.type.c_ident}}.hh"')
287 seen_types.add(var.type.ident)
288

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

444 code('''
445/** \\file $c_ident.cc
446 *
447 * Auto generated C++ code started by $__file__:$__line__
448 * Created by slicc definition of Module "${{self.short}}"
449 */
450
451#include <sys/types.h>
444#include <typeinfo>
445#include <unistd.h>
446
447#include <cassert>
448#include <sstream>
449#include <string>
452#include <unistd.h>
453
454#include <cassert>
455#include <sstream>
456#include <string>
457#include <typeinfo>
450
451#include "base/compiler.hh"
452#include "base/cprintf.hh"
458
459#include "base/compiler.hh"
460#include "base/cprintf.hh"
453#include "debug/RubyGenerated.hh"
454#include "debug/RubySlicc.hh"
461
462''')
463 for f in self.debug_flags:
464 code('#include "debug/${{f}}.hh"')
465 code('''
455#include "mem/protocol/${ident}_Controller.hh"
456#include "mem/protocol/${ident}_Event.hh"
457#include "mem/protocol/${ident}_State.hh"
458#include "mem/protocol/Types.hh"
459#include "mem/ruby/system/System.hh"
466#include "mem/protocol/${ident}_Controller.hh"
467#include "mem/protocol/${ident}_Event.hh"
468#include "mem/protocol/${ident}_State.hh"
469#include "mem/protocol/Types.hh"
470#include "mem/ruby/system/System.hh"
471
460''')
461 for include_path in includes:
462 code('#include "${{include_path}}"')
463
464 code('''
465
466using namespace std;
467''')

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

1048 if len(self.request_types) == 0:
1049 outputRequest_types = False
1050
1051 code('''
1052// Auto generated C++ code started by $__file__:$__line__
1053// ${ident}: ${{self.short}}
1054
1055#include <sys/types.h>
472''')
473 for include_path in includes:
474 code('#include "${{include_path}}"')
475
476 code('''
477
478using namespace std;
479''')

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

1060 if len(self.request_types) == 0:
1061 outputRequest_types = False
1062
1063 code('''
1064// Auto generated C++ code started by $__file__:$__line__
1065// ${ident}: ${{self.short}}
1066
1067#include <sys/types.h>
1056#include <typeinfo>
1057#include <unistd.h>
1058
1059#include <cassert>
1068#include <unistd.h>
1069
1070#include <cassert>
1071#include <typeinfo>
1060
1061#include "base/misc.hh"
1072
1073#include "base/misc.hh"
1062#include "debug/RubySlicc.hh"
1074
1075''')
1076 for f in self.debug_flags:
1077 code('#include "debug/${{f}}.hh"')
1078 code('''
1063#include "mem/protocol/${ident}_Controller.hh"
1064#include "mem/protocol/${ident}_Event.hh"
1065#include "mem/protocol/${ident}_State.hh"
1079#include "mem/protocol/${ident}_Controller.hh"
1080#include "mem/protocol/${ident}_Event.hh"
1081#include "mem/protocol/${ident}_State.hh"
1082
1066''')
1067
1068 if outputRequest_types:
1069 code('''#include "mem/protocol/${ident}_RequestType.hh"''')
1070
1071 code('''
1072#include "mem/protocol/Types.hh"
1073#include "mem/ruby/system/System.hh"
1083''')
1084
1085 if outputRequest_types:
1086 code('''#include "mem/protocol/${ident}_RequestType.hh"''')
1087
1088 code('''
1089#include "mem/protocol/Types.hh"
1090#include "mem/ruby/system/System.hh"
1091
1074''')
1075
1076
1077 for include_path in includes:
1078 code('#include "${{include_path}}"')
1079
1080 port_to_buf_map, in_msg_bufs, msg_bufs = self.getBufferMaps(ident)
1081

--- 512 unchanged lines hidden ---
1092''')
1093
1094
1095 for include_path in includes:
1096 code('#include "${{include_path}}"')
1097
1098 port_to_buf_map, in_msg_bufs, msg_bufs = self.getBufferMaps(ident)
1099

--- 512 unchanged lines hidden ---