1998-11-04 00:28:49 +01:00
|
|
|
#ifndef __PWire_H
|
|
|
|
|
#define __PWire_H
|
|
|
|
|
/*
|
2000-02-23 03:56:53 +01:00
|
|
|
* Copyright (c) 1998-2000 Stephen Williams (steve@icarus.com)
|
1998-11-04 00:28:49 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
2002-08-12 03:34:58 +02:00
|
|
|
#ifdef HAVE_CVS_IDENT
|
2004-02-20 19:53:33 +01:00
|
|
|
#ident "$Id: PWire.h,v 1.17 2004/02/20 18:53:33 steve Exp $"
|
1998-11-04 00:28:49 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
# include "netlist.h"
|
1999-06-02 17:38:46 +02:00
|
|
|
# include "LineInfo.h"
|
2001-01-16 03:44:17 +01:00
|
|
|
# include <map>
|
1999-06-17 07:34:42 +02:00
|
|
|
# include "svector.h"
|
2001-01-16 03:44:17 +01:00
|
|
|
|
|
|
|
|
#ifdef HAVE_IOSFWD
|
|
|
|
|
# include <iosfwd>
|
|
|
|
|
#else
|
1998-11-04 00:28:49 +01:00
|
|
|
class ostream;
|
2001-01-16 03:44:17 +01:00
|
|
|
#endif
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
class PExpr;
|
|
|
|
|
class Design;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Wires include nets, registers and ports. A net or register becomes
|
2003-01-30 17:23:07 +01:00
|
|
|
* a port by declaration, so ports are not separate. The module
|
1998-11-04 00:28:49 +01:00
|
|
|
* identifies a port by keeping it in its port list.
|
2001-12-03 05:47:14 +01:00
|
|
|
*
|
|
|
|
|
* The hname parameter to the constructor is a hierarchical name. It
|
|
|
|
|
* is an array of strings starting with the root, running towards
|
|
|
|
|
* the base name, and terminated by a null pointer. The environment
|
|
|
|
|
* allocates the memory for me.
|
1998-11-04 00:28:49 +01:00
|
|
|
*/
|
1999-06-02 17:38:46 +02:00
|
|
|
class PWire : public LineInfo {
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
public:
|
2001-12-03 05:47:14 +01:00
|
|
|
PWire(const hname_t&hname, NetNet::Type t, NetNet::PortType pt);
|
|
|
|
|
PWire(char*name, NetNet::Type t, NetNet::PortType pt);
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2001-12-03 05:47:14 +01:00
|
|
|
// Return a hierarchical name.
|
|
|
|
|
const hname_t&path() const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
1999-06-17 07:34:42 +02:00
|
|
|
NetNet::Type get_wire_type() const;
|
|
|
|
|
bool set_wire_type(NetNet::Type);
|
|
|
|
|
|
|
|
|
|
NetNet::PortType get_port_type() const;
|
|
|
|
|
bool set_port_type(NetNet::PortType);
|
|
|
|
|
|
2000-12-11 01:31:43 +01:00
|
|
|
void set_signed(bool flag);
|
|
|
|
|
bool get_signed() const;
|
2002-06-21 06:59:35 +02:00
|
|
|
bool get_isint() const;
|
2000-12-11 01:31:43 +01:00
|
|
|
|
1999-06-17 07:34:42 +02:00
|
|
|
void set_range(PExpr*msb, PExpr*lsb);
|
|
|
|
|
|
|
|
|
|
void set_memory_idx(PExpr*ldx, PExpr*rdx);
|
1999-04-19 03:59:36 +02:00
|
|
|
|
2004-02-20 19:53:33 +01:00
|
|
|
map<perm_string,PExpr*> attributes;
|
1998-11-23 01:20:22 +01:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
// Write myself to the specified stream.
|
|
|
|
|
void dump(ostream&out) const;
|
|
|
|
|
|
2000-05-02 18:27:38 +02:00
|
|
|
void elaborate_sig(Design*, NetScope*scope) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
1999-06-17 07:34:42 +02:00
|
|
|
private:
|
2001-12-03 05:47:14 +01:00
|
|
|
hname_t hname_;
|
1999-06-17 07:34:42 +02:00
|
|
|
NetNet::Type type_;
|
|
|
|
|
NetNet::PortType port_type_;
|
2000-12-11 01:31:43 +01:00
|
|
|
bool signed_;
|
2002-06-21 06:59:35 +02:00
|
|
|
bool isint_; // original type of integer
|
1999-06-17 07:34:42 +02:00
|
|
|
|
|
|
|
|
// These members hold expressions for the bit width of the
|
|
|
|
|
// wire. If they do not exist, the wire is 1 bit wide.
|
|
|
|
|
svector<PExpr*>msb_;
|
|
|
|
|
svector<PExpr*>lsb_;
|
|
|
|
|
|
|
|
|
|
// If this wire is actually a memory, these indices will give
|
|
|
|
|
// me the size and address range of the memory.
|
|
|
|
|
PExpr*lidx_;
|
|
|
|
|
PExpr*ridx_;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
private: // not implemented
|
|
|
|
|
PWire(const PWire&);
|
|
|
|
|
PWire& operator= (const PWire&);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* $Log: PWire.h,v $
|
2004-02-20 19:53:33 +01:00
|
|
|
* Revision 1.17 2004/02/20 18:53:33 steve
|
|
|
|
|
* Addtrbute keys are perm_strings.
|
|
|
|
|
*
|
2003-01-30 17:23:07 +01:00
|
|
|
* Revision 1.16 2003/01/30 16:23:07 steve
|
|
|
|
|
* Spelling fixes.
|
|
|
|
|
*
|
2003-01-26 22:15:58 +01:00
|
|
|
* Revision 1.15 2003/01/26 21:15:58 steve
|
|
|
|
|
* Rework expression parsing and elaboration to
|
|
|
|
|
* accommodate real/realtime values and expressions.
|
|
|
|
|
*
|
2002-08-12 03:34:58 +02:00
|
|
|
* Revision 1.14 2002/08/12 01:34:58 steve
|
|
|
|
|
* conditional ident string using autoconfig.
|
|
|
|
|
*
|
2002-06-21 06:59:35 +02:00
|
|
|
* Revision 1.13 2002/06/21 04:59:35 steve
|
|
|
|
|
* Carry integerness throughout the compilation.
|
|
|
|
|
*
|
2002-05-23 05:08:50 +02:00
|
|
|
* Revision 1.12 2002/05/23 03:08:51 steve
|
|
|
|
|
* Add language support for Verilog-2001 attribute
|
|
|
|
|
* syntax. Hook this support into existing $attribute
|
|
|
|
|
* handling, and add number and void value types.
|
|
|
|
|
*
|
|
|
|
|
* Add to the ivl_target API new functions for access
|
|
|
|
|
* of complex attributes attached to gates.
|
|
|
|
|
*
|
2001-12-03 05:47:14 +01:00
|
|
|
* Revision 1.11 2001/12/03 04:47:14 steve
|
|
|
|
|
* Parser and pform use hierarchical names as hname_t
|
|
|
|
|
* objects instead of encoded strings.
|
|
|
|
|
*
|
2001-01-16 03:44:17 +01:00
|
|
|
* Revision 1.10 2001/01/16 02:44:18 steve
|
|
|
|
|
* Use the iosfwd header if available.
|
|
|
|
|
*
|
2000-12-11 01:31:43 +01:00
|
|
|
* Revision 1.9 2000/12/11 00:31:43 steve
|
|
|
|
|
* Add support for signed reg variables,
|
|
|
|
|
* simulate in t-vvm signed comparisons.
|
|
|
|
|
*
|
2000-05-02 18:27:38 +02:00
|
|
|
* Revision 1.8 2000/05/02 16:27:38 steve
|
|
|
|
|
* Move signal elaboration to a seperate pass.
|
|
|
|
|
*
|
2000-02-23 03:56:53 +01:00
|
|
|
* Revision 1.7 2000/02/23 02:56:54 steve
|
|
|
|
|
* Macintosh compilers do not support ident.
|
|
|
|
|
*
|
1999-11-27 20:07:57 +01:00
|
|
|
* Revision 1.6 1999/11/27 19:07:57 steve
|
|
|
|
|
* Support the creation of scopes.
|
|
|
|
|
*
|
1999-06-17 07:34:42 +02:00
|
|
|
* Revision 1.5 1999/06/17 05:34:42 steve
|
|
|
|
|
* Clean up interface of the PWire class,
|
|
|
|
|
* Properly match wire ranges.
|
|
|
|
|
*
|
1999-06-02 17:38:46 +02:00
|
|
|
* Revision 1.4 1999/06/02 15:38:46 steve
|
|
|
|
|
* Line information with nets.
|
|
|
|
|
*
|
1999-04-19 03:59:36 +02:00
|
|
|
* Revision 1.3 1999/04/19 01:59:36 steve
|
|
|
|
|
* Add memories to the parse and elaboration phases.
|
|
|
|
|
*
|
1998-11-23 01:20:22 +01:00
|
|
|
* Revision 1.2 1998/11/23 00:20:22 steve
|
|
|
|
|
* NetAssign handles lvalues as pin links
|
|
|
|
|
* instead of a signal pointer,
|
|
|
|
|
* Wire attributes added,
|
|
|
|
|
* Ability to parse UDP descriptions added,
|
|
|
|
|
* XNF generates EXT records for signals with
|
|
|
|
|
* the PAD attribute.
|
|
|
|
|
*
|
1998-11-04 00:28:49 +01:00
|
|
|
* Revision 1.1 1998/11/03 23:28:55 steve
|
|
|
|
|
* Introduce verilog to CVS.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#endif
|