Allow unary operators in constant expressions.
This commit is contained in:
parent
888360dd3b
commit
056a3f7220
19
PExpr.cc
19
PExpr.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: PExpr.cc,v 1.18 2000/05/07 04:37:55 steve Exp $"
|
#ident "$Id: PExpr.cc,v 1.19 2000/06/30 15:50:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "PExpr.h"
|
# include "PExpr.h"
|
||||||
|
|
@ -212,8 +212,25 @@ bool PETernary::is_constant(Module*) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PEUnary::PEUnary(char op, PExpr*ex)
|
||||||
|
: op_(op), expr_(ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PEUnary::~PEUnary()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PEUnary::is_constant(Module*m) const
|
||||||
|
{
|
||||||
|
return expr_->is_constant(m);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: PExpr.cc,v $
|
* $Log: PExpr.cc,v $
|
||||||
|
* Revision 1.19 2000/06/30 15:50:20 steve
|
||||||
|
* Allow unary operators in constant expressions.
|
||||||
|
*
|
||||||
* Revision 1.18 2000/05/07 04:37:55 steve
|
* Revision 1.18 2000/05/07 04:37:55 steve
|
||||||
* Carry strength values from Verilog source to the
|
* Carry strength values from Verilog source to the
|
||||||
* pform and netlist for gates.
|
* pform and netlist for gates.
|
||||||
|
|
|
||||||
11
PExpr.h
11
PExpr.h
|
|
@ -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) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: PExpr.h,v 1.40 2000/06/13 05:22:16 steve Exp $"
|
#ident "$Id: PExpr.h,v 1.41 2000/06/30 15:50:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
@ -247,8 +247,8 @@ class PEString : public PExpr {
|
||||||
class PEUnary : public PExpr {
|
class PEUnary : public PExpr {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PEUnary(char op, PExpr*ex)
|
explicit PEUnary(char op, PExpr*ex);
|
||||||
: op_(op), expr_(ex) { }
|
~PEUnary();
|
||||||
|
|
||||||
virtual void dump(ostream&out) const;
|
virtual void dump(ostream&out) const;
|
||||||
virtual NetNet* elaborate_net(Design*des, const string&path,
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
||||||
|
|
@ -261,6 +261,8 @@ class PEUnary : public PExpr {
|
||||||
virtual NetEUnary*elaborate_expr(Design*des, NetScope*) const;
|
virtual NetEUnary*elaborate_expr(Design*des, NetScope*) const;
|
||||||
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
||||||
|
|
||||||
|
virtual bool is_constant(Module*) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char op_;
|
char op_;
|
||||||
PExpr*expr_;
|
PExpr*expr_;
|
||||||
|
|
@ -381,6 +383,9 @@ class PECallFunction : public PExpr {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: PExpr.h,v $
|
* $Log: PExpr.h,v $
|
||||||
|
* Revision 1.41 2000/06/30 15:50:20 steve
|
||||||
|
* Allow unary operators in constant expressions.
|
||||||
|
*
|
||||||
* Revision 1.40 2000/06/13 05:22:16 steve
|
* Revision 1.40 2000/06/13 05:22:16 steve
|
||||||
* Support concatenation in parameter expressions.
|
* Support concatenation in parameter expressions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
7
parse.y
7
parse.y
|
|
@ -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) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: parse.y,v 1.100 2000/06/27 16:00:40 steve Exp $"
|
#ident "$Id: parse.y,v 1.101 2000/06/30 15:50:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -1369,11 +1369,12 @@ parameter_assign
|
||||||
{ PExpr*tmp = $3;
|
{ PExpr*tmp = $3;
|
||||||
if (!pform_expression_is_constant(tmp)) {
|
if (!pform_expression_is_constant(tmp)) {
|
||||||
yyerror(@3, "error: parameter value "
|
yyerror(@3, "error: parameter value "
|
||||||
"must be constant.");
|
"must be a constant expression.");
|
||||||
delete tmp;
|
delete tmp;
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
}
|
} else {
|
||||||
pform_set_parameter($1, tmp);
|
pform_set_parameter($1, tmp);
|
||||||
|
}
|
||||||
delete $1;
|
delete $1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue