Deleted Added
sdiff udiff text old ( 7793:f6cbeb8712d3 ) 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;

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

84 self.error("Unrecognized function name: '%s'", self.proc_name)
85
86 if len(self.exprs) != len(func.param_types):
87 self.error("Wrong number of arguments passed to function : '%s'" +\
88 " Expected %d, got %d", self.proc_name,
89 len(func.param_types), len(self.exprs))
90
91 cvec = []
92 for expr,expected_type in zip(self.exprs, func.param_types):
93 # Check the types of the parameter
94 actual_type,param_code = expr.inline(True)
95 if actual_type != expected_type:
96 expr.error("Type mismatch: expected: %s actual: %s" % \
97 (expected_type, actual_type))
98 cvec.append(param_code)
99
100 # OK, the semantics of "trigger" here is that, ports in the
101 # machine have different priorities. We always check the first
102 # port for doable transitions. If nothing/stalled, we pick one
103 # from the next port.
104 #
105 # One thing we have to be careful as the SLICC protocol
106 # writter is : If a port have two or more transitions can be
107 # picked from in one cycle, they must be independent.
108 # Otherwise, if transition A and B mean to be executed in
109 # sequential, and A get stalled, transition B can be issued
110 # erroneously. In practice, in most case, there is only one
111 # transition should be executed in one cycle for a given
112 # port. So as most of current protocols.
113
114 if self.proc_name == "trigger":
115 code('''
116{
117 Address addr = ${{cvec[1]}};
118 TransitionResult result = doTransition(${{cvec[0]}}, ${machine}_getState(addr), addr);
119
120 if (result == TransitionResult_Valid) {
121 counter++;
122 continue; // Check the first port again
123 }
124
125 if (result == TransitionResult_ResourceStall) {
126 g_eventQueue_ptr->scheduleEvent(this, 1);
127

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

170 $error
171}
172#endif
173''')
174
175 elif self.proc_name == "continueProcessing":
176 code("counter++;")
177 code("continue; // Check the first port again")
178 else:
179 # Normal function
180
181 # if the func is internal to the chip but not the machine
182 # then it can only be accessed through the chip pointer
183 internal = ""
184 if "external" not in func and not func.isInternalMachineFunc:
185 internal = "m_chip_ptr->"
186
187 params = ', '.join(str(c) for c in cvec)
188 fix = code.nofix()
189 code('(${internal}${{func.c_ident}}($params))')
190 code.fix(fix)
191
192 return func.return_type