Get rid of list<lgate> types.
This commit is contained in:
parent
b2b9097488
commit
a568e526c6
18
parse.y
18
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<PCase::Item*>*citems;
|
||||
|
||||
lgate*gate;
|
||||
list<lgate>*gates;
|
||||
svector<lgate>*gates;
|
||||
|
||||
PExpr*expr;
|
||||
list<PExpr*>*exprs;
|
||||
|
|
@ -446,14 +446,16 @@ gate_instance
|
|||
|
||||
gate_instance_list
|
||||
: gate_instance_list ',' gate_instance
|
||||
{ list<lgate>*tmp = $1;
|
||||
tmp->push_back(*$3);
|
||||
delete $3;
|
||||
$$ = tmp;
|
||||
{ svector<lgate>*tmp1 = $1;
|
||||
lgate*tmp2 = $3;
|
||||
svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
|
||||
delete tmp1;
|
||||
delete tmp2;
|
||||
$$ = out;
|
||||
}
|
||||
| gate_instance
|
||||
{ list<lgate>*tmp = new list<lgate>;
|
||||
tmp->push_back(*$1);
|
||||
{ svector<lgate>*tmp = new svector<lgate>(1);
|
||||
(*tmp)[0] = *$1;
|
||||
delete $1;
|
||||
$$ = tmp;
|
||||
}
|
||||
|
|
|
|||
21
pform.cc
21
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<lgate>*gates)
|
||||
PExpr*delay, svector<lgate>*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<lgate>*gates)
|
||||
void pform_make_modgates(const string&type, svector<lgate>*gates)
|
||||
{
|
||||
while (! gates->empty()) {
|
||||
lgate cur = gates->front();
|
||||
gates->pop_front();
|
||||
for (unsigned idx = 0 ; idx < gates->count() ; idx += 1) {
|
||||
lgate cur = (*gates)[idx];
|
||||
|
||||
vector<PExpr*>wires (cur.parms->size());
|
||||
for (unsigned idx = 0 ; idx < wires.size() ; idx += 1) {
|
||||
|
|
@ -548,6 +544,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.14 1999/05/06 04:37:17 steve
|
||||
* Get rid of list<lgate> types.
|
||||
*
|
||||
* Revision 1.13 1999/05/06 04:09:28 steve
|
||||
* Parse more constant expressions.
|
||||
*
|
||||
|
|
|
|||
11
pform.h
11
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<PWire*>* pform_make_udp_input_ports(list<string>*);
|
|||
*/
|
||||
extern void pform_makegates(PGBuiltin::Type type,
|
||||
PExpr*delay,
|
||||
list<lgate>*gates);
|
||||
svector<lgate>*gates);
|
||||
|
||||
extern void pform_make_modgates(const string&type, list<lgate>*gates);
|
||||
extern void pform_make_modgates(const string&type, svector<lgate>*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<lgate> types.
|
||||
*
|
||||
* Revision 1.10 1999/05/06 04:09:28 steve
|
||||
* Parse more constant expressions.
|
||||
*
|
||||
|
|
|
|||
14
svector.h
14
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 <assert.h>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
template <class TYPE> 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 TYPE> class svector {
|
|||
items_[l.nitems_+idx] = r[idx];
|
||||
}
|
||||
|
||||
svector(const svector<TYPE>&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 TYPE> class svector {
|
|||
|
||||
/*
|
||||
* $Log: svector.h,v $
|
||||
* Revision 1.3 1999/05/06 04:37:17 steve
|
||||
* Get rid of list<lgate> types.
|
||||
*
|
||||
* Revision 1.2 1999/05/01 02:57:53 steve
|
||||
* Handle much more complex event expressions.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue