PeekStatementAST.py (11111:6da33e720481) PeekStatementAST.py (13675:afeab32b3655)
1# Copyright (c) 2013 Advanced Micro Devices, Inc.
2# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3# Copyright (c) 2009 The Hewlett-Packard Development Company
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

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

66 if (in_msg_ptr == NULL) {
67 // If the cast fails, this is the wrong inport (wrong message type).
68 // Throw an exception, and the caller will decide to either try a
69 // different inport or punt.
70 throw RejectException();
71 }
72''')
73
1# Copyright (c) 2013 Advanced Micro Devices, Inc.
2# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3# Copyright (c) 2009 The Hewlett-Packard Development Company
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

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

66 if (in_msg_ptr == NULL) {
67 // If the cast fails, this is the wrong inport (wrong message type).
68 // Throw an exception, and the caller will decide to either try a
69 // different inport or punt.
70 throw RejectException();
71 }
72''')
73
74 if self.pairs.has_key("block_on"):
74 if "block_on" in self.pairs:
75 address_field = self.pairs['block_on']
76 code('''
77 if (m_is_blocking &&
78 (m_block_map.count(in_msg_ptr->m_$address_field) == 1) &&
79 (m_block_map[in_msg_ptr->m_$address_field] != &$qcode)) {
80 $qcode.delayHead(clockEdge(), cyclesToTicks(Cycles(1)));
81 continue;
82 }
83 ''')
84
75 address_field = self.pairs['block_on']
76 code('''
77 if (m_is_blocking &&
78 (m_block_map.count(in_msg_ptr->m_$address_field) == 1) &&
79 (m_block_map[in_msg_ptr->m_$address_field] != &$qcode)) {
80 $qcode.delayHead(clockEdge(), cyclesToTicks(Cycles(1)));
81 continue;
82 }
83 ''')
84
85 if self.pairs.has_key("wake_up"):
85 if "wake_up" in self.pairs:
86 address_field = self.pairs['wake_up']
87 code('''
88 if (m_waiting_buffers.count(in_msg_ptr->m_$address_field) > 0) {
89 wakeUpBuffers(in_msg_ptr->m_$address_field);
90 }
91 ''')
92
93 # The other statements
94 self.statements.generate(code, return_type)
95 self.symtab.popFrame()
96 code("}")
97
98 def findResources(self, resources):
99 self.statements.findResources(resources)
86 address_field = self.pairs['wake_up']
87 code('''
88 if (m_waiting_buffers.count(in_msg_ptr->m_$address_field) > 0) {
89 wakeUpBuffers(in_msg_ptr->m_$address_field);
90 }
91 ''')
92
93 # The other statements
94 self.statements.generate(code, return_type)
95 self.symtab.popFrame()
96 code("}")
97
98 def findResources(self, resources):
99 self.statements.findResources(resources)