diff --git a/Module.h b/Module.h index 8c2f27e27..af1242d3f 100644 --- a/Module.h +++ b/Module.h @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: Module.h,v 1.3 1999/02/21 17:01:57 steve Exp $" +#ident "$Id: Module.h,v 1.4 1999/06/15 03:44:53 steve Exp $" #endif # include # include -# include +# include "svector.h" # include class PExpr; class PGate; @@ -43,7 +43,7 @@ class Module { explicit Module(const string&name, unsigned nports) : ports(nports), name_(name) { } - vector ports; + svector ports; /* The module has parameters that are evaluated when the module is elaborated. During parsing, I put the parameters @@ -81,6 +81,9 @@ class Module { /* * $Log: Module.h,v $ + * Revision 1.4 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.3 1999/02/21 17:01:57 steve * Add support for module parameters. * diff --git a/PUdp.h b/PUdp.h index 44067708b..1ac1b29a7 100644 --- a/PUdp.h +++ b/PUdp.h @@ -19,14 +19,19 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: PUdp.h,v 1.2 1998/12/01 00:42:13 steve Exp $" +#ident "$Id: PUdp.h,v 1.3 1999/06/15 03:44:53 steve Exp $" #endif # include -# include +# include "svector.h" # include # include "verinum.h" +svector::svector(unsigned size) +: nitems_(size), items_(new string[size]) +{ +} + /* * This class represents a parsed UDP. This is a much simpler object * then a module or macromodule. @@ -54,12 +59,12 @@ class PUdp { explicit PUdp(const string&n, unsigned nports) : ports(nports), sequential(false), initial(verinum::Vx), name_(n) { } - vectorports; + svectorports; bool sequential; - vectortinput; - vector tcurrent; - vector toutput; + svectortinput; + svector tcurrent; + svector toutput; verinum::V initial; @@ -77,6 +82,9 @@ class PUdp { /* * $Log: PUdp.h,v $ + * Revision 1.3 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.2 1998/12/01 00:42:13 steve * Elaborate UDP devices, * Support UDP type attributes, and diff --git a/elaborate.cc b/elaborate.cc index 3d3e3ccbe..461bd59cf 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elaborate.cc,v 1.43 1999/06/13 23:51:16 steve Exp $" +#ident "$Id: elaborate.cc,v 1.44 1999/06/15 03:44:53 steve Exp $" #endif /* @@ -360,7 +360,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const // ports. If this is simply positional binding in the first // place, then get the binding from the base class. if (pins_) { - unsigned nexp = rmod->ports.size(); + unsigned nexp = rmod->ports.count(); svector*exp = new svector(nexp); // Scan the bindings, matching them with port names. @@ -401,9 +401,9 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const } else { - if (pin_count() != rmod->ports.size()) { + if (pin_count() != rmod->ports.count()) { cerr << get_line() << ": Wrong number " - "of parameters. Expecting " << rmod->ports.size() << + "of parameters. Expecting " << rmod->ports.count() << ", got " << pin_count() << "." << endl; des->errors += 1; @@ -412,7 +412,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const // No named bindings, just use the positional list I // already have. - assert(pin_count() == rmod->ports.size()); + assert(pin_count() == rmod->ports.count()); pins = get_pins(); } @@ -488,7 +488,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const void PGModule::elaborate_udp_(Design*des, PUdp*udp, const string&path) const { const string my_name = path+"."+get_name(); - NetUDP*net = new NetUDP(my_name, udp->ports.size(), udp->sequential); + NetUDP*net = new NetUDP(my_name, udp->ports.count(), udp->sequential); net->set_attributes(udp->attributes); /* Run through the pins, making netlists for the pin @@ -514,7 +514,7 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, const string&path) const /* Build up the truth table for the netlist from the input strings. */ - for (unsigned idx = 0 ; idx < udp->tinput.size() ; idx += 1) { + for (unsigned idx = 0 ; idx < udp->tinput.count() ; idx += 1) { string input = udp->sequential ? (string("") + udp->tcurrent[idx] + udp->tinput[idx]) : udp->tinput[idx]; @@ -1527,6 +1527,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.44 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.43 1999/06/13 23:51:16 steve * l-value part select for procedural assignments. * diff --git a/main.cc b/main.cc index 4a70c0011..8da5fe5c8 100644 --- a/main.cc +++ b/main.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: main.cc,v 1.15 1999/05/05 03:27:15 steve Exp $" +#ident "$Id: main.cc,v 1.16 1999/06/15 03:44:53 steve Exp $" #endif # include @@ -186,7 +186,7 @@ int main(int argc, char*argv[]) ; mod != modules.end() ; mod ++ ) { Module*cur = (*mod).second; - if (cur->ports.size() == 0) + if (cur->ports.count() == 0) if (start_module == "") { start_module = cur->get_name(); } else { @@ -249,6 +249,9 @@ int main(int argc, char*argv[]) /* * $Log: main.cc,v $ + * Revision 1.16 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.15 1999/05/05 03:27:15 steve * More intelligent selection of module to elaborate. * diff --git a/pform.cc b/pform.cc index 33f54261f..77f630c9b 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.26 1999/06/13 23:51:16 steve Exp $" +#ident "$Id: pform.cc,v 1.27 1999/06/15 03:44:53 steve Exp $" #endif # include "compiler.h" @@ -123,7 +123,7 @@ void pform_make_udp(string*name, list*parms, /* Put the parameters into a vector of wire descriptions. Look in the map for the definitions of the name. */ - vector pins (parms->size()); + svector pins (parms->size()); { list::iterator cur; unsigned idx; for (cur = parms->begin(), idx = 0 @@ -136,10 +136,10 @@ void pform_make_udp(string*name, list*parms, /* Check that the output is an output and the inputs are inputs. I can also make sure that only the single output is declared a register, if anything. */ - assert(pins.size() > 0); + assert(pins.count() > 0); assert(pins[0]); assert(pins[0]->port_type == NetNet::POUTPUT); - for (unsigned idx = 1 ; idx < pins.size() ; idx += 1) { + for (unsigned idx = 1 ; idx < pins.count() ; idx += 1) { assert(pins[idx]); assert(pins[idx]->port_type == NetNet::PINPUT); assert(pins[idx]->type != NetNet::REG); @@ -149,18 +149,18 @@ void pform_make_udp(string*name, list*parms, they correspond to the inputs, output and output type. Make up vectors for the fully interpreted result that can be placed in the PUdp object. */ - vector input (table->size()); - vector current (table->size()); - vector output (table->size()); + svector input (table->size()); + svector current (table->size()); + svector output (table->size()); { unsigned idx = 0; for (list::iterator cur = table->begin() ; cur != table->end() ; cur ++, idx += 1) { string tmp = *cur; - assert(tmp.find(':') == (pins.size() - 1)); + assert(tmp.find(':') == (pins.count() - 1)); - input[idx] = tmp.substr(0, pins.size()-1); - tmp = tmp.substr(pins.size()-1); + input[idx] = tmp.substr(0, pins.count()-1); + tmp = tmp.substr(pins.count()-1); if (pins[0]->type == NetNet::REG) { assert(tmp[0] == ':'); @@ -210,7 +210,7 @@ void pform_make_udp(string*name, list*parms, udp->sequential = true; // Make the port list for the UDP - for (unsigned idx = 0 ; idx < pins.size() ; idx += 1) + for (unsigned idx = 0 ; idx < pins.count() ; idx += 1) udp->ports[idx] = pins[idx]->name; udp->tinput = input; @@ -590,6 +590,9 @@ int pform_parse(const char*path, map&modules, /* * $Log: pform.cc,v $ + * Revision 1.27 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.26 1999/06/13 23:51:16 steve * l-value part select for procedural assignments. * diff --git a/pform.h b/pform.h index cf470c60c..c834db74c 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.19 1999/06/12 20:35:27 steve Exp $" +#ident "$Id: pform.h,v 1.20 1999/06/15 03:44:53 steve Exp $" #endif # include "netlist.h" @@ -33,7 +33,6 @@ # include # include # include -# include # include /* @@ -152,6 +151,9 @@ extern void pform_dump(ostream&out, Module*mod); /* * $Log: pform.h,v $ + * Revision 1.20 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.19 1999/06/12 20:35:27 steve * parse more verilog. * diff --git a/pform_dump.cc b/pform_dump.cc index 3970e8da4..018643c4d 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: pform_dump.cc,v 1.20 1999/06/13 23:51:16 steve Exp $" +#ident "$Id: pform_dump.cc,v 1.21 1999/06/15 03:44:53 steve Exp $" #endif /* @@ -441,7 +441,7 @@ void pform_dump(ostream&out, Module*mod) void PUdp::dump(ostream&out) const { out << "primitive " << name_ << "(" << ports[0]; - for (unsigned idx = 1 ; idx < ports.size() ; idx += 1) + for (unsigned idx = 1 ; idx < ports.count() ; idx += 1) out << ", " << ports[idx]; out << ");" << endl; @@ -449,7 +449,7 @@ void PUdp::dump(ostream&out) const out << " reg " << ports[0] << ";" << endl; out << " table" << endl; - for (unsigned idx = 0 ; idx < tinput.size() ; idx += 1) { + for (unsigned idx = 0 ; idx < tinput.count() ; idx += 1) { out << " "; for (unsigned chr = 0 ; chr < tinput[idx].length() ; chr += 1) out << " " << tinput[idx][chr]; @@ -480,6 +480,9 @@ void PUdp::dump(ostream&out) const /* * $Log: pform_dump.cc,v $ + * Revision 1.21 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.20 1999/06/13 23:51:16 steve * l-value part select for procedural assignments. * diff --git a/svector.h b/svector.h index edb6dabd4..4b3009e43 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.3 1999/05/06 04:37:17 steve Exp $" +#ident "$Id: svector.h,v 1.4 1999/06/15 03:44:53 steve Exp $" #endif # include @@ -35,6 +35,8 @@ template class svector { public: + explicit svector() : nitems_(0), items_(0) { } + explicit svector(unsigned size) : nitems_(size), items_(new TYPE[size]) { for (unsigned idx = 0 ; idx < size ; idx += 1) items_[idx] = 0; @@ -64,6 +66,17 @@ template class svector { ~svector() { delete[]items_; } + svector& operator= (const svector&that) + { if (&that == this) return *this; + delete[]items_; + nitems_ = that.nitems_; + items_ = new TYPE[nitems_]; + for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) { + items_[idx] = that.items_[idx]; + } + return *this; + } + unsigned count() const { return nitems_; } TYPE&operator[] (unsigned idx) @@ -80,13 +93,13 @@ template class svector { unsigned nitems_; TYPE* items_; - private: // not implemented - svector& operator= (const svector&); - }; /* * $Log: svector.h,v $ + * Revision 1.4 1999/06/15 03:44:53 steve + * Get rid of the STL vector template. + * * Revision 1.3 1999/05/06 04:37:17 steve * Get rid of list types. *