EnqueueStatementAST.py (10967:b36204de88c0) EnqueueStatementAST.py (11111:6da33e720481)
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

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

60
61 # The other statements
62 t = self.statements.generate(code, None)
63 self.queue_name.assertType("OutPort")
64
65 if self.latexpr != None:
66 ret_type, rcode = self.latexpr.inline(True)
67 code("(${{self.queue_name.var.code}}).enqueue(" \
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

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

60
61 # The other statements
62 t = self.statements.generate(code, None)
63 self.queue_name.assertType("OutPort")
64
65 if self.latexpr != None:
66 ret_type, rcode = self.latexpr.inline(True)
67 code("(${{self.queue_name.var.code}}).enqueue(" \
68 "out_msg, Cycles($rcode));")
68 "out_msg, clockEdge(), cyclesToTicks(Cycles($rcode)));")
69 else:
69 else:
70 code("(${{self.queue_name.var.code}}).enqueue(out_msg);")
70 code("(${{self.queue_name.var.code}}).enqueue(out_msg, "\
71 "clockEdge(), cyclesToTicks(Cycles(1)));")
71
72 # End scope
73 self.symtab.popFrame()
74 code.dedent()
75 code("}")
76
77 def findResources(self, resources):
78 var = self.queue_name.var
79 res_count = int(resources.get(var, 0))
80 resources[var] = str(res_count + 1)
72
73 # End scope
74 self.symtab.popFrame()
75 code.dedent()
76 code("}")
77
78 def findResources(self, resources):
79 var = self.queue_name.var
80 res_count = int(resources.get(var, 0))
81 resources[var] = str(res_count + 1)