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

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

28
29from slicc.ast.StatementAST import StatementAST
30
31class StallAndWaitStatementAST(StatementAST):
32 def __init__(self, slicc, in_port, address):
33 super(StatementAST, self).__init__(slicc)
34 self.in_port = in_port
35 self.address = address
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# Copyright (c) 2010 Advanced Micro Devices, Inc.
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

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

28
29from slicc.ast.StatementAST import StatementAST
30
31class StallAndWaitStatementAST(StatementAST):
32 def __init__(self, slicc, in_port, address):
33 super(StatementAST, self).__init__(slicc)
34 self.in_port = in_port
35 self.address = address
36
36
37 def __repr__(self):
38 return "[StallAndWaitStatementAst: %r]" % self.in_port
39
40 def generate(self, code, return_type):
41 self.in_port.assertType("InPort")
42 self.address.assertType("Addr")
43
44 in_port_code = self.in_port.var.code
45 address_code = self.address.var.code
46 code('''
47 stallBuffer(&($in_port_code), $address_code);
48 $in_port_code.stallMessage($address_code, clockEdge());
49 ''')
37 def __repr__(self):
38 return "[StallAndWaitStatementAst: %r]" % self.in_port
39
40 def generate(self, code, return_type):
41 self.in_port.assertType("InPort")
42 self.address.assertType("Addr")
43
44 in_port_code = self.in_port.var.code
45 address_code = self.address.var.code
46 code('''
47 stallBuffer(&($in_port_code), $address_code);
48 $in_port_code.stallMessage($address_code, clockEdge());
49 ''')