Skip to content

Commit

Permalink
Named events really should be expressed with PEIdent
Browse files Browse the repository at this point in the history
 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.
  • Loading branch information
steve committed Apr 12, 2000
1 parent b0d0cdb commit b1fd927
Show file tree
Hide file tree
Showing 16 changed files with 492 additions and 325 deletions.
76 changes: 66 additions & 10 deletions PExpr.cc
Expand Up @@ -17,13 +17,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PExpr.cc,v 1.15 2000/04/01 19:31:57 steve Exp $"
#ident "$Id: PExpr.cc,v 1.16 2000/04/12 04:23:57 steve Exp $"
#endif

# include "PExpr.h"
# include "Module.h"
# include <typeinfo>

PExpr::PExpr()
{
}

PExpr::~PExpr()
{
}
Expand Down Expand Up @@ -69,6 +73,11 @@ PECallFunction::~PECallFunction()
{
}

PEConcat::PEConcat(const svector<PExpr*>&p, PExpr*r)
: parms_(p), repeat_(r)
{
}

bool PEConcat::is_constant(Module *mod) const
{
bool constant = repeat_? repeat_->is_constant(mod) : true;
Expand All @@ -83,21 +92,16 @@ PEConcat::~PEConcat()
delete repeat_;
}

PEEvent::PEEvent(NetNEvent::Type t, PExpr*e)
PEEvent::PEEvent(PEEvent::edge_t t, PExpr*e)
: type_(t), expr_(e)
{
}

PEEvent::PEEvent(const string&n)
: name_(n)
{
}

PEEvent::~PEEvent()
{
}

NetNEvent::Type PEEvent::type() const
PEEvent::edge_t PEEvent::type() const
{
return type_;
}
Expand All @@ -107,9 +111,18 @@ PExpr* PEEvent::expr() const
return expr_;
}

string PEEvent::name() const
PEIdent::PEIdent(const string&s)
: text_(s), msb_(0), lsb_(0), idx_(0)
{
return name_;
}

PEIdent::~PEIdent()
{
}

string PEIdent::name() const
{
return text_;
}

/*
Expand All @@ -129,6 +142,22 @@ bool PEIdent::is_constant(Module*mod) const
return false;
}

PENumber::PENumber(verinum*vp)
: value_(vp)
{
assert(vp);
}

PENumber::~PENumber()
{
delete value_;
}

const verinum& PENumber::value() const
{
return *value_;
}

bool PENumber::is_the_same(const PExpr*that) const
{
const PENumber*obj = dynamic_cast<const PENumber*>(that);
Expand All @@ -143,6 +172,20 @@ bool PENumber::is_constant(Module*) const
return true;
}

PEString::PEString(const string&s)
: text_(s)
{
}

PEString::~PEString()
{
}

string PEString::value() const
{
return text_;
}

bool PEString::is_constant(Module*) const
{
return true;
Expand All @@ -164,6 +207,19 @@ bool PETernary::is_constant(Module*) const

/*
* $Log: PExpr.cc,v $
* Revision 1.16 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.
*
* Revision 1.15 2000/04/01 19:31:57 steve
* Named events as far as the pform.
*
Expand Down
59 changes: 36 additions & 23 deletions PExpr.h
Expand Up @@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PExpr.h,v 1.34 2000/04/01 21:40:22 steve Exp $"
#ident "$Id: PExpr.h,v 1.35 2000/04/12 04:23:57 steve Exp $"
#endif

# include <string>
Expand All @@ -44,7 +44,9 @@ class NetScope;
*/

