diff --git a/parse.y b/parse.y index 270b3e4a1..9d51b2312 100644 --- a/parse.y +++ b/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: parse.y,v 1.21 1999/05/06 04:09:28 steve Exp $" +#ident "$Id: parse.y,v 1.22 1999/05/06 04:37:17 steve Exp $" #endif # include "parse_misc.h" @@ -38,7 +38,7 @@ extern void lex_end_table(); list*citems; lgate*gate; - list*gates; + svector*gates; PExpr*expr; list*exprs; @@ -446,14 +446,16 @@ gate_instance gate_instance_list : gate_instance_list ',' gate_instance - { list*tmp = $1; - tmp->push_back(*$3); - delete $3; - $$ = tmp; + { svector*tmp1 = $1; + lgate*tmp2 = $3; + svector*out = new svector (*tmp1, *tmp2); + delete tmp1; + delete tmp2; + $$ = out; } | gate_instance - { list*tmp = new list; - tmp->push_back(*$1); + { svector*tmp = new svector(1); + (*tmp)[0] = *$1; delete $1; $$ = tmp; } diff --git a/pform.cc b/pform.cc index 286ce7d5f..bea5c0869 100644 --- a/pform.cc +++ b/pform.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: pform.cc,v 1.13 1999/05/06 04:09:28 steve Exp $" +#ident "$Id: pform.cc,v 1.14 1999/05/06 04:37:17 steve Exp $" #endif # include "pform.h" @@ -254,16 +254,13 @@ void pform_makegate(PGBuiltin::Type type, } void pform_makegates(PGBuiltin::Type type, - PExpr*delay, list*gates) + PExpr*delay, svector*gates) { unsigned long delay_val = delay? evaluate_delay(delay) : 0; delete delay; - while (! gates->empty()) { - lgate cur = gates->front(); - gates->pop_front(); - - pform_makegate(type, delay_val, cur); + for (unsigned idx = 0 ; idx < gates->count() ; idx += 0) { + pform_makegate(type, delay_val, (*gates)[idx]); } delete gates; @@ -287,11 +284,10 @@ void pform_make_modgate(const string&type, cur_module->add_gate(cur); } -void pform_make_modgates(const string&type, list*gates) +void pform_make_modgates(const string&type, svector*gates) { - while (! gates->empty()) { - lgate cur = gates->front(); - gates->pop_front(); + for (unsigned idx = 0 ; idx < gates->count() ; idx += 1) { + lgate cur = (*gates)[idx]; vectorwires (cur.parms->size()); for (unsigned idx = 0 ; idx < wires.size() ; idx += 1) { @@ -548,6 +544,9 @@ int pform_parse(const char*path, map&modules, /* * $Log: pform.cc,v $ + * Revision 1.14 1999/05/06 04:37:17 steve + * Get rid of list types. + * * Revision 1.13 1999/05/06 04:09:28 steve * Parse more constant expressions. * diff --git a/pform.h b/pform.h index e4470c828..0b579e9db 100644 --- a/pform.h +++ b/pform.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: pform.h,v 1.10 1999/05/06 04:09:28 steve Exp $" +#ident "$Id: pform.h,v 1.11 1999/05/06 04:37:17 steve Exp $" #endif # include "netlist.h" @@ -63,7 +63,7 @@ class PExpr; */ struct lgate { - lgate() + lgate(int =0) : parms(0), lineno(0) { range[0] = 0; range[1] = 0; @@ -121,9 +121,9 @@ extern list* pform_make_udp_input_ports(list*); */ extern void pform_makegates(PGBuiltin::Type type, PExpr*delay, - list*gates); + svector*gates); -extern void pform_make_modgates(const string&type, list*gates); +extern void pform_make_modgates(const string&type, svector*gates); /* Make a continuous assignment node, with optional bit- or part- select. */ extern void pform_make_pgassign(const string&lval, PExpr*rval); @@ -141,6 +141,9 @@ extern void pform_dump(ostream&out, Module*mod); /* * $Log: pform.h,v $ + * Revision 1.11 1999/05/06 04:37:17 steve + * Get rid of list types. + * * Revision 1.10 1999/05/06 04:09:28 steve * Parse more constant expressions. * diff --git a/svector.h b/svector.h index 3ef31ae23..edb6dabd4 100644 --- a/svector.h +++ b/svector.h @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: svector.h,v 1.2 1999/05/01 02:57:53 steve Exp $" +#ident "$Id: svector.h,v 1.3 1999/05/06 04:37:17 steve Exp $" #endif # include @@ -35,7 +35,7 @@ template class svector { public: - svector(unsigned size) : nitems_(size), items_(new TYPE[size]) + explicit svector(unsigned size) : nitems_(size), items_(new TYPE[size]) { for (unsigned idx = 0 ; idx < size ; idx += 1) items_[idx] = 0; } @@ -55,6 +55,13 @@ template class svector { items_[l.nitems_+idx] = r[idx]; } + svector(const svector&l, TYPE r) + : nitems_(l.nitems_ + 1), items_(new TYPE[nitems_]) + { for (unsigned idx = 0 ; idx < l.nitems_ ; idx += 1) + items_[idx] = l[idx]; + items_[nitems_-1] = r; + } + ~svector() { delete[]items_; } unsigned count() const { return nitems_; } @@ -80,6 +87,9 @@ template class svector { /* * $Log: svector.h,v $ + * Revision 1.3 1999/05/06 04:37:17 steve + * Get rid of list types. + * * Revision 1.2 1999/05/01 02:57:53 steve * Handle much more complex event expressions. *