Build task outputs as lval instead of nets. (PR#98)
This commit is contained in:
parent
6bf599e839
commit
5276752276
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: elab_lval.cc,v 1.10 2001/01/06 06:31:58 steve Exp $"
|
#ident "$Id: elab_lval.cc,v 1.11 2001/01/10 03:13:23 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "PExpr.h"
|
# include "PExpr.h"
|
||||||
|
|
@ -169,7 +169,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
|
||||||
cerr << get_line() << ": sorry: I cannot handle "
|
cerr << get_line() << ": sorry: I cannot handle "
|
||||||
<< "memories in this l-value context." << endl;
|
<< "memories in this l-value context." << endl;
|
||||||
} else {
|
} else {
|
||||||
cerr << get_line() << ": error: Could not match signal ``"
|
cerr << get_line() << ": error: Could not find variable ``"
|
||||||
<< name() << "'' in ``" << scope->name() <<
|
<< name() << "'' in ``" << scope->name() <<
|
||||||
"''" << endl;
|
"''" << endl;
|
||||||
}
|
}
|
||||||
|
|
@ -306,6 +306,9 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elab_lval.cc,v $
|
* $Log: elab_lval.cc,v $
|
||||||
|
* Revision 1.11 2001/01/10 03:13:23 steve
|
||||||
|
* Build task outputs as lval instead of nets. (PR#98)
|
||||||
|
*
|
||||||
* Revision 1.10 2001/01/06 06:31:58 steve
|
* Revision 1.10 2001/01/06 06:31:58 steve
|
||||||
* declaration initialization for time variables.
|
* declaration initialization for time variables.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: elab_net.cc,v 1.56 2001/01/05 03:19:47 steve Exp $"
|
#ident "$Id: elab_net.cc,v 1.57 2001/01/10 03:13:23 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "PExpr.h"
|
# include "PExpr.h"
|
||||||
|
|
@ -1797,6 +1797,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elab_net.cc,v $
|
* $Log: elab_net.cc,v $
|
||||||
|
* Revision 1.57 2001/01/10 03:13:23 steve
|
||||||
|
* Build task outputs as lval instead of nets. (PR#98)
|
||||||
|
*
|
||||||
* Revision 1.56 2001/01/05 03:19:47 steve
|
* Revision 1.56 2001/01/05 03:19:47 steve
|
||||||
* Fix net division to cope with small output sizes.
|
* Fix net division to cope with small output sizes.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
70
elaborate.cc
70
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: elaborate.cc,v 1.203 2001/01/09 05:58:47 steve Exp $"
|
#ident "$Id: elaborate.cc,v 1.204 2001/01/10 03:13:23 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1448,70 +1448,33 @@ NetProc* PCallTask::elaborate_usr(Design*des, const string&path) const
|
||||||
if (port->port_type() == NetNet::PINPUT)
|
if (port->port_type() == NetNet::PINPUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const PEIdent*id;
|
/* Handle the special case that the output parameter is
|
||||||
NetNet*val = 0;
|
a memory word. Generate a NetAssignMem instead of a
|
||||||
NetMemory*mem = 0;
|
NetAssign. */
|
||||||
if ( (id = dynamic_cast<const PEIdent*>(parms_[idx])) )
|
NetMemory*mem;
|
||||||
des->find_symbol(scope, id->name(), val, mem);
|
const PEIdent*id = dynamic_cast<const PEIdent*>(parms_[idx]);
|
||||||
|
if (id && (mem = des->find_memory(scope, id->name()))) {
|
||||||
|
|
||||||
/* Catch the case of memory words passed as an out
|
|
||||||
parameter. Generate an assignment to memory instead
|
|
||||||
of a normal assignment. */
|
|
||||||
if (mem != 0) {
|
|
||||||
assert(id->msb_);
|
|
||||||
NetExpr*ix = id->msb_->elaborate_expr(des, scope);
|
NetExpr*ix = id->msb_->elaborate_expr(des, scope);
|
||||||
assert(ix);
|
assert(ix);
|
||||||
|
|
||||||
NetExpr*rv = new NetESignal(port);
|
NetExpr*rx = new NetESignal(port);
|
||||||
if (rv->expr_width() < mem->width())
|
NetAssignMem*am = new NetAssignMem(mem, ix, rx);
|
||||||
rv = pad_to_width(rv, mem->width());
|
|
||||||
|
|
||||||
NetAssignMem*am = new NetAssignMem(mem, ix, rv);
|
|
||||||
am->set_line(*this);
|
|
||||||
block->append(am);
|
block->append(am);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Elaborate the parameter expression as a net so that
|
NetAssign_*lv = parms_[idx]
|
||||||
it can be used as an l-value. Then check that the
|
? parms_[idx]->elaborate_lval(des, scope)
|
||||||
parameter width match up.
|
: 0;
|
||||||
|
if (lv == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
XXXX FIXME XXXX This goes nuts if the parameter is a
|
|
||||||
memory word. that must be handled by generating
|
|
||||||
NetAssignMem objects instead. */
|
|
||||||
if (val == 0)
|
|
||||||
val = parms_[idx]->elaborate_net(des, path,
|
|
||||||
0, 0, 0, 0);
|
|
||||||
assert(val);
|
|
||||||
|
|
||||||
|
|
||||||
/* Make an expression out of the actual task port. If
|
|
||||||
the port is smaller then the expression to receive
|
|
||||||
the result, then expand the port by padding with
|
|
||||||
zeros. */
|
|
||||||
NetESignal*sig = new NetESignal(port);
|
NetESignal*sig = new NetESignal(port);
|
||||||
NetExpr*pexp = sig;
|
|
||||||
if (sig->expr_width() < val->pin_count()) {
|
|
||||||
unsigned cwid = val->pin_count()-sig->expr_width();
|
|
||||||
verinum pad (verinum::V0, cwid);
|
|
||||||
NetEConst*cp = new NetEConst(pad);
|
|
||||||
cp->set_width(cwid);
|
|
||||||
|
|
||||||
NetEConcat*con = new NetEConcat(2);
|
|
||||||
con->set(0, cp);
|
|
||||||
con->set(1, sig);
|
|
||||||
con->set_width(val->pin_count());
|
|
||||||
pexp = con;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Generate the assignment statement. */
|
/* Generate the assignment statement. */
|
||||||
NetAssign_*lv = new NetAssign_("@", val->pin_count());
|
NetAssign*ass = new NetAssign(lv, sig);
|
||||||
des->add_node(lv);
|
|
||||||
for (unsigned pi = 0 ; pi < val->pin_count() ; pi += 1)
|
|
||||||
connect(val->pin(pi), lv->pin(pi));
|
|
||||||
NetAssign*ass = new NetAssign(lv, pexp);
|
|
||||||
|
|
||||||
block->append(ass);
|
block->append(ass);
|
||||||
}
|
}
|
||||||
|
|
@ -2388,6 +2351,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elaborate.cc,v $
|
* $Log: elaborate.cc,v $
|
||||||
|
* Revision 1.204 2001/01/10 03:13:23 steve
|
||||||
|
* Build task outputs as lval instead of nets. (PR#98)
|
||||||
|
*
|
||||||
* Revision 1.203 2001/01/09 05:58:47 steve
|
* Revision 1.203 2001/01/09 05:58:47 steve
|
||||||
* Cope with width mismatches to module ports (PR#89)
|
* Cope with width mismatches to module ports (PR#89)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue