4 * Copyright (c) 1998-2007 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 #ident "$Id: PWire.h,v 1.21 2007/05/24 04:07:11 steve Exp $"
26 # include "LineInfo.h"
29 # include "StringHeap.h"
41 * Wires include nets, registers and ports. A net or register becomes
42 * a port by declaration, so ports are not separate. The module
43 * identifies a port by keeping it in its port list.
45 * The hname parameter to the constructor is a hierarchical name. It
46 * is the name of the wire within a module, so does not include the
47 * current scope or any instances. Modules contain all the wires, so
48 * from that perspective, sub-scopes within the module are a part of
51 class PWire
: public LineInfo
{
54 PWire(const pform_name_t
&hname
,
57 ivl_variable_type_t dt
);
59 // Return a hierarchical name.
60 const pform_name_t
&path() const;
62 NetNet::Type
get_wire_type() const;
63 bool set_wire_type(NetNet::Type
);
65 NetNet::PortType
get_port_type() const;
66 bool set_port_type(NetNet::PortType
);
68 void set_signed(bool flag
);
69 bool get_signed() const;
70 bool get_isint() const;
72 bool set_data_type(ivl_variable_type_t dt
);
73 ivl_variable_type_t
get_data_type() const;
75 void set_range(PExpr
*msb
, PExpr
*lsb
);
77 void set_memory_idx(PExpr
*ldx
, PExpr
*rdx
);
79 map
<perm_string
,PExpr
*> attributes
;
81 // Write myself to the specified stream.
82 void dump(ostream
&out
, unsigned ind
=4) const;
84 NetNet
* elaborate_sig(Design
*, NetScope
*scope
) const;
89 NetNet::PortType port_type_
;
90 ivl_variable_type_t data_type_
;
92 bool isint_
; // original type of integer
94 // These members hold expressions for the bit width of the
95 // wire. If they do not exist, the wire is 1 bit wide.
99 // If this wire is actually a memory, these indices will give
100 // me the size and address range of the memory.
104 private: // not implemented
106 PWire
& operator= (const PWire
&);
111 * Revision 1.21 2007/05/24 04:07:11 steve
112 * Rework the heirarchical identifier parse syntax and pform
113 * to handle more general combinations of heirarch and bit selects.
115 * Revision 1.20 2007/04/26 03:06:22 steve
116 * Rework hname_t to use perm_strings.
118 * Revision 1.19 2006/04/10 00:37:42 steve
119 * Add support for generate loops w/ wires and gates.
121 * Revision 1.18 2005/07/07 16:22:49 steve
122 * Generalize signals to carry types.
124 * Revision 1.17 2004/02/20 18:53:33 steve
125 * Addtrbute keys are perm_strings.
127 * Revision 1.16 2003/01/30 16:23:07 steve
130 * Revision 1.15 2003/01/26 21:15:58 steve
131 * Rework expression parsing and elaboration to
132 * accommodate real/realtime values and expressions.
134 * Revision 1.14 2002/08/12 01:34:58 steve
135 * conditional ident string using autoconfig.
137 * Revision 1.13 2002/06/21 04:59:35 steve
138 * Carry integerness throughout the compilation.
140 * Revision 1.12 2002/05/23 03:08:51 steve
141 * Add language support for Verilog-2001 attribute
142 * syntax. Hook this support into existing $attribute
143 * handling, and add number and void value types.
145 * Add to the ivl_target API new functions for access
146 * of complex attributes attached to gates.
148 * Revision 1.11 2001/12/03 04:47:14 steve
149 * Parser and pform use hierarchical names as hname_t
150 * objects instead of encoded strings.
152 * Revision 1.10 2001/01/16 02:44:18 steve
153 * Use the iosfwd header if available.