Support arrays of integers.

This commit is contained in:
steve 2001-01-06 02:29:35 +00:00
parent 2703456ad4
commit 68e672e61a
8 changed files with 47 additions and 26 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PWire.cc,v 1.4 2000/12/11 00:31:43 steve Exp $"
#ident "$Id: PWire.cc,v 1.5 2001/01/06 02:29:35 steve Exp $"
#endif
# include "PWire.h"
@ -43,11 +43,9 @@ bool PWire::set_wire_type(NetNet::Type t)
return true;
case NetNet::IMPLICIT_REG:
if (t == NetNet::REG) { type_ = t; return true; }
if (t == NetNet::INTEGER) {type_ = t; return true; }
return false;
case NetNet::REG:
if (t == NetNet::REG) return true;
if (t == NetNet::INTEGER) {type_ = t; return true; }
return false;
default:
if (type_ != t)
@ -103,13 +101,16 @@ void PWire::set_memory_idx(PExpr*ldx, PExpr*rdx)
{
assert(lidx_ == 0);
assert(ridx_ == 0);
assert((type_ == NetNet::REG) || (type_ == NetNet::INTEGER));
assert(type_ == NetNet::REG);
lidx_ = ldx;
ridx_ = rdx;
}
/*
* $Log: PWire.cc,v $
* Revision 1.5 2001/01/06 02:29:35 steve
* Support arrays of integers.
*
* Revision 1.4 2000/12/11 00:31:43 steve
* Add support for signed reg variables,
* simulate in t-vvm signed comparisons.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_anet.cc,v 1.1 2000/12/06 06:31:09 steve Exp $"
#ident "$Id: elab_anet.cc,v 1.2 2001/01/06 02:29:36 steve Exp $"
#endif
/*
@ -122,7 +122,6 @@ NetNet* PEIdent::elaborate_anet(Design*des, NetScope*scope) const
switch (sig->type()) {
case NetNet::REG:
case NetNet::IMPLICIT_REG:
case NetNet::INTEGER:
break;
default:
@ -148,6 +147,9 @@ NetNet* PEIdent::elaborate_anet(Design*des, NetScope*scope) const
/*
* $Log: elab_anet.cc,v $
* Revision 1.2 2001/01/06 02:29:36 steve
* Support arrays of integers.
*
* Revision 1.1 2000/12/06 06:31:09 steve
* Check lvalue of procedural continuous assign (PR#29)
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_lval.cc,v 1.8 2000/12/12 06:14:51 steve Exp $"
#ident "$Id: elab_lval.cc,v 1.9 2001/01/06 02:29:36 steve Exp $"
#endif
# include "PExpr.h"
@ -178,9 +178,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
}
assert(reg);
if ((reg->type() != NetNet::REG)
&& (reg->type() != NetNet::INTEGER)
&& (reg->type() != NetNet::TIME)) {
if ((reg->type() != NetNet::REG) && (reg->type() != NetNet::TIME)) {
cerr << get_line() << ": error: " << name() <<
" is not a reg/integer/time in " << scope->name() <<
"." << endl;
@ -308,6 +306,9 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
/*
* $Log: elab_lval.cc,v $
* Revision 1.9 2001/01/06 02:29:36 steve
* Support arrays of integers.
*
* Revision 1.8 2000/12/12 06:14:51 steve
* sorry for concatenated memories in l-values. (PR#76)
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.cc,v 1.151 2000/12/11 00:31:43 steve Exp $"
#ident "$Id: netlist.cc,v 1.152 2001/01/06 02:29:36 steve Exp $"
#endif
# include <cassert>
@ -34,9 +34,6 @@ ostream& operator<< (ostream&o, NetNet::Type t)
case NetNet::IMPLICIT_REG:
o << "reg /*implicit*/";
break;
case NetNet::INTEGER:
o << "integer";
break;
case NetNet::REG:
o << "reg";
break;
@ -312,7 +309,6 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
switch (t) {
case REG:
case IMPLICIT_REG:
case INTEGER:
init_value = verinum::Vx;
break;
case SUPPLY0:
@ -345,7 +341,6 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls)
switch (t) {
case REG:
case IMPLICIT_REG:
case INTEGER:
init_value = verinum::Vx;
break;
case SUPPLY0:
@ -2480,6 +2475,9 @@ bool NetUDP::sequ_glob_(string input, char output)
/*
* $Log: netlist.cc,v $
* Revision 1.152 2001/01/06 02:29:36 steve
* Support arrays of integers.
*
* Revision 1.151 2000/12/11 00:31:43 steve
* Add support for signed reg variables,
* simulate in t-vvm signed comparisons.

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.191 2001/01/04 16:49:50 steve Exp $"
#ident "$Id: netlist.h,v 1.192 2001/01/06 02:29:36 steve Exp $"
#endif
/*
@ -304,6 +304,9 @@ class NetNode : public NetObj {
* NetNet. NetNet objects also appear as side effects of synthesis or
* other abstractions.
*
* Note that there are no INTEGER types. Express a verilog integer as
* a ``reg signed'' instead. The parser automatically does this for us.
*
* NetNet objects have a name and exist within a scope, so the
* constructor takes a pointer to the containing scope. The object
* automatically adds itself to the scope.
@ -318,8 +321,7 @@ class NetNet : public NetObj, public LineInfo {
public:
enum Type { IMPLICIT, IMPLICIT_REG, WIRE, TRI, TRI1, SUPPLY0,
SUPPLY1, WAND, TRIAND, TRI0, WOR, TRIOR, REG,
INTEGER, TIME };
SUPPLY1, WAND, TRIAND, TRI0, WOR, TRIOR, REG, TIME };
enum PortType { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT };
@ -2844,6 +2846,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.192 2001/01/06 02:29:36 steve
* Support arrays of integers.
*
* Revision 1.191 2001/01/04 16:49:50 steve
* Evaluate constant === and !== expressions.
*

11
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: parse.y,v 1.114 2000/12/16 17:16:08 steve Exp $"
#ident "$Id: parse.y,v 1.115 2001/01/06 02:29:36 steve Exp $"
#endif
# include "parse_misc.h"
@ -206,7 +206,7 @@ block_item_decl
{ delete $3;
yyerror(@2, "sorry: signed reg not supported.");
}
| K_integer list_of_variables ';'
| K_integer register_variable_list ';'
{ pform_set_reg_integer($2);
}
| K_time list_of_variables ';'
@ -1278,6 +1278,13 @@ module_item
{
}
/* These rules match various errors that the user can type. */
| error
{ yyerror(@1, "error: invalid module item. "
"Did you forget an initial or always?");
}
/* These rules are for the Icarus VErilog specific $attribute
extensions. Then catch the parameters of the $attribute keyword. */

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.cc,v 1.68 2000/12/11 00:31:43 steve Exp $"
#ident "$Id: pform.cc,v 1.69 2001/01/06 02:29:36 steve Exp $"
#endif
# include "compiler.h"
@ -897,11 +897,13 @@ static void pform_set_reg_integer(const char*nm)
string name = scoped_name(nm);
PWire*cur = pform_cur_module->get_wire(name);
if (cur == 0) {
cur = new PWire(name, NetNet::INTEGER, NetNet::NOT_A_PORT);
cur = new PWire(name, NetNet::REG, NetNet::NOT_A_PORT);
cur->set_signed(true);
pform_cur_module->add_wire(cur);
} else {
bool rc = cur->set_wire_type(NetNet::INTEGER);
bool rc = cur->set_wire_type(NetNet::REG);
assert(rc);
cur->set_signed(true);
}
assert(cur);
@ -1008,6 +1010,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
/*
* $Log: pform.cc,v $
* Revision 1.69 2001/01/06 02:29:36 steve
* Support arrays of integers.
*
* Revision 1.68 2000/12/11 00:31:43 steve
* Add support for signed reg variables,
* simulate in t-vvm signed comparisons.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-dll.cc,v 1.23 2000/12/15 18:06:47 steve Exp $"
#ident "$Id: t-dll.cc,v 1.24 2001/01/06 02:29:36 steve Exp $"
#endif
# include "compiler.h"
@ -533,7 +533,6 @@ void dll_target::signal(const NetNet*net)
switch (net->type()) {
case NetNet::REG:
case NetNet::INTEGER:
obj->type_ = IVL_SIT_REG;
break;
@ -644,6 +643,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.24 2001/01/06 02:29:36 steve
* Support arrays of integers.
*
* Revision 1.23 2000/12/15 18:06:47 steve
* A dlerror implementatin that HP/UX might like.
*