class PExpr : public LineInfo {

public:
PExpr();
virtual ~PExpr();

virtual void dump(ostream&) const;
Expand Down Expand Up @@ -86,15 +88,17 @@ class PExpr : public LineInfo {
// of expresions.
virtual bool is_constant(Module*) const;

private: // not implemented
PExpr(const PExpr&);
PExpr& operator= (const PExpr&);
};

ostream& operator << (ostream&, const PExpr&);

class PEConcat : public PExpr {

public:
PEConcat(const svector<PExpr*>&p, PExpr*r =0)
: parms_(p), repeat_(r) { }
PEConcat(const svector<PExpr*>&p, PExpr*r =0);
~PEConcat();

virtual void dump(ostream&) const;
Expand Down Expand Up @@ -122,30 +126,28 @@ class PEConcat : public PExpr {
class PEEvent : public PExpr {

public:
enum edge_t {ANYEDGE, POSEDGE, NEGEDGE, POSITIVE};

// Use this constructor to create events based on edges or levels.
PEEvent(NetNEvent::Type t, PExpr*e);
// Use this to create named events.
PEEvent(const string&n);
PEEvent(edge_t t, PExpr*e);

~PEEvent();

NetNEvent::Type type() const;
PExpr* expr() const;
string name() const;
edge_t type() const;
PExpr* expr() const;

virtual void dump(ostream&) const;

private:
NetNEvent::Type type_;
PExpr*expr_;
string name_;
edge_t type_;
PExpr *expr_;
};

class PEIdent : public PExpr {

public:
explicit PEIdent(const string&s)
: text_(s), msb_(0), lsb_(0), idx_(0) { }
explicit PEIdent(const string&s);
~PEIdent();

virtual void dump(ostream&) const;

Expand All @@ -165,8 +167,7 @@ class PEIdent : public PExpr {
virtual bool is_constant(Module*) const;
verinum* eval_const(const Design*des, const string&path) const;

// XXXX
string name() const { return text_; }
string name() const;

private:
string text_;
Expand All @@ -190,11 +191,10 @@ class PEIdent : public PExpr {
class PENumber : public PExpr {

public:
explicit PENumber(verinum*vp)
: value_(vp) { assert(vp); }
~PENumber() { delete value_; }
explicit PENumber(verinum*vp);
~PENumber();

const verinum& value() const { return *value_; }
const verinum& value() const;

virtual void dump(ostream&) const;
virtual NetNet* elaborate_net(Design*des, const string&path,
Expand All @@ -216,10 +216,10 @@ class PENumber : public PExpr {
class PEString : public PExpr {

public:
explicit PEString(const string&s)
: text_(s) { }
explicit PEString(const string&s);
~PEString();

string value() const { return text_; }
string value() const;
virtual void dump(ostream&) const;
virtual NetEConst*elaborate_expr(Design*des, NetScope*) const;

Expand Down Expand Up @@ -358,6 +358,19 @@ class PECallFunction : public PExpr {

/*
* $Log: PExpr.h,v $
* 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.
*
* Revision 1.34 2000/04/01 21:40:22 steve
* Add support for integer division.
*
Expand Down
36 changes: 35 additions & 1 deletion Statement.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Statement.cc,v 1.18 2000/04/01 19:31:57 steve Exp $"
#ident "$Id: Statement.cc,v 1.19 2000/04/12 04:23:57 steve Exp $"
#endif

# include "Statement.h"
Expand Down Expand Up @@ -122,13 +122,29 @@ PCase::~PCase()
delete[]items_;
}

PCondit::PCondit(PExpr*ex, Statement*i, Statement*e)
: expr_(ex), if_(i), else_(e)
{
}

PCondit::~PCondit()
{
delete expr_;
delete if_;
delete else_;
}


PDelayStatement::PDelayStatement(PExpr*d, Statement*st)
: delay_(d), statement_(st)
{
}

PDelayStatement::~PDelayStatement()
{
}


PEventStatement::PEventStatement(const svector<PEEvent*>&ee)
: expr_(ee), statement_(0)
{
Expand All @@ -146,6 +162,11 @@ PEventStatement::~PEventStatement()
// delete the events and the statement?
}

void PEventStatement::set_statement(Statement*st)
{
statement_ = st;
}

PForever::PForever(Statement*s)
: statement_(s)
{
Expand Down Expand Up @@ -189,6 +210,19 @@ PWhile::~PWhile()

/*
* $Log: Statement.cc,v $
* Revision 1.19 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.
*
* Revision 1.18 2000/04/01 19:31:57 steve
* Named events as far as the pform.
*
Expand Down

0 comments on commit b1fd927

Please sign in to comment.