Skip to content
This repository
Newer
Older
100644 129 lines (105 sloc) 3.523 kb
3ff6912b »
1999-07-03 Elaborate user defined tasks.
1 #ifndef __PTask_H
2 #define __PTask_H
3 /*
f7498673 »
2012-03-02 Rework rules for variable_dimensions, and support more syntax.
4 * Copyright (c) 1999-2008,2010,2012 Stephen Williams (steve@icarus.com)
3ff6912b »
1999-07-03 Elaborate user defined tasks.
5 *
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)
10 * any later version.
11 *
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.
16 *
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
f5aafc32 »
2012-08-28 updated FSF-address
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3ff6912b »
1999-07-03 Elaborate user defined tasks.
20 */
21
22 # include "LineInfo.h"
3f2fa294 »
2008-02-13 Factor compile-time scopes into PScope class
23 # include "PScope.h"
93a77a2e »
1999-07-24 Elaborate task input ports.
24 # include "svector.h"
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
25 # include "StringHeap.h"
3ff6912b »
1999-07-03 Elaborate user defined tasks.
26 # include <string>
f0bf6427 »
2011-09-17 SystemVerilog has more lax rules for function declarations.
27 # include <vector>
cced1e77 »
2010-10-25 Remove some uses of the svector template.
28 # include <list>
3ff6912b »
1999-07-03 Elaborate user defined tasks.
29 class Design;
e7efc270 »
2000-03-08 Redesign the implementation of scopes and parameters.
30 class NetScope;
93a77a2e »
1999-07-24 Elaborate task input ports.
31 class PWire;
3ff6912b »
1999-07-03 Elaborate user defined tasks.
32 class Statement;
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
33 class PExpr;
34
35 enum PTaskFuncEnum {
36 PTF_NONE,
37 PTF_REG,
760f2182 »
2007-03-06 Support signed function return values.
38 PTF_REG_S,
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
39 PTF_INTEGER,
40 PTF_REAL,
41 PTF_REALTIME,
af6fd666 »
2010-10-02 Tasks functions with atom2 arguments.
42 PTF_TIME,
43 PTF_ATOM2,
0e01dcf2 »
2012-03-04 Miscellaneous SystemVerilog syntax.
44 PTF_ATOM2_S,
45 PTF_STRING,
46 PTF_VOID
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
47 };
48
49 struct PTaskFuncArg {
50 PTaskFuncEnum type;
13348ba7 »
2012-04-10 Ranges are ranges, not expression lists.
51 std::list<pform_range_t>*range;
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
52 };
3ff6912b »
1999-07-03 Elaborate user defined tasks.
53
54 /*
55 * The PTask holds the parsed definitions of a task.
56 */
3f2fa294 »
2008-02-13 Factor compile-time scopes into PScope class
57 class PTask : public PScope, public LineInfo {
3ff6912b »
1999-07-03 Elaborate user defined tasks.
58
59 public:
b4f070e6 »
2010-01-08 Rework of lexical scope handling in parser.
60 explicit PTask(perm_string name, LexicalScope*parent, bool is_auto);
3ff6912b »
1999-07-03 Elaborate user defined tasks.
61 ~PTask();
62
02fc59fb »
2001-01-13 Parse parameters within nested scopes.
63 void set_ports(svector<PWire *>*p);
64 void set_statement(Statement *s);
65
e7efc270 »
2000-03-08 Redesign the implementation of scopes and parameters.
66 // Tasks introduce scope, to need to be handled during the
67 // scope elaboration pass. The scope passed is my scope,
68 // created by the containing scope. I fill it in with stuff if
69 // I need to.
70 void elaborate_scope(Design*des, NetScope*scope) const;
71
0243fca8 »
2000-07-30 Rearrange task and function elaboration so that the
72 // Bind the ports to the regs that are the ports.
73 void elaborate_sig(Design*des, NetScope*scope) const;
74
75 // Elaborate the statement to finish off the task definition.
82831ea9 »
2001-11-22 Use NetScope instead of string for scope path.
76 void elaborate(Design*des, NetScope*scope) const;
efa5222c »
1999-09-30 Handle mutual reference of tasks by elaborating
77
11109f51 »
2008-08-19 Push the automatic property for tasks and functions to the code gen.
78 bool is_auto() const { return is_auto_; };
79
3ff6912b »
1999-07-03 Elaborate user defined tasks.
80 void dump(ostream&, unsigned) const;
81
82 private:
93a77a2e »
1999-07-24 Elaborate task input ports.
83 svector<PWire*>*ports_;
3ff6912b »
1999-07-03 Elaborate user defined tasks.
84 Statement*statement_;
11109f51 »
2008-08-19 Push the automatic property for tasks and functions to the code gen.
85 bool is_auto_;
3ff6912b »
1999-07-03 Elaborate user defined tasks.
86
87 private: // Not implemented
88 PTask(const PTask&);
89 PTask& operator=(const PTask&);
90 };
91
23acca48 »
1999-08-25 elaborate some aspects of functions.
92 /*
93 * The function is similar to a task (in this context) but there is a
94 * single output port and a set of input ports. The output port is the
95 * function return value.
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
96 *
97 * The output value is not elaborated until elaborate_sig.
23acca48 »
1999-08-25 elaborate some aspects of functions.
98 */
3f2fa294 »
2008-02-13 Factor compile-time scopes into PScope class
99 class PFunction : public PScope, public LineInfo {
23acca48 »
1999-08-25 elaborate some aspects of functions.
100
101 public:
b4f070e6 »
2010-01-08 Rework of lexical scope handling in parser.
102 explicit PFunction(perm_string name, LexicalScope*parent, bool is_auto);
e0a988bf »
1999-07-31 Add functions up to elaboration (Ed Carter)
103 ~PFunction();
104
02fc59fb »
2001-01-13 Parse parameters within nested scopes.
105 void set_ports(svector<PWire *>*p);
106 void set_statement(Statement *s);
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
107 void set_return(PTaskFuncArg t);
23acca48 »
1999-08-25 elaborate some aspects of functions.
108
e7efc270 »
2000-03-08 Redesign the implementation of scopes and parameters.
109 void elaborate_scope(Design*des, NetScope*scope) const;
110
0243fca8 »
2000-07-30 Rearrange task and function elaboration so that the
111 /* elaborate the ports and return value. */
112 void elaborate_sig(Design *des, NetScope*) const;
113
114 /* Elaborate the behavioral statement. */
115 void elaborate(Design *des, NetScope*) const;
9f7eb4a9 »
1999-09-01 Handle recursive functions and arbitrary function
116
11109f51 »
2008-08-19 Push the automatic property for tasks and functions to the code gen.
117 bool is_auto() const { return is_auto_; };
118
e0a988bf »
1999-07-31 Add functions up to elaboration (Ed Carter)
119 void dump(ostream&, unsigned) const;
120
23acca48 »
1999-08-25 elaborate some aspects of functions.
121 private:
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
122 PTaskFuncArg return_type_;
e0a988bf »
1999-07-31 Add functions up to elaboration (Ed Carter)
123 svector<PWire *> *ports_;
124 Statement *statement_;
11109f51 »
2008-08-19 Push the automatic property for tasks and functions to the code gen.
125 bool is_auto_;
e0a988bf »
1999-07-31 Add functions up to elaboration (Ed Carter)
126 };
127
3ff6912b »
1999-07-03 Elaborate user defined tasks.
128 #endif
Something went wrong with that request. Please try again.