implement nex_input for behavioral statements.

This commit is contained in:
steve 2002-04-21 17:43:12 +00:00
parent b094bbdcf4
commit 9dda15a186
3 changed files with 155 additions and 6 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: net_nex_input.cc,v 1.1 2002/04/21 04:59:08 steve Exp $"
#ident "$Id: net_nex_input.cc,v 1.2 2002/04/21 17:43:12 steve Exp $"
#endif
# include "config.h"
@ -167,9 +167,35 @@ NexusSet* NetEUnary::nex_input()
return expr_->nex_input();
}
NexusSet* NetAssign::nex_input()
NexusSet* NetAssignBase::nex_input()
{
NexusSet*result = rval()->nex_input();
NexusSet*result = rval_->nex_input();
return result;
}
NexusSet* NetAssignMem_::nex_input()
{
NexusSet*result = rval_->nex_input();
NexusSet*tmp = index_->nex_input();
result->add(*tmp);
delete tmp;
return result;
}
NexusSet* NetBlock::nex_input()
{
if (last_ == 0)
return new NexusSet;
NetProc*cur = last_;
NexusSet*result = cur->nex_input();
cur = cur->next_;
while (cur != last_) {
NexusSet*tmp = cur->nex_input();
result->add(*tmp);
delete tmp;
}
return result;
}
@ -202,8 +228,107 @@ NexusSet* NetCase::nex_input()
return result;
}
NexusSet* NetCAssign::nex_input()
{
cerr << get_line() << ": internal warning: NetCAssign::nex_input()"
<< " not implemented." << endl;
return new NexusSet;
}
NexusSet* NetCondit::nex_input()
{
NexusSet*result = expr_->nex_input();
if (if_ != 0) {
NexusSet*tmp = if_->nex_input();
result->add(*tmp);
delete tmp;
}
if (else_ != 0) {
NexusSet*tmp = else_->nex_input();
result->add(*tmp);
delete tmp;
}
return result;
}
NexusSet* NetForce::nex_input()
{
cerr << get_line() << ": internal warning: NetForce::nex_input()"
<< " not implemented." << endl;
return new NexusSet;
}
NexusSet* NetForever::nex_input()
{
NexusSet*result = statement_->nex_input();
return result;
}
/*
* The NetPDelay statement is a statement of the form
*
* #<expr> <statement>
*
* The nex_input set is the input set of the <statement>. Do *not*
* include the input set of the <expr> because it does not affect the
* result.
*/
NexusSet* NetPDelay::nex_input()
{
NexusSet*result = statement_->nex_input();
return result;
}
NexusSet* NetRepeat::nex_input()
{
NexusSet*result = statement_->nex_input();
NexusSet*tmp = expr_->nex_input();
result->add(*tmp);
delete tmp;
return result;
}
NexusSet* NetSTask::nex_input()
{
if (parms_.count() == 0)
return new NexusSet;
NexusSet*result = parms_[0]->nex_input();
for (unsigned idx = 1 ; idx < parms_.count() ; idx += 1) {
NexusSet*tmp = parms_[idx]->nex_input();
result->add(*tmp);
delete tmp;
}
return result;
}
/*
* The NetUTask represents a call to a user defined task. There are no
* parameters to consider, because the compiler already removed them
* and converted them to blocking assignments.
*/
NexusSet* NetUTask::nex_input()
{
return new NexusSet;
}
NexusSet* NetWhile::nex_input()
{
NexusSet*result = proc_->nex_input();
NexusSet*tmp = cond_->nex_input();
result->add(*tmp);
delete tmp;
return result;
}
/*
* $Log: net_nex_input.cc,v $
* Revision 1.2 2002/04/21 17:43:12 steve
* implement nex_input for behavioral statements.
*
* Revision 1.1 2002/04/21 04:59:08 steve
* Add support for conbinational events by finding
* the inputs to expressions and some statements.

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.233 2002/04/21 04:59:08 steve Exp $"
#ident "$Id: netlist.h,v 1.234 2002/04/21 17:43:13 steve Exp $"
#endif
/*
@ -1281,6 +1281,8 @@ class NetAssignBase : public NetProc {
const NetAssign_* l_val(unsigned) const;
unsigned l_val_count() const;
virtual NexusSet* nex_input();
// This returns the total width of the accumulated l-value. It
// accounts for any grouping of NetAssign_ objects that might happen.
unsigned lwidth() const;
@ -1299,7 +1301,6 @@ class NetAssign : public NetAssignBase {
explicit NetAssign(NetAssign_*lv, NetExpr*rv);
~NetAssign();
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual int match_proc(struct proc_match_t*);
virtual void dump(ostream&, unsigned ind) const;
@ -1351,6 +1352,8 @@ class NetAssignMem_ : public NetProc {
const NetExpr*index()const { return index_; }
const NetExpr*rval()const { return rval_; }
virtual NexusSet* nex_input();
private:
NetMemory*mem_;
NetExpr* index_;
@ -1411,6 +1414,7 @@ class NetBlock : public NetProc {
// for sequential blocks.
void emit_recurse(struct target_t*) const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual int match_proc(struct proc_match_t*);
virtual void dump(ostream&, unsigned ind) const;
@ -1484,6 +1488,7 @@ class NetCAssign : public NetProc, public NetNode {
const Link& lval_pin(unsigned) const;
virtual NexusSet* nex_input();
virtual void dump(ostream&, unsigned ind) const;
virtual bool emit_proc(struct target_t*) const;
virtual void dump_node(ostream&, unsigned ind) const;
@ -1520,6 +1525,7 @@ class NetCondit : public NetProc {
bool emit_recurse_if(struct target_t*) const;
bool emit_recurse_else(struct target_t*) const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual int match_proc(struct proc_match_t*);
virtual void dump(ostream&, unsigned ind) const;
@ -1767,6 +1773,8 @@ class NetForce : public NetProc, public NetNode {
const NetNet*lval() const;
virtual NexusSet* nex_input();
virtual void dump(ostream&, unsigned ind) const;
virtual bool emit_proc(struct target_t*) const;
virtual void dump_node(ostream&, unsigned ind) const;
@ -1788,6 +1796,7 @@ class NetForever : public NetProc {
void emit_recurse(struct target_t*) const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
@ -1853,6 +1862,7 @@ class NetPDelay : public NetProc {
unsigned long delay() const;
const NetExpr*expr() const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
@ -1876,6 +1886,7 @@ class NetRepeat : public NetProc {
const NetExpr*expr() const;
void emit_recurse(struct target_t*) const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
@ -1924,6 +1935,7 @@ class NetSTask : public NetProc {
const NetExpr* parm(unsigned idx) const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
@ -2025,6 +2037,7 @@ class NetUTask : public NetProc {
const NetScope* task() const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
@ -2047,6 +2060,7 @@ class NetWhile : public NetProc {
void emit_proc_recurse(struct target_t*) const;
virtual NexusSet* nex_input();
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
@ -2970,6 +2984,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.234 2002/04/21 17:43:13 steve
* implement nex_input for behavioral statements.
*
* Revision 1.233 2002/04/21 04:59:08 steve
* Add support for conbinational events by finding
* the inputs to expressions and some statements.

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.148 2002/04/21 04:59:08 steve Exp $"
#ident "$Id: parse.y,v 1.149 2002/04/21 17:43:13 steve Exp $"
#endif
# include "config.h"
@ -2262,6 +2262,13 @@ statement
tmp->set_statement($3);
$$ = tmp;
}
| '@' '(' '*' ')' statement_opt
{ PEventStatement*tmp = new PEventStatement;
tmp->set_file(@1.text);
tmp->set_lineno(@1.first_line);
tmp->set_statement($5);
$$ = tmp;
}
| lpvalue '=' expression ';'
{ PAssign*tmp = new PAssign($1,$3);
tmp->set_file(@1.text);