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 * The different type of PWire::set_range() calls.
43 enum PWSRType
{SR_PORT
, SR_NET
, SR_BOTH
};
46 * Wires include nets, registers and ports. A net or register becomes
47 * a port by declaration, so ports are not separate. The module
48 * identifies a port by keeping it in its port list.
50 * The hname parameter to the constructor is a hierarchical name. It
51 * is the name of the wire within a module, so does not include the
52 * current scope or any instances. Modules contain all the wires, so
53 * from that perspective, sub-scopes within the module are a part of
56 class PWire
: public LineInfo
{
59 PWire(const pform_name_t
&hname
,
62 ivl_variable_type_t dt
);
64 // Return a hierarchical name.
65 const pform_name_t
&path() const;
67 NetNet::Type
get_wire_type() const;
68 bool set_wire_type(NetNet::Type
);
70 NetNet::PortType
get_port_type() const;
71 bool set_port_type(NetNet::PortType
);
73 void set_signed(bool flag
);
74 bool get_signed() const;
75 bool get_isint() const;
77 bool set_data_type(ivl_variable_type_t dt
);
78 ivl_variable_type_t
get_data_type() const;
80 void set_range(PExpr
*msb
, PExpr
*lsb
, PWSRType type
);
83 void set_memory_idx(PExpr
*ldx
, PExpr
*rdx
);
85 map
<perm_string
,PExpr
*> attributes
;
87 // Write myself to the specified stream.
88 void dump(ostream
&out
, unsigned ind
=4) const;
90 NetNet
* elaborate_sig(Design
*, NetScope
*scope
) const;
95 NetNet::PortType port_type_
;
96 ivl_variable_type_t data_type_
;
98 bool isint_
; // original type of integer
100 // These members hold expressions for the bit width of the
101 // wire. If they do not exist, the wire is 1 bit wide.
110 // If this wire is actually a memory, these indices will give
111 // me the size and address range of the memory.
115 private: // not implemented
117 PWire
& operator= (const PWire
&);