Skip to content
This repository
Newer
Older
100644 180 lines (155 sloc) 7.119 kb
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
1 #ifndef __target_H
2 #define __target_H
3 /*
1e3af453 »
2011-03-07 Pass some module port information and fix a few bugs.
4 * Copyright (c) 1998-2011 Stephen Williams (steve@icarus.com)
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
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.
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
20 */
21
22 # include "netlist.h"
23
24 /*
25 * This header file describes the types and constants used to describe
26 * the possible target output types of the compiler. The backends
27 * provide one of these in order to tell the previous steps what the
28 * backend is able to do.
29 */
30
31 /*
32 * The backend driver is hooked into the compiler, and given a name,
33 * by creating an instance of the target structure. The structure has
34 * the name that the compiler will use to locate the driver, and a
35 * pointer to a target_t object that is the actual driver.
36 */
37 struct target {
d7788b88 »
2000-11-04 Modifications in support of gcc 2.96
38 const char* name;
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
39 struct target_t* meth;
40 };
41
42 /*
43 * The emit process uses a target_t driver to send the completed
44 * design to a file. It is up to the driver object to follow along in
45 * the iteration through the design, generating output as it can.
46 */
47
48 struct target_t {
49 virtual ~target_t();
50
d58533fd »
2000-08-08 target methods need not take a file stream.
51 /* Start the design. This sets the main output file stream
52 that the target should use. */
248baa26 »
2000-08-09 Move all file manipulation out of target class.
53 virtual bool start_design(const Design*) =0;
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
54
4cfa3e40 »
1999-11-27 Support the creation of scopes.
55 /* This is called once for each scope in the design, before
56 anything else is called. */
d58533fd »
2000-08-08 target methods need not take a file stream.
57 virtual void scope(const NetScope*);
4cfa3e40 »
1999-11-27 Support the creation of scopes.
58
1e3af453 »
2011-03-07 Pass some module port information and fix a few bugs.
59 /* This is called to convert module ports from a NetNet* to an
60 * ivl_signal_t object. */
61 virtual void convert_module_ports(const NetScope*);
62
30e82892 »
2000-04-04 Simulate named event trigger and waits.
63 /* Output an event object. Called for each named event in the scope. */
d58533fd »
2000-08-08 target methods need not take a file stream.
64 virtual void event(const NetEvent*);
30e82892 »
2000-04-04 Simulate named event trigger and waits.
65
de215f1f »
2010-11-20 Describe enum type to code generators
66 /* Output an enumeration typespec. */
67 virtual bool enumeration(const NetScope*, netenum_t*);
68
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
69 /* Output a signal (called for each signal) */
ff32325d »
2000-08-27 t-dll iterates signals, and passes them to the
70 virtual void signal(const NetNet*) =0;
21522c90 »
2006-11-10 Process delay paths in second path over signals.
71 virtual bool signal_paths(const NetNet*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
72
25201954 »
2008-11-09 Bring branches forward as far as the emit method and target_t.
73 /* Analog branches */
74 virtual bool branch(const NetBranch*);
75
3ff6912b »
1999-07-03 Elaborate user defined tasks.
76 /* Output a defined task. */
f40d006c »
2001-04-02 Generate code for task calls.
77 virtual void task_def(const NetScope*);
5472b27e »
2004-05-31 Rewire/generalize parsing an elaboration of
78 virtual bool func_def(const NetScope*);
3ff6912b »
1999-07-03 Elaborate user defined tasks.
79
41a1c6bb »
1999-09-03 elaborate the binary plus operator.
80 /* LPM style components are handled here. */
e91243e1 »
2008-05-05 Elaborate abs() is continuous assign expressions.
81 virtual void lpm_abs(const NetAbs*);
d58533fd »
2000-08-08 target methods need not take a file stream.
82 virtual void lpm_add_sub(const NetAddSub*);
91d84e7d »
2007-01-16 Major rework of array handling. Memories are replaced with the
83 virtual bool lpm_array_dq(const NetArrayDq*);
d58533fd »
2000-08-08 target methods need not take a file stream.
84 virtual void lpm_clshift(const NetCLShift*);
9c634e16 »
2010-10-16 Add a net node for casting to IVL_VT_BOOL values.
85 virtual bool lpm_cast_int2(const NetCastInt2*);
86 virtual bool lpm_cast_int4(const NetCastInt4*);
37723698 »
2008-06-17 Handle non-real operands to real division.
87 virtual bool lpm_cast_real(const NetCastReal*);
d58533fd »
2000-08-08 target methods need not take a file stream.
88 virtual void lpm_compare(const NetCompare*);
89 virtual void lpm_divide(const NetDivide*);
89d71767 »
2000-09-17 Add support for modulus (Eric Aardoom)
90 virtual void lpm_modulo(const NetModulo*);
d58533fd »
2000-08-08 target methods need not take a file stream.
91 virtual void lpm_ff(const NetFF*);
92 virtual void lpm_mult(const NetMult*);
93 virtual void lpm_mux(const NetMux*);
5e8a1bd8 »
2008-01-30 Add power operator (**) for real values in a continuous assignment.
94 virtual void lpm_pow(const NetPow*);
41a1c6bb »
1999-09-03 elaborate the binary plus operator.
95
8f2d679c »
2004-12-29 Unify elaboration of l-values for all proceedural assignments,
96 virtual bool concat(const NetConcat*);
65e9b6be »
2004-12-11 Rework of internals to carry vectors through nexus instead
97 virtual bool part_select(const NetPartSelect*);
ee5bb5fc »
2005-02-08 Add the NetRepeat node, and code generator support.
98 virtual bool replicate(const NetReplicate*);
65e9b6be »
2004-12-11 Rework of internals to carry vectors through nexus instead
99
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
100 /* Output a gate (called for each gate) */
d58533fd »
2000-08-08 target methods need not take a file stream.
101 virtual void logic(const NetLogic*);
ec773fe8 »
2008-05-19 Elaborate tran devices
102 virtual bool tran(const NetTran*);
97f83ffb »
2005-02-03 laborate reduction gates into LPM_RED_ nodes.
103 virtual bool ureduce(const NetUReduce*); /* unary reduction operator */
9abd8495 »
2000-08-14 add th t-dll functions for net_const, net_bufz and processes.
104 virtual bool bufz(const NetBUFZ*);
d58533fd »
2000-08-08 target methods need not take a file stream.
105 virtual void udp(const NetUDP*);
106 virtual void net_case_cmp(const NetCaseCmp*);
9abd8495 »
2000-08-14 add th t-dll functions for net_const, net_bufz and processes.
107 virtual bool net_const(const NetConst*);
80f30be9 »
2006-06-18 Add support for system functions in continuous assignments.
108 virtual bool net_sysfunction(const NetSysFunc*);
b7c2bd4f »
2002-03-09 Add the NetUserFunc netlist node.
109 virtual bool net_function(const NetUserFunc*);
75ad9053 »
2005-07-07 Generalize signals to carry types.
110 virtual bool net_literal(const NetLiteral*);
d58533fd »
2000-08-08 target methods need not take a file stream.
111 virtual void net_probe(const NetEvProbe*);
739a1839 »
2005-05-24 Do sign extension of structuran nets.
112 virtual bool sign_extend(const NetSignExtend*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
113
7ba7b925 »
1999-07-17 simplified process scan for targets.
114 /* Output a process (called for each process). It is up to the
115 target to recurse if desired. */
d58533fd »
2000-08-08 target methods need not take a file stream.
116 virtual bool process(const NetProcTop*);
13aaaab7 »
2008-11-06 Bring analog contribution statements to the ivl_target API.
117 virtual bool process(const NetAnalogTop*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
118
119 /* Various kinds of process nodes are dispatched through these. */
7ebcc6b3 »
2008-09-27 Support for automatic tasks and functions.
120 virtual void proc_alloc(const NetAlloc*);
9f04641f »
2008-07-30 Detect and elaborate AMS access functions.
121 virtual bool proc_assign(const NetAssign*);
d58533fd »
2000-08-08 target methods need not take a file stream.
122 virtual void proc_assign_nb(const NetAssignNB*);
123 virtual bool proc_block(const NetBlock*);
124 virtual void proc_case(const NetCase*);
125 virtual bool proc_cassign(const NetCAssign*);
608555ce »
2002-01-19 Pass back target errors processing conditionals.
126 virtual bool proc_condit(const NetCondit*);
13aaaab7 »
2008-11-06 Bring analog contribution statements to the ivl_target API.
127 virtual bool proc_contribution(const NetContribution*);
d58533fd »
2000-08-08 target methods need not take a file stream.
128 virtual bool proc_deassign(const NetDeassign*);
129 virtual bool proc_delay(const NetPDelay*);
130 virtual bool proc_disable(const NetDisable*);
131 virtual bool proc_force(const NetForce*);
132 virtual void proc_forever(const NetForever*);
7ebcc6b3 »
2008-09-27 Support for automatic tasks and functions.
133 virtual void proc_free(const NetFree*);
d58533fd »
2000-08-08 target methods need not take a file stream.
134 virtual bool proc_release(const NetRelease*);
135 virtual void proc_repeat(const NetRepeat*);
136 virtual bool proc_trigger(const NetEvTrig*);
137 virtual void proc_stask(const NetSTask*);
138 virtual void proc_utask(const NetUTask*);
139 virtual bool proc_wait(const NetEvWait*);
140 virtual void proc_while(const NetWhile*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
141
afb8e285 »
2001-03-27 Support error code from target_t::end_design method.
142 /* Done with the design. The target returns !0 if there is
143 some error in the code generation. */
144 virtual int end_design(const Design*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
145 };
146
147 /* This class is used by the NetExpr class to help with the scanning
148 of expressions. */
149 struct expr_scan_t {
150 virtual ~expr_scan_t();
9f04641f »
2008-07-30 Detect and elaborate AMS access functions.
151 virtual void expr_access_func(const NetEAccess*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
152 virtual void expr_const(const NetEConst*);
1222153c »
2003-03-10 Keep parameter constants for the ivl_target API.
153 virtual void expr_param(const NetEConstParam*);
5903f074 »
2003-05-30 Support parameters in real expressions and
154 virtual void expr_rparam(const NetECRealParam*);
46253ed8 »
2003-01-26 Rework expression parsing and elaboration to
155 virtual void expr_creal(const NetECReal*);
1464851e »
1999-06-09 Add support for procedural concatenation expression.
156 virtual void expr_concat(const NetEConcat*);
f1cc9d86 »
2003-04-22 Support event names as expressions elements.
157 virtual void expr_event(const NetEEvent*);
4cfa3e40 »
1999-11-27 Support the creation of scopes.
158 virtual void expr_scope(const NetEScope*);
364ffc90 »
2002-01-28 Add support for bit select of parameters.
159 virtual void expr_select(const NetESelect*);
fbe475ef »
2000-05-04 Add infrastructure for system functions, move
160 virtual void expr_sfunc(const NetESFunc*);
b1186341 »
1998-11-07 Handle procedural conditional, and some
161 virtual void expr_signal(const NetESignal*);
a5921cea »
1999-07-17 netlist support for ternary operator.
162 virtual void expr_ternary(const NetETernary*);
e69345b9 »
1999-08-31 Elaborate and emit to vvm procedural functions.
163 virtual void expr_ufunc(const NetEUFunc*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
164 virtual void expr_unary(const NetEUnary*);
b1186341 »
1998-11-07 Handle procedural conditional, and some
165 virtual void expr_binary(const NetEBinary*);
de215f1f »
2010-11-20 Describe enum type to code generators
166 virtual void expr_netenum(const NetENetenum*);
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
167 };
168
169
d9ac146b »
2008-01-29 Spelling fixes
170 /* This function takes a fully qualified Verilog name (which may have,
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
171 for example, dots in it) and produces a mangled version that can be
172 used by most any language. */
173 extern string mangle(const string&str);
174
66cf3ec8 »
2001-04-22 More UDP consolidation from Stephan Boettcher.
175 /* This function takes a string and produces an escaped version that can be
176 used inside a string constant for a C++ compiler. */
177 extern string stresc(const string&str);
178
3fb7a053 »
1998-11-03 Introduce verilog to CVS.
179 #endif
Something went wrong with that request. Please try again.