2 * Copyright (c) 1999-2007 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: PWire.cc,v 1.14 2007/05/24 04:07:11 steve Exp $"
27 PWire::PWire(const pform_name_t
&n
,
30 ivl_variable_type_t dt
)
31 : hname_(n
), type_(t
), port_type_(pt
), data_type_(dt
),
32 signed_(false), isint_(false),
35 if (t
== NetNet::INTEGER
) {
42 NetNet::Type
PWire::get_wire_type() const
47 const pform_name_t
& PWire::path() const
52 bool PWire::set_wire_type(NetNet::Type t
)
54 assert(t
!= NetNet::IMPLICIT
);
57 case NetNet::IMPLICIT
:
60 case NetNet::IMPLICIT_REG
:
61 if (t
== NetNet::REG
) { type_
= t
; return true; }
64 if (t
== NetNet::INTEGER
) {
68 if (t
== NetNet::REG
) return true;
78 NetNet::PortType
PWire::get_port_type() const
83 bool PWire::set_port_type(NetNet::PortType pt
)
85 assert(pt
!= NetNet::NOT_A_PORT
);
86 assert(pt
!= NetNet::PIMPLICIT
);
89 case NetNet::PIMPLICIT
:
93 case NetNet::NOT_A_PORT
:
104 bool PWire::set_data_type(ivl_variable_type_t dt
)
106 if (data_type_
!= IVL_VT_NO_TYPE
)
107 if (data_type_
!= dt
)
112 assert(data_type_
== IVL_VT_NO_TYPE
);
117 void PWire::set_signed(bool flag
)
122 bool PWire::get_signed() const
127 bool PWire::get_isint() const
132 void PWire::set_range(PExpr
*m
, PExpr
*l
)
134 msb_
= svector
<PExpr
*>(msb_
,m
);
135 lsb_
= svector
<PExpr
*>(lsb_
,l
);
138 void PWire::set_memory_idx(PExpr
*ldx
, PExpr
*rdx
)
148 * Revision 1.14 2007/05/24 04:07:11 steve
149 * Rework the heirarchical identifier parse syntax and pform
150 * to handle more general combinations of heirarch and bit selects.
152 * Revision 1.13 2007/04/26 03:06:21 steve
153 * Rework hname_t to use perm_strings.
155 * Revision 1.12 2007/01/16 05:44:14 steve
156 * Major rework of array handling. Memories are replaced with the
157 * more general concept of arrays. The NetMemory and NetEMemory
158 * classes are removed from the ivl core program, and the IVL_LPM_RAM
159 * lpm type is removed from the ivl_target API.
161 * Revision 1.11 2005/07/07 16:22:49 steve
162 * Generalize signals to carry types.
164 * Revision 1.10 2002/08/12 01:34:58 steve
165 * conditional ident string using autoconfig.
167 * Revision 1.9 2002/06/21 04:59:35 steve
168 * Carry integerness throughout the compilation.
170 * Revision 1.8 2002/01/26 05:28:28 steve
171 * Detect scalar/vector declarion mismatch.
173 * Revision 1.7 2001/12/03 04:47:14 steve
174 * Parser and pform use hierarchical names as hname_t
175 * objects instead of encoded strings.
177 * Revision 1.6 2001/07/25 03:10:48 steve
178 * Create a config.h.in file to hold all the config
179 * junk, and support gcc 3.0. (Stephan Boettcher)
181 * Revision 1.5 2001/01/06 02:29:35 steve
182 * Support arrays of integers.
184 * Revision 1.4 2000/12/11 00:31:43 steve
185 * Add support for signed reg variables,
186 * simulate in t-vvm signed comparisons.
188 * Revision 1.3 2000/02/23 02:56:54 steve
189 * Macintosh compilers do not support ident.
191 * Revision 1.2 1999/09/10 05:02:09 steve
192 * Handle integers at task parameters.
194 * Revision 1.1 1999/06/17 05:34:42 steve
195 * Clean up interface of the PWire class,
196 * Properly match wire ranges.