diff options
Diffstat (limited to 'src/mem/slicc/symbols')
-rw-r--r-- | src/mem/slicc/symbols/Func.py | 35 | ||||
-rw-r--r-- | src/mem/slicc/symbols/StateMachine.py | 10 |
2 files changed, 11 insertions, 34 deletions
diff --git a/src/mem/slicc/symbols/Func.py b/src/mem/slicc/symbols/Func.py index 695450b9c..d50d0309f 100644 --- a/src/mem/slicc/symbols/Func.py +++ b/src/mem/slicc/symbols/Func.py @@ -30,19 +30,16 @@ from slicc.symbols.Type import Type class Func(Symbol): def __init__(self, table, ident, name, location, return_type, param_types, - proto_param_strings, body_param_strings, body, - pairs, default_count = 0): + param_strings, body, pairs): super(Func, self).__init__(table, ident, location, pairs) self.return_type = return_type self.param_types = param_types - self.proto_param_strings = proto_param_strings - self.body_param_strings = body_param_strings + self.param_strings = param_strings self.body = body self.isInternalMachineFunc = False self.c_ident = ident self.c_name = name self.class_name = "" - self.default_count = default_count def __repr__(self): return "" @@ -60,33 +57,11 @@ class Func(Symbol): return_type += "*" return "%s %s(%s);" % (return_type, self.c_name, - ", ".join(self.proto_param_strings)) + ", ".join(self.param_strings)) def writeCodeFiles(self, path, includes): return - def checkArguments(self, args): - if len(args) + self.default_count < len(self.param_types) or \ - len(args) > len(self.param_types): - self.error("Wrong number of arguments passed to function: '%s'" + \ - " Expected at least: %d, got: %d", self.c_ident, - len(self.param_types) - self.default_count, len(args)) - - cvec = [] - type_vec = [] - for expr,expected_type in zip(args, self.param_types): - # Check the types of the parameter - actual_type,param_code = expr.inline(True) - if str(actual_type) != 'OOD' and \ - str(actual_type) != str(expected_type) and \ - str(actual_type["interface"]) != str(expected_type): - expr.error("Type mismatch: expected: %s actual: %s" % \ - (expected_type, actual_type)) - cvec.append(param_code) - type_vec.append(expected_type) - - return cvec, type_vec - def generateCode(self): '''This write a function of object Chip''' if "external" in self: @@ -95,14 +70,14 @@ class Func(Symbol): code = self.symtab.codeFormatter() # Generate function header - return_type = self.return_type.c_ident void_type = self.symtab.find("void", Type) + return_type = self.return_type.c_ident if "return_by_ref" in self and self.return_type != void_type: return_type += "&" if "return_by_pointer" in self and self.return_type != void_type: return_type += "*" - params = ', '.join(self.body_param_strings) + params = ', '.join(self.param_strings) code(''' $return_type diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index 3dce3c3f2..03c78c8bf 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -320,9 +320,9 @@ class $c_ident : public AbstractController void countTransition(${ident}_State state, ${ident}_Event event); void possibleTransition(${ident}_State state, ${ident}_Event event); - uint64_t getEventCount(${ident}_Event event); + uint64 getEventCount(${ident}_Event event); bool isPossible(${ident}_State state, ${ident}_Event event); - uint64_t getTransitionCount(${ident}_State state, ${ident}_Event event); + uint64 getTransitionCount(${ident}_State state, ${ident}_Event event); private: ''') @@ -802,7 +802,7 @@ $c_ident::possibleTransition(${ident}_State state, m_possible[state][event] = true; } -uint64_t +uint64 $c_ident::getEventCount(${ident}_Event event) { return m_event_counters[event]; @@ -814,7 +814,7 @@ $c_ident::isPossible(${ident}_State state, ${ident}_Event event) return m_possible[state][event]; } -uint64_t +uint64 $c_ident::getTransitionCount(${ident}_State state, ${ident}_Event event) { @@ -1213,6 +1213,8 @@ TransitionResult result = else: code('doTransitionWorker(event, state, next_state, addr);') + port_to_buf_map, in_msg_bufs, msg_bufs = self.getBufferMaps(ident) + code(''' if (result == TransitionResult_Valid) { |