StallAndWaitStatementAST.py revision 11111
15443Sgblack@eecs.umich.edu# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 25443Sgblack@eecs.umich.edu# Copyright (c) 2009 The Hewlett-Packard Development Company 35443Sgblack@eecs.umich.edu# Copyright (c) 2010 Advanced Micro Devices, Inc. 45443Sgblack@eecs.umich.edu# All rights reserved. 55443Sgblack@eecs.umich.edu# 65443Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 75443Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 85443Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 95443Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 105443Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 115443Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 125443Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 135443Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 145443Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 155443Sgblack@eecs.umich.edu# this software without specific prior written permission. 165443Sgblack@eecs.umich.edu# 175443Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185443Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195443Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 205443Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 215443Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 225443Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 235443Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 245443Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 255443Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 265443Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 275443Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 285443Sgblack@eecs.umich.edu 295443Sgblack@eecs.umich.edufrom slicc.ast.StatementAST import StatementAST 305443Sgblack@eecs.umich.edu 315443Sgblack@eecs.umich.educlass StallAndWaitStatementAST(StatementAST): 325443Sgblack@eecs.umich.edu def __init__(self, slicc, in_port, address): 335443Sgblack@eecs.umich.edu super(StatementAST, self).__init__(slicc) 345443Sgblack@eecs.umich.edu self.in_port = in_port 355443Sgblack@eecs.umich.edu self.address = address 365606Snate@binkert.org 375606Snate@binkert.org def __repr__(self): 385606Snate@binkert.org return "[StallAndWaitStatementAst: %r]" % self.in_port 395443Sgblack@eecs.umich.edu 405443Sgblack@eecs.umich.edu def generate(self, code, return_type): 415443Sgblack@eecs.umich.edu self.in_port.assertType("InPort") 425443Sgblack@eecs.umich.edu self.address.assertType("Addr") 435443Sgblack@eecs.umich.edu 445443Sgblack@eecs.umich.edu in_port_code = self.in_port.var.code 455606Snate@binkert.org address_code = self.address.var.code 465443Sgblack@eecs.umich.edu code(''' 475635Sgblack@eecs.umich.edu stallBuffer(&($in_port_code), $address_code); 485443Sgblack@eecs.umich.edu $in_port_code.stallMessage($address_code, clockEdge()); 495443Sgblack@eecs.umich.edu ''') 505443Sgblack@eecs.umich.edu