Elaborate ~^ and ~| operators.

This commit is contained in:
steve 1999-09-30 02:43:01 +00:00
parent b37fcf3593
commit c63a3acf93
6 changed files with 70 additions and 17 deletions

View File

@ -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) #if !defined(WINNT)
#ident "$Id: design_dump.cc,v 1.44 1999/09/29 18:36:03 steve Exp $" #ident "$Id: design_dump.cc,v 1.45 1999/09/30 02:43:01 steve Exp $"
#endif #endif
/* /*
@ -598,9 +598,15 @@ void NetEBinary::dump(ostream&o) const
case 'o': case 'o':
o << "||"; o << "||";
break; break;
case 'O':
o << "~|";
break;
case 'r': case 'r':
o << ">>"; o << ">>";
break; break;
case 'X':
o << "~^";
break;
} }
o << "("; o << "(";
right_->dump(o); right_->dump(o);
@ -768,6 +774,9 @@ void Design::dump(ostream&o) const
/* /*
* $Log: design_dump.cc,v $ * $Log: design_dump.cc,v $
* Revision 1.45 1999/09/30 02:43:01 steve
* Elaborate ~^ and ~| operators.
*
* Revision 1.44 1999/09/29 18:36:03 steve * Revision 1.44 1999/09/29 18:36:03 steve
* Full case support * Full case support
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: elab_expr.cc,v 1.5 1999/09/30 00:48:49 steve Exp $" #ident "$Id: elab_expr.cc,v 1.6 1999/09/30 02:43:02 steve Exp $"
#endif #endif
@ -77,6 +77,8 @@ NetExpr* PEBinary::elaborate_expr(Design*des, const string&path) const
case '^': case '^':
case '&': case '&':
case '|': case '|':
case 'O':
case 'X':
tmp = new NetEBBits(op_, lp, rp); tmp = new NetEBBits(op_, lp, rp);
tmp->set_line(*this); tmp->set_line(*this);
break; break;
@ -316,6 +318,9 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const
/* /*
* $Log: elab_expr.cc,v $ * $Log: elab_expr.cc,v $
* Revision 1.6 1999/09/30 02:43:02 steve
* Elaborate ~^ and ~| operators.
*
* Revision 1.5 1999/09/30 00:48:49 steve * Revision 1.5 1999/09/30 00:48:49 steve
* Cope with errors during ternary operator elaboration. * Cope with errors during ternary operator elaboration.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: elaborate.cc,v 1.104 1999/09/30 00:48:50 steve Exp $" #ident "$Id: elaborate.cc,v 1.105 1999/09/30 02:43:02 steve Exp $"
#endif #endif
/* /*
@ -2277,13 +2277,21 @@ NetProc* PRepeat::elaborate(Design*des, const string&path) const
*/ */
void PTask::elaborate(Design*des, const string&path) const void PTask::elaborate(Design*des, const string&path) const
{ {
NetProc*st = statement_->elaborate(des, path); NetProc*st;
if (statement_ == 0) {
cerr << get_line() << ": warning: task has no statement." << endl;
st = new NetBlock(NetBlock::SEQU);
} else {
st = statement_->elaborate(des, path);
if (st == 0) { if (st == 0) {
cerr << statement_->get_line() << ": Unable to elaborate " cerr << statement_->get_line() << ": Unable to elaborate "
"statement in task " << path << " at " << get_line() "statement in task " << path << " at " << get_line()
<< "." << endl; << "." << endl;
return; return;
} }
}
/* Translate the wires that are ports to NetNet pointers by /* Translate the wires that are ports to NetNet pointers by
presuming that the name is already elaborated, and look it presuming that the name is already elaborated, and look it
@ -2500,6 +2508,9 @@ Design* elaborate(const map<string,Module*>&modules,
/* /*
* $Log: elaborate.cc,v $ * $Log: elaborate.cc,v $
* Revision 1.105 1999/09/30 02:43:02 steve
* Elaborate ~^ and ~| operators.
*
* Revision 1.104 1999/09/30 00:48:50 steve * Revision 1.104 1999/09/30 00:48:50 steve
* Cope with errors during ternary operator elaboration. * Cope with errors during ternary operator elaboration.
* *

View File

@ -19,7 +19,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) #if !defined(WINNT)
#ident "$Id: netlist.h,v 1.74 1999/09/29 18:36:03 steve Exp $" #ident "$Id: netlist.h,v 1.75 1999/09/30 02:43:02 steve Exp $"
#endif #endif
/* /*
@ -1146,8 +1146,10 @@ class NetProcTop : public LineInfo {
* N -- Case inequality (!==) * N -- Case inequality (!==)
* a -- Logical AND (&&) * a -- Logical AND (&&)
* o -- Logical OR (||) * o -- Logical OR (||)
* O -- Bit-wise NOR
* l -- Left shift (<<) * l -- Left shift (<<)
* r -- Right shift (>>) * r -- Right shift (>>)
* X -- Bitwise exclusive NOR (~^)
*/ */
class NetEBinary : public NetExpr { class NetEBinary : public NetExpr {
@ -1202,6 +1204,8 @@ class NetEBAdd : public NetEBinary {
* ^ -- Bit-wise exclusive OR * ^ -- Bit-wise exclusive OR
* & -- Bit-wise AND * & -- Bit-wise AND
* | -- Bit-wise OR * | -- Bit-wise OR
* O -- Bit-wise NOR
* X -- Bit-wise XNOR (~^)
*/ */
class NetEBBits : public NetEBinary { class NetEBBits : public NetEBinary {
@ -1700,6 +1704,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.75 1999/09/30 02:43:02 steve
* Elaborate ~^ and ~| operators.
*
* Revision 1.74 1999/09/29 18:36:03 steve * Revision 1.74 1999/09/29 18:36:03 steve
* Full case support * Full case support
* *

18
parse.y
View File

@ -19,7 +19,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) #if !defined(WINNT)
#ident "$Id: parse.y,v 1.72 1999/09/30 01:22:37 steve Exp $" #ident "$Id: parse.y,v 1.73 1999/09/30 02:43:02 steve Exp $"
#endif #endif
# include "parse_misc.h" # include "parse_misc.h"
@ -149,8 +149,8 @@ extern void lex_end_table();
%left K_LOR %left K_LOR
%left K_LAND %left K_LAND
%left '|' %left '|'
%left '^' %left '^' K_NXOR K_NOR
%left '&' %left '&' K_NAND
%left K_EQ K_NE K_CEQ K_CNE %left K_EQ K_NE K_CEQ K_CNE
%left K_GE K_LE '<' '>' %left K_GE K_LE '<' '>'
%left K_LS K_RS %left K_LS K_RS
@ -496,6 +496,18 @@ expression
tmp->set_lineno(@2.first_line); tmp->set_lineno(@2.first_line);
$$ = tmp; $$ = tmp;
} }
| expression K_NOR expression
{ PEBinary*tmp = new PEBinary('O', $1, $3);
tmp->set_file(@2.text);
tmp->set_lineno(@2.first_line);
$$ = tmp;
}
| expression K_NXOR expression
{ PEBinary*tmp = new PEBinary('X', $1, $3);
tmp->set_file(@2.text);
tmp->set_lineno(@2.first_line);
$$ = tmp;
}
| expression '<' expression | expression '<' expression
{ PEBinary*tmp = new PEBinary('<', $1, $3); { PEBinary*tmp = new PEBinary('<', $1, $3);
tmp->set_file(@2.text); tmp->set_file(@2.text);

View File

@ -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) #if !defined(WINNT)
#ident "$Id: pform_dump.cc,v 1.43 1999/09/30 00:48:50 steve Exp $" #ident "$Id: pform_dump.cc,v 1.44 1999/09/30 02:43:02 steve Exp $"
#endif #endif
/* /*
@ -505,7 +505,10 @@ void PTask::dump(ostream&out, unsigned ind) const
out << (*ports_)[idx]->name() << ";" << endl; out << (*ports_)[idx]->name() << ";" << endl;
} }
if (statement_)
statement_->dump(out, ind); statement_->dump(out, ind);
else
out << setw(ind) << "" << "/* NOOP */" << endl;
} }
@ -569,8 +572,11 @@ void Module::dump(ostream&out) const
typedef map<string,PExpr*>::const_iterator parm_iter_t; typedef map<string,PExpr*>::const_iterator parm_iter_t;
for (parm_iter_t cur = parameters.begin() for (parm_iter_t cur = parameters.begin()
; cur != parameters.end() ; cur ++) { ; cur != parameters.end() ; cur ++) {
out << " parameter " << (*cur).first << " = " << out << " parameter " << (*cur).first << " = ";
*(*cur).second << ";" << endl; if ((*cur).second)
out << *(*cur).second << ";" << endl;
else
out << "/* ERROR */;" << endl;
} }
// Iterate through and display all the wires. // Iterate through and display all the wires.
@ -666,6 +672,9 @@ void PUdp::dump(ostream&out) const
/* /*
* $Log: pform_dump.cc,v $ * $Log: pform_dump.cc,v $
* Revision 1.44 1999/09/30 02:43:02 steve
* Elaborate ~^ and ~| operators.
*
* Revision 1.43 1999/09/30 00:48:50 steve * Revision 1.43 1999/09/30 00:48:50 steve
* Cope with errors during ternary operator elaboration. * Cope with errors during ternary operator elaboration.
* *