1998-11-04 00:28:49 +01:00
|
|
|
#ifndef __PExpr_H
|
|
|
|
|
#define __PExpr_H
|
|
|
|
|
/*
|
2000-02-16 04:58:27 +01:00
|
|
|
* Copyright (c) 1998-2000 Stephen Williams <steve@icarus.com>
|
1998-11-04 00:28:49 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
2000-02-23 03:56:53 +01:00
|
|
|
#if !defined(WINNT) && !defined(macintosh)
|
2000-09-09 17:21:26 +02:00
|
|
|
#ident "$Id: PExpr.h,v 1.43 2000/09/09 15:21:26 steve Exp $"
|
1998-11-04 00:28:49 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
# include <string>
|
1999-04-29 04:16:26 +02:00
|
|
|
# include "netlist.h"
|
1998-11-04 00:28:49 +01:00
|
|
|
# include "verinum.h"
|
1999-06-15 04:50:02 +02:00
|
|
|
# include "verireal.h"
|
1999-04-19 03:59:36 +02:00
|
|
|
# include "LineInfo.h"
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
class Design;
|
1999-05-16 07:08:42 +02:00
|
|
|
class Module;
|
1998-11-04 00:28:49 +01:00
|
|
|
class NetNet;
|
|
|
|
|
class NetExpr;
|
2000-03-08 05:36:53 +01:00
|
|
|
class NetScope;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The PExpr class hierarchy supports the description of
|
|
|
|
|
* expressions. The parser can generate expression objects from the
|
|
|
|
|
* source, possibly reducing things that it knows how to reduce.
|
|
|
|
|
*
|
|
|
|
|
* The elaborate_net method is used by structural elaboration to build
|
|
|
|
|
* up a netlist interpretation of the expression.
|
|
|
|
|
*/
|
|
|
|
|
|
1999-04-19 03:59:36 +02:00
|
|
|
class PExpr : public LineInfo {
|
2000-04-12 06:23:57 +02:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
public:
|
2000-04-12 06:23:57 +02:00
|
|
|
PExpr();
|
1998-11-04 00:28:49 +01:00
|
|
|
virtual ~PExpr();
|
|
|
|
|
|
|
|
|
|
virtual void dump(ostream&) const;
|
1999-09-15 06:17:52 +02:00
|
|
|
|
|
|
|
|
// Procedural elaboration of the expression.
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope) const;
|
|
|
|
|
|
|
|
|
|
// Elaborate expressions that are the r-value of parameter
|
|
|
|
|
// assignments. This elaboration follows the restrictions of
|
|
|
|
|
// constant expressions and supports later overriding and
|
|
|
|
|
// evaluation of parameters.
|
|
|
|
|
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
1999-09-15 06:17:52 +02:00
|
|
|
|
|
|
|
|
// This method elaborate the expression as gates, for use in a
|
1999-10-31 05:11:27 +01:00
|
|
|
// continuous assign or other wholly structural context.
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0 =Link::STRONG,
|
|
|
|
|
Link::strength_t drive1 =Link::STRONG)
|
|
|
|
|
const;
|
1999-09-15 06:17:52 +02:00
|
|
|
|
|
|
|
|
// This method elaborates the expression as gates, but
|
|
|
|
|
// restricted for use as l-values of continuous assignments.
|
|
|
|
|
virtual NetNet* elaborate_lnet(Design*des, const string&path) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-09-09 17:21:26 +02:00
|
|
|
// Expressions that can be in the l-value of procedural
|
|
|
|
|
// assignments can be elaborated with this method.
|
|
|
|
|
virtual NetAssign_* elaborate_lval(Design*des, NetScope*scope) const;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
// This attempts to evaluate a constant expression, and return
|
|
|
|
|
// a verinum as a result. If the expression cannot be
|
|
|
|
|
// evaluated, return 0.
|
1999-05-10 02:16:57 +02:00
|
|
|
virtual verinum* eval_const(const Design*des, const string&path) const;
|
1998-11-11 01:01:51 +01:00
|
|
|
|
|
|
|
|
// This method returns true if that expression is the same as
|
|
|
|
|
// this expression. This method is used for comparing
|
|
|
|
|
// expressions that must be structurally "identical".
|
|
|
|
|
virtual bool is_the_same(const PExpr*that) const;
|
1999-05-16 07:08:42 +02:00
|
|
|
|
|
|
|
|
// Return true if this expression is a valid constant
|
|
|
|
|
// expression. the Module pointer is needed to find parameter
|
|
|
|
|
// identifiers and any other module specific interpretations
|
|
|
|
|
// of expresions.
|
|
|
|
|
virtual bool is_constant(Module*) const;
|
1999-10-31 21:08:24 +01:00
|
|
|
|
2000-04-12 06:23:57 +02:00
|
|
|
private: // not implemented
|
|
|
|
|
PExpr(const PExpr&);
|
|
|
|
|
PExpr& operator= (const PExpr&);
|
1998-11-04 00:28:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ostream& operator << (ostream&, const PExpr&);
|
|
|
|
|
|
1999-05-10 02:16:57 +02:00
|
|
|
class PEConcat : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
2000-04-12 06:23:57 +02:00
|
|
|
PEConcat(const svector<PExpr*>&p, PExpr*r =0);
|
1999-06-10 06:03:52 +02:00
|
|
|
~PEConcat();
|
1999-05-10 02:16:57 +02:00
|
|
|
|
|
|
|
|
virtual void dump(ostream&) const;
|
1999-09-15 06:17:52 +02:00
|
|
|
virtual NetNet* elaborate_lnet(Design*des, const string&path) const;
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned width,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0,
|
|
|
|
|
Link::strength_t drive1) const;
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetExpr*elaborate_expr(Design*des, NetScope*) const;
|
2000-06-13 07:22:16 +02:00
|
|
|
virtual NetEConcat*elaborate_pexpr(Design*des, NetScope*) const;
|
2000-09-09 17:21:26 +02:00
|
|
|
virtual NetAssign_* elaborate_lval(Design*des, NetScope*scope) const;
|
1999-07-22 04:05:20 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
1999-05-10 02:16:57 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
svector<PExpr*>parms_;
|
1999-06-10 06:03:52 +02:00
|
|
|
PExpr*repeat_;
|
1999-05-10 02:16:57 +02:00
|
|
|
};
|
|
|
|
|
|
2000-04-01 21:31:57 +02:00
|
|
|
/*
|
|
|
|
|
* Event expressions are expressions that can be combined with the
|
|
|
|
|
* event "or" operator. These include "posedge foo" and similar, and
|
|
|
|
|
* also include named events. "edge" events are associated with an
|
|
|
|
|
* expression, whereas named events simply have a name, which
|
|
|
|
|
* represents an event variable.
|
|
|
|
|
*/
|
1999-04-29 04:16:26 +02:00
|
|
|
class PEEvent : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
2000-04-12 06:23:57 +02:00
|
|
|
enum edge_t {ANYEDGE, POSEDGE, NEGEDGE, POSITIVE};
|
|
|
|
|
|
2000-04-01 21:31:57 +02:00
|
|
|
// Use this constructor to create events based on edges or levels.
|
2000-04-12 06:23:57 +02:00
|
|
|
PEEvent(edge_t t, PExpr*e);
|
2000-04-01 21:31:57 +02:00
|
|
|
|
|
|
|
|
~PEEvent();
|
1999-04-29 04:16:26 +02:00
|
|
|
|
2000-04-12 06:23:57 +02:00
|
|
|
edge_t type() const;
|
|
|
|
|
PExpr* expr() const;
|
1999-04-29 04:16:26 +02:00
|
|
|
|
|
|
|
|
virtual void dump(ostream&) const;
|
|
|
|
|
|
|
|
|
|
private:
|
2000-04-12 06:23:57 +02:00
|
|
|
edge_t type_;
|
|
|
|
|
PExpr *expr_;
|
1999-04-29 04:16:26 +02:00
|
|
|
};
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
class PEIdent : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
2000-04-12 06:23:57 +02:00
|
|
|
explicit PEIdent(const string&s);
|
|
|
|
|
~PEIdent();
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
virtual void dump(ostream&) const;
|
1999-09-15 06:17:52 +02:00
|
|
|
|
|
|
|
|
// Identifiers are allowed (with restrictions) is assign l-values.
|
|
|
|
|
virtual NetNet* elaborate_lnet(Design*des, const string&path) const;
|
|
|
|
|
|
2000-09-09 17:21:26 +02:00
|
|
|
// Identifiers are also allowed as procedural assignment l-values.
|
|
|
|
|
virtual NetAssign_* elaborate_lval(Design*des, NetScope*scope) const;
|
|
|
|
|
|
1999-09-15 06:17:52 +02:00
|
|
|
// Structural r-values are OK.
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0,
|
|
|
|
|
Link::strength_t drive1) const;
|
1999-09-15 06:17:52 +02:00
|
|
|
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetExpr*elaborate_expr(Design*des, NetScope*) const;
|
2000-03-12 05:35:22 +01:00
|
|
|
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
1999-09-15 06:17:52 +02:00
|
|
|
|
2000-05-16 06:05:15 +02:00
|
|
|
// Elaborate the PEIdent as a port to a module. This method
|
|
|
|
|
// only applies to Ident expressions.
|
|
|
|
|
NetNet* elaborate_port(Design*des, NetScope*sc) const;
|
|
|
|
|
|
1999-05-16 07:08:42 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
1999-05-10 02:16:57 +02:00
|
|
|
verinum* eval_const(const Design*des, const string&path) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-04-12 06:23:57 +02:00
|
|
|
string name() const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
string text_;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Use these to support bit- and part-select operators.
|
|
|
|
|
PExpr*msb_;
|
|
|
|
|
PExpr*lsb_;
|
1999-04-19 03:59:36 +02:00
|
|
|
|
|
|
|
|
// If this is a reference to a memory, this is the index
|
|
|
|
|
// expression.
|
|
|
|
|
PExpr*idx_;
|
1999-11-21 01:13:08 +01:00
|
|
|
|
|
|
|
|
NetNet* elaborate_net_ram_(Design*des, const string&path,
|
|
|
|
|
NetMemory*mem, unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PENumber : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
2000-04-12 06:23:57 +02:00
|
|
|
explicit PENumber(verinum*vp);
|
|
|
|
|
~PENumber();
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-04-12 06:23:57 +02:00
|
|
|
const verinum& value() const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
virtual void dump(ostream&) const;
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0,
|
|
|
|
|
Link::strength_t drive1) const;
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetEConst*elaborate_expr(Design*des, NetScope*) const;
|
|
|
|
|
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
1999-05-10 02:16:57 +02:00
|
|
|
virtual verinum* eval_const(const Design*des, const string&path) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
1998-11-11 01:01:51 +01:00
|
|
|
virtual bool is_the_same(const PExpr*that) const;
|
1999-05-16 07:08:42 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
1998-11-11 01:01:51 +01:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
private:
|
|
|
|
|
verinum*const value_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PEString : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
2000-04-12 06:23:57 +02:00
|
|
|
explicit PEString(const string&s);
|
|
|
|
|
~PEString();
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-04-12 06:23:57 +02:00
|
|
|
string value() const;
|
1998-11-04 00:28:49 +01:00
|
|
|
virtual void dump(ostream&) const;
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetEConst*elaborate_expr(Design*des, NetScope*) const;
|
2000-06-01 04:31:39 +02:00
|
|
|
virtual NetEConst*elaborate_pexpr(Design*des, NetScope*sc) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
1999-05-16 07:08:42 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
private:
|
|
|
|
|
const string text_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PEUnary : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
2000-06-30 17:50:20 +02:00
|
|
|
explicit PEUnary(char op, PExpr*ex);
|
|
|
|
|
~PEUnary();
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
virtual void dump(ostream&out) const;
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned width,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0,
|
|
|
|
|
Link::strength_t drive1) const;
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetEUnary*elaborate_expr(Design*des, NetScope*) const;
|
2000-03-12 19:22:11 +01:00
|
|
|
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
2000-09-08 00:38:13 +02:00
|
|
|
virtual verinum* eval_const(const Design*des, const string&path) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-06-30 17:50:20 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
private:
|
|
|
|
|
char op_;
|
|
|
|
|
PExpr*expr_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PEBinary : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit PEBinary(char op, PExpr*l, PExpr*r)
|
|
|
|
|
: op_(op), left_(l), right_(r) { }
|
|
|
|
|
|
1999-06-16 05:13:29 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
virtual void dump(ostream&out) const;
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned width,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0,
|
|
|
|
|
Link::strength_t drive1) const;
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetEBinary*elaborate_expr(Design*des, NetScope*) const;
|
2000-03-12 19:22:11 +01:00
|
|
|
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
|
1999-05-10 02:16:57 +02:00
|
|
|
virtual verinum* eval_const(const Design*des, const string&path) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
char op_;
|
|
|
|
|
PExpr*left_;
|
|
|
|
|
PExpr*right_;
|
1999-10-31 21:08:24 +01:00
|
|
|
|
2000-03-12 19:22:11 +01:00
|
|
|
NetEBinary*elaborate_expr_base_(Design*, NetExpr*lp, NetExpr*rp) const;
|
|
|
|
|
|
1999-10-31 21:08:24 +01:00
|
|
|
NetNet* elaborate_net_add_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
2000-02-16 04:58:27 +01:00
|
|
|
NetNet* elaborate_net_bit_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
1999-11-05 22:45:19 +01:00
|
|
|
NetNet* elaborate_net_cmp_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
2000-04-01 23:40:22 +02:00
|
|
|
NetNet* elaborate_net_div_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
1999-12-16 04:46:39 +01:00
|
|
|
NetNet* elaborate_net_log_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
2000-01-13 04:35:35 +01:00
|
|
|
NetNet* elaborate_net_mul_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
1999-11-14 21:24:28 +01:00
|
|
|
NetNet* elaborate_net_shift_(Design*des, const string&path,
|
|
|
|
|
unsigned lwidth,
|
|
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay) const;
|
1998-11-04 00:28:49 +01:00
|
|
|
};
|
|
|
|
|
|
1999-06-10 06:03:52 +02:00
|
|
|
/*
|
|
|
|
|
* This class supports the ternary (?:) operator. The operator takes
|
|
|
|
|
* three expressions, the test, the true result and the false result.
|
|
|
|
|
*/
|
|
|
|
|
class PETernary : public PExpr {
|
|
|
|
|
|
|
|
|
|
public:
|
1999-07-17 21:50:59 +02:00
|
|
|
explicit PETernary(PExpr*e, PExpr*t, PExpr*f);
|
1999-06-10 06:03:52 +02:00
|
|
|
~PETernary();
|
|
|
|
|
|
1999-07-17 21:50:59 +02:00
|
|
|
virtual bool is_constant(Module*) const;
|
|
|
|
|
|
|
|
|
|
virtual void dump(ostream&out) const;
|
1999-08-01 23:18:55 +02:00
|
|
|
virtual NetNet* elaborate_net(Design*des, const string&path,
|
1999-10-31 05:11:27 +01:00
|
|
|
unsigned width,
|
2000-05-07 06:37:55 +02:00
|
|
|
unsigned long rise,
|
|
|
|
|
unsigned long fall,
|
|
|
|
|
unsigned long decay,
|
|
|
|
|
Link::strength_t drive0,
|
|
|
|
|
Link::strength_t drive1) const;
|
2000-03-08 05:36:53 +01:00
|
|
|
virtual NetETernary*elaborate_expr(Design*des, NetScope*) const;
|
1999-07-17 21:50:59 +02:00
|
|
|
virtual verinum* eval_const(const Design*des, const string&path) const;
|
|
|
|
|
|
1999-06-10 06:03:52 +02:00
|
|
|
private:
|
|
|
|
|
PExpr*expr_;
|
|
|
|
|
PExpr*tru_;
|
|
|
|
|
PExpr*fal_;
|
|
|
|
|
};
|
|
|
|
|
|
1999-09-25 04:57:29 +02:00
|
|
|
/*
|
2000-05-04 05:37:58 +02:00
|
|
|
* This class represents a parsed call to a function, including calls
|
|
|
|
|
* to system functions.
|
1999-09-25 04:57:29 +02:00
|
|
|
*/
|
1999-07-31 21:14:47 +02:00
|
|
|
class PECallFunction : public PExpr {
|
1999-09-25 04:57:29 +02:00
|
|
|
public:
|
2000-05-04 05:37:58 +02:00
|
|
|
explicit PECallFunction(const char*n, const svector<PExpr *> &parms);
|
|
|
|
|
explicit PECallFunction(const char*n);
|
1999-09-25 04:57:29 +02:00
|
|
|
~PECallFunction();
|
1999-07-31 21:14:47 +02:00
|
|
|
|
|
|
|
|
virtual void dump(ostream &) const;
|
2000-05-04 05:37:58 +02:00
|
|
|
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope) const;
|
1999-07-31 21:14:47 +02:00
|
|
|
|
1999-09-25 04:57:29 +02:00
|
|
|
private:
|
1999-07-31 21:14:47 +02:00
|
|
|
string name_;
|
|
|
|
|
svector<PExpr *> parms_;
|
1999-09-25 04:57:29 +02:00
|
|
|
|
2000-05-04 05:37:58 +02:00
|
|
|
NetExpr* elaborate_sfunc_(Design*des, NetScope*scope) const;
|
1999-07-31 21:14:47 +02:00
|
|
|
};
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
|
|
|
|
* $Log: PExpr.h,v $
|
2000-09-09 17:21:26 +02:00
|
|
|
* Revision 1.43 2000/09/09 15:21:26 steve
|
|
|
|
|
* move lval elaboration to PExpr virtual methods.
|
|
|
|
|
*
|
2000-09-08 00:38:13 +02:00
|
|
|
* Revision 1.42 2000/09/07 22:38:13 steve
|
|
|
|
|
* Support unary + and - in constants.
|
|
|
|
|
*
|
2000-06-30 17:50:20 +02:00
|
|
|
* Revision 1.41 2000/06/30 15:50:20 steve
|
|
|
|
|
* Allow unary operators in constant expressions.
|
|
|
|
|
*
|
2000-06-13 07:22:16 +02:00
|
|
|
* Revision 1.40 2000/06/13 05:22:16 steve
|
|
|
|
|
* Support concatenation in parameter expressions.
|
|
|
|
|
*
|
2000-06-01 04:31:39 +02:00
|
|
|
* Revision 1.39 2000/06/01 02:31:39 steve
|
|
|
|
|
* Parameters can be strings.
|
|
|
|
|
*
|
2000-05-16 06:05:15 +02:00
|
|
|
* Revision 1.38 2000/05/16 04:05:15 steve
|
|
|
|
|
* Module ports are really special PEIdent
|
|
|
|
|
* expressions, because a name can be used
|
|
|
|
|
* many places in the port list.
|
|
|
|
|
*
|
2000-05-07 06:37:55 +02:00
|
|
|
* Revision 1.37 2000/05/07 04:37:56 steve
|
|
|
|
|
* Carry strength values from Verilog source to the
|
|
|
|
|
* pform and netlist for gates.
|
|
|
|
|
*
|
|
|
|
|
* Change vvm constants to use the driver_t to drive
|
|
|
|
|
* a constant value. This works better if there are
|
|
|
|
|
* multiple drivers on a signal.
|
|
|
|
|
*
|
2000-05-04 05:37:58 +02:00
|
|
|
* Revision 1.36 2000/05/04 03:37:58 steve
|
|
|
|
|
* Add infrastructure for system functions, move
|
|
|
|
|
* $time to that structure and add $random.
|
|
|
|
|
*
|
2000-04-12 06:23:57 +02:00
|
|
|
* Revision 1.35 2000/04/12 04:23:57 steve
|
|
|
|
|
* Named events really should be expressed with PEIdent
|
|
|
|
|
* objects in the pform,
|
|
|
|
|
*
|
|
|
|
|
* Handle named events within the mix of net events
|
|
|
|
|
* and edges. As a unified lot they get caught together.
|
|
|
|
|
* wait statements are broken into more complex statements
|
|
|
|
|
* that include a conditional.
|
|
|
|
|
*
|
|
|
|
|
* Do not generate NetPEvent or NetNEvent objects in
|
|
|
|
|
* elaboration. NetEvent, NetEvWait and NetEvProbe
|
|
|
|
|
* take over those functions in the netlist.
|
|
|
|
|
*
|
2000-04-01 23:40:22 +02:00
|
|
|
* Revision 1.34 2000/04/01 21:40:22 steve
|
|
|
|
|
* Add support for integer division.
|
|
|
|
|
*
|
2000-04-01 21:31:57 +02:00
|
|
|
* Revision 1.33 2000/04/01 19:31:57 steve
|
|
|
|
|
* Named events as far as the pform.
|
|
|
|
|
*
|
2000-03-12 19:22:11 +01:00
|
|
|
* Revision 1.32 2000/03/12 18:22:11 steve
|
|
|
|
|
* Binary and unary operators in parameter expressions.
|
|
|
|
|
*
|
2000-03-12 05:35:22 +01:00
|
|
|
* Revision 1.31 2000/03/12 04:35:22 steve
|
|
|
|
|
* Allow parameter identifiers in parameter expressions.
|
|
|
|
|
*
|
2000-03-08 05:36:53 +01:00
|
|
|
* Revision 1.30 2000/03/08 04:36:53 steve
|
|
|
|
|
* Redesign the implementation of scopes and parameters.
|
|
|
|
|
* I now generate the scopes and notice the parameters
|
|
|
|
|
* in a separate pass over the pform. Once the scopes
|
|
|
|
|
* are generated, I can process overrides and evalutate
|
|
|
|
|
* paremeters before elaboration begins.
|
|
|
|
|
*
|
2000-02-23 03:56:53 +01:00
|
|
|
* Revision 1.29 2000/02/23 02:56:53 steve
|
|
|
|
|
* Macintosh compilers do not support ident.
|
|
|
|
|
*
|
2000-02-16 04:58:27 +01:00
|
|
|
* Revision 1.28 2000/02/16 03:58:27 steve
|
|
|
|
|
* Fix up width matching in structural bitwise operators.
|
|
|
|
|
*
|
2000-01-13 04:35:35 +01:00
|
|
|
* Revision 1.27 2000/01/13 03:35:35 steve
|
|
|
|
|
* Multiplication all the way to simulation.
|
|
|
|
|
*
|
1999-12-16 04:46:39 +01:00
|
|
|
* Revision 1.26 1999/12/16 03:46:39 steve
|
|
|
|
|
* Structural logical or.
|
|
|
|
|
*
|
1999-11-21 01:13:08 +01:00
|
|
|
* Revision 1.25 1999/11/21 00:13:08 steve
|
|
|
|
|
* Support memories in continuous assignments.
|
|
|
|
|
*
|
1999-11-14 21:24:28 +01:00
|
|
|
* Revision 1.24 1999/11/14 20:24:28 steve
|
|
|
|
|
* Add support for the LPM_CLSHIFT device.
|
|
|
|
|
*
|
1999-11-05 22:45:19 +01:00
|
|
|
* Revision 1.23 1999/11/05 21:45:19 steve
|
|
|
|
|
* Fix NetConst being set to zero width, and clean
|
|
|
|
|
* up elaborate_set_cmp_ for NetEBinary.
|
|
|
|
|
*
|
1999-10-31 21:08:24 +01:00
|
|
|
* Revision 1.22 1999/10/31 20:08:24 steve
|
|
|
|
|
* Include subtraction in LPM_ADD_SUB device.
|
|
|
|
|
*
|
1999-10-31 05:11:27 +01:00
|
|
|
* Revision 1.21 1999/10/31 04:11:27 steve
|
|
|
|
|
* Add to netlist links pin name and instance number,
|
|
|
|
|
* and arrange in vvm for pin connections by name
|
|
|
|
|
* and instance number.
|
|
|
|
|
*
|
1999-09-25 04:57:29 +02:00
|
|
|
* Revision 1.20 1999/09/25 02:57:29 steve
|
|
|
|
|
* Parse system function calls.
|
|
|
|
|
*
|
1999-09-15 06:17:52 +02:00
|
|
|
* Revision 1.19 1999/09/15 04:17:52 steve
|
|
|
|
|
* separate assign lval elaboration for error checking.
|
|
|
|
|
*
|
1999-09-01 00:38:29 +02:00
|
|
|
* Revision 1.18 1999/08/31 22:38:29 steve
|
|
|
|
|
* Elaborate and emit to vvm procedural functions.
|
|
|
|
|
*
|
1999-08-01 23:18:55 +02:00
|
|
|
* Revision 1.17 1999/08/01 21:18:55 steve
|
|
|
|
|
* elaborate rise/fall/decay for continuous assign.
|
|
|
|
|
*
|
1999-07-31 21:14:47 +02:00
|
|
|
* Revision 1.16 1999/07/31 19:14:47 steve
|
|
|
|
|
* Add functions up to elaboration (Ed Carter)
|
|
|
|
|
*
|
1999-07-22 04:05:20 +02:00
|
|
|
* Revision 1.15 1999/07/22 02:05:20 steve
|
|
|
|
|
* is_constant method for PEConcat.
|
|
|
|
|
*
|
1999-07-17 21:50:59 +02:00
|
|
|
* Revision 1.14 1999/07/17 19:50:59 steve
|
|
|
|
|
* netlist support for ternary operator.
|
|
|
|
|
*
|
1999-06-16 05:13:29 +02:00
|
|
|
* Revision 1.13 1999/06/16 03:13:29 steve
|
|
|
|
|
* More syntax parse with sorry stubs.
|
|
|
|
|
*
|
1999-06-15 04:50:02 +02:00
|
|
|
* Revision 1.12 1999/06/15 02:50:02 steve
|
|
|
|
|
* Add lexical support for real numbers.
|
|
|
|
|
*
|
1999-06-10 06:03:52 +02:00
|
|
|
* Revision 1.11 1999/06/10 04:03:52 steve
|
|
|
|
|
* Add support for the Ternary operator,
|
|
|
|
|
* Add support for repeat concatenation,
|
|
|
|
|
* Correct some seg faults cause by elaboration
|
|
|
|
|
* errors,
|
|
|
|
|
* Parse the casex anc casez statements.
|
|
|
|
|
*
|
1999-06-09 05:00:05 +02:00
|
|
|
* Revision 1.10 1999/06/09 03:00:05 steve
|
|
|
|
|
* Add support for procedural concatenation expression.
|
|
|
|
|
*
|
1999-05-16 07:08:42 +02:00
|
|
|
* Revision 1.9 1999/05/16 05:08:42 steve
|
|
|
|
|
* Redo constant expression detection to happen
|
|
|
|
|
* after parsing.
|
|
|
|
|
*
|
|
|
|
|
* Parse more operators and expressions.
|
|
|
|
|
*
|
1999-05-10 02:16:57 +02:00
|
|
|
* Revision 1.8 1999/05/10 00:16:57 steve
|
|
|
|
|
* Parse and elaborate the concatenate operator
|
|
|
|
|
* in structural contexts, Replace vector<PExpr*>
|
|
|
|
|
* and list<PExpr*> with svector<PExpr*>, evaluate
|
|
|
|
|
* constant expressions with parameters, handle
|
|
|
|
|
* memories as lvalues.
|
|
|
|
|
*
|
|
|
|
|
* Parse task declarations, integer types.
|
|
|
|
|
*
|
1999-05-01 04:57:52 +02:00
|
|
|
* Revision 1.7 1999/05/01 02:57:52 steve
|
|
|
|
|
* Handle much more complex event expressions.
|
|
|
|
|
*
|
1999-04-29 04:16:26 +02:00
|
|
|
* Revision 1.6 1999/04/29 02:16:26 steve
|
|
|
|
|
* Parse OR of event expressions.
|
|
|
|
|
*
|
1999-04-19 03:59:36 +02:00
|
|
|
* Revision 1.5 1999/04/19 01:59:36 steve
|
|
|
|
|
* Add memories to the parse and elaboration phases.
|
|
|
|
|
*
|
1998-11-11 01:01:51 +01:00
|
|
|
* Revision 1.4 1998/11/11 00:01:51 steve
|
|
|
|
|
* Check net ranges in declarations.
|
|
|
|
|
*
|
1998-11-09 19:55:33 +01:00
|
|
|
* Revision 1.3 1998/11/09 18:55:33 steve
|
|
|
|
|
* Add procedural while loops,
|
|
|
|
|
* Parse procedural for loops,
|
|
|
|
|
* Add procedural wait statements,
|
|
|
|
|
* Add constant nodes,
|
|
|
|
|
* Add XNOR logic gate,
|
|
|
|
|
* Make vvm output look a bit prettier.
|
|
|
|
|
*
|
1998-11-07 18:05:05 +01:00
|
|
|
* Revision 1.2 1998/11/07 17:05:05 steve
|
|
|
|
|
* Handle procedural conditional, and some
|
|
|
|
|
* of the conditional expressions.
|
|
|
|
|
*
|
|
|
|
|
* Elaborate signals and identifiers differently,
|
|
|
|
|
* allowing the netlist to hold signal information.
|
|
|
|
|
*
|
1998-11-04 00:28:49 +01:00
|
|
|
* Revision 1.1 1998/11/03 23:28:54 steve
|
|
|
|
|
* Introduce verilog to CVS.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#endif
|