4 * Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 # include "LineInfo.h"
25 # include "StringHeap.h"
45 svector
<PExpr
*>*range
;
49 * The PTask holds the parsed definitions of a task.
51 class PTask
: public PScope
, public LineInfo
{
54 explicit PTask(perm_string name
, PScope
*parent
);
57 void set_ports(svector
<PWire
*>*p
);
58 void set_statement(Statement
*s
);
60 // Tasks introduce scope, to need to be handled during the
61 // scope elaboration pass. The scope passed is my scope,
62 // created by the containing scope. I fill it in with stuff if
64 void elaborate_scope(Design
*des
, NetScope
*scope
) const;
66 // Bind the ports to the regs that are the ports.
67 void elaborate_sig(Design
*des
, NetScope
*scope
) const;
69 // Elaborate the statement to finish off the task definition.
70 void elaborate(Design
*des
, NetScope
*scope
) const;
72 void dump(ostream
&, unsigned) const;
75 svector
<PWire
*>*ports_
;
78 private: // Not implemented
80 PTask
& operator=(const PTask
&);
84 * The function is similar to a task (in this context) but there is a
85 * single output port and a set of input ports. The output port is the
86 * function return value.
88 * The output value is not elaborated until elaborate_sig.
90 class PFunction
: public PScope
, public LineInfo
{
93 explicit PFunction(perm_string name
, PScope
*parent
);
96 void set_ports(svector
<PWire
*>*p
);
97 void set_statement(Statement
*s
);
98 void set_return(PTaskFuncArg t
);
100 void elaborate_scope(Design
*des
, NetScope
*scope
) const;
102 /* elaborate the ports and return value. */
103 void elaborate_sig(Design
*des
, NetScope
*) const;
105 /* Elaborate the behavioral statement. */
106 void elaborate(Design
*des
, NetScope
*) const;
108 void dump(ostream
&, unsigned) const;
111 PTaskFuncArg return_type_
;
112 svector
<PWire
*> *ports_
;
113 Statement
*statement_
;