FuncCallExprAST.py (9820:2f9aecba2362) FuncCallExprAST.py (10009:8523754f8885)
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;

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

88 " Expected %d, got %d", self.proc_name,
89 len(func.param_types), len(self.exprs))
90
91 cvec = []
92 type_vec = []
93 for expr,expected_type in zip(self.exprs, func.param_types):
94 # Check the types of the parameter
95 actual_type,param_code = expr.inline(True)
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;

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

88 " Expected %d, got %d", self.proc_name,
89 len(func.param_types), len(self.exprs))
90
91 cvec = []
92 type_vec = []
93 for expr,expected_type in zip(self.exprs, func.param_types):
94 # Check the types of the parameter
95 actual_type,param_code = expr.inline(True)
96 if str(actual_type) != str(expected_type):
96 if str(actual_type) != 'OOD' and \
97 str(actual_type) != str(expected_type):
97 expr.error("Type mismatch: expected: %s actual: %s" % \
98 (expected_type, actual_type))
99 cvec.append(param_code)
100 type_vec.append(expected_type)
101
102 # OK, the semantics of "trigger" here is that, ports in the
103 # machine have different priorities. We always check the first
104 # port for doable transitions. If nothing/stalled, we pick one

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

111 # sequential, and A get stalled, transition B can be issued
112 # erroneously. In practice, in most case, there is only one
113 # transition should be executed in one cycle for a given
114 # port. So as most of current protocols.
115
116 if self.proc_name == "trigger":
117 code('''
118{
98 expr.error("Type mismatch: expected: %s actual: %s" % \
99 (expected_type, actual_type))
100 cvec.append(param_code)
101 type_vec.append(expected_type)
102
103 # OK, the semantics of "trigger" here is that, ports in the
104 # machine have different priorities. We always check the first
105 # port for doable transitions. If nothing/stalled, we pick one

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

112 # sequential, and A get stalled, transition B can be issued
113 # erroneously. In practice, in most case, there is only one
114 # transition should be executed in one cycle for a given
115 # port. So as most of current protocols.
116
117 if self.proc_name == "trigger":
118 code('''
119{
119 Address addr = ${{cvec[1]}};
120''')
121 if machine.TBEType != None and machine.EntryType != None:
122 code('''
120''')
121 if machine.TBEType != None and machine.EntryType != None:
122 code('''
123 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[2]}}, ${{cvec[3]}}, addr);
123 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[2]}}, ${{cvec[3]}}, ${{cvec[1]}});
124''')
125 elif machine.TBEType != None:
126 code('''
124''')
125 elif machine.TBEType != None:
126 code('''
127 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[2]}}, addr);
127 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[2]}}, ${{cvec[1]}});
128''')
129 elif machine.EntryType != None:
130 code('''
128''')
129 elif machine.EntryType != None:
130 code('''
131 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[2]}}, addr);
131 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[2]}}, ${{cvec[1]}});
132''')
133 else:
134 code('''
132''')
133 else:
134 code('''
135 TransitionResult result = doTransition(${{cvec[0]}}, addr);
135 TransitionResult result = doTransition(${{cvec[0]}}, ${{cvec[1]}});
136''')
137
138 code('''
139 if (result == TransitionResult_Valid) {
140 counter++;
141 continue; // Check the first port again
142 }
143

--- 49 unchanged lines hidden ---
136''')
137
138 code('''
139 if (result == TransitionResult_Valid) {
140 counter++;
141 continue; // Check the first port again
142 }
143

--- 49 unchanged lines hidden ---