StallAndWaitStatementAST.py revision 11025:4872dbdea907
12SN/A# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
21762SN/A# Copyright (c) 2009 The Hewlett-Packard Development Company
32SN/A# Copyright (c) 2010 Advanced Micro Devices, Inc.
42SN/A# All rights reserved.
52SN/A#
62SN/A# Redistribution and use in source and binary forms, with or without
72SN/A# modification, are permitted provided that the following conditions are
82SN/A# met: redistributions of source code must retain the above copyright
92SN/A# notice, this list of conditions and the following disclaimer;
102SN/A# redistributions in binary form must reproduce the above copyright
112SN/A# notice, this list of conditions and the following disclaimer in the
122SN/A# documentation and/or other materials provided with the distribution;
132SN/A# neither the name of the copyright holders nor the names of its
142SN/A# contributors may be used to endorse or promote products derived from
152SN/A# this software without specific prior written permission.
162SN/A#
172SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272665Ssaidi@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu
292665Ssaidi@eecs.umich.edufrom slicc.ast.StatementAST import StatementAST
302SN/A
312SN/Aclass StallAndWaitStatementAST(StatementAST):
328946Sandreas.hansson@arm.com    def __init__(self, slicc, in_port, address):
332SN/A        super(StatementAST, self).__init__(slicc)
342SN/A        self.in_port = in_port
358229Snate@binkert.org        self.address = address
362SN/A
372SN/A    def __repr__(self):
3856SN/A        return "[StallAndWaitStatementAst: %r]" % self.in_port
3956SN/A
402SN/A    def generate(self, code, return_type):
412SN/A        self.in_port.assertType("InPort")
422SN/A        self.address.assertType("Addr")
432SN/A
442SN/A        in_port_code = self.in_port.var.code
452SN/A        address_code = self.address.var.code
462SN/A        code('''
472SN/A        stallBuffer(&($in_port_code), $address_code);
48160SN/A        $in_port_code.stallMessage($address_code);
49160SN/A        ''')
502SN/A