Named events as far as the pform.
This commit is contained in:
parent
26dcecebdb
commit
2dd010dc04
|
|
@ -18,7 +18,7 @@
|
||||||
# 59 Temple Place - Suite 330
|
# 59 Temple Place - Suite 330
|
||||||
# Boston, MA 02111-1307, USA
|
# Boston, MA 02111-1307, USA
|
||||||
#
|
#
|
||||||
#ident "$Id: Makefile.in,v 1.41 2000/03/29 04:37:10 steve Exp $"
|
#ident "$Id: Makefile.in,v 1.42 2000/04/01 19:31:57 steve Exp $"
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
@ -75,7 +75,8 @@ expr_synth.o functor.o lexor.o lexor_keyword.o mangle.o netlist.o \
|
||||||
net_design.o net_udp.o nexus_from_link.o pad_to_width.o \
|
net_design.o net_udp.o nexus_from_link.o pad_to_width.o \
|
||||||
parse.o parse_misc.o pform.o pform_dump.o \
|
parse.o parse_misc.o pform.o pform_dump.o \
|
||||||
set_width.o \
|
set_width.o \
|
||||||
verinum.o verireal.o target.o targets.o Module.o PDelays.o PExpr.o PGate.o \
|
verinum.o verireal.o target.o targets.o Module.o PDelays.o PEvent.o \
|
||||||
|
PExpr.o PGate.o \
|
||||||
PTask.o PFunction.o PWire.o Statement.o \
|
PTask.o PFunction.o PWire.o Statement.o \
|
||||||
$(FF) $(TT)
|
$(FF) $(TT)
|
||||||
|
|
||||||
|
|
|
||||||
10
Module.h
10
Module.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: Module.h,v 1.16 2000/03/12 17:09:40 steve Exp $"
|
#ident "$Id: Module.h,v 1.17 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <list>
|
# include <list>
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
# include "svector.h"
|
# include "svector.h"
|
||||||
# include "named.h"
|
# include "named.h"
|
||||||
# include <string>
|
# include <string>
|
||||||
|
class PEvent;
|
||||||
class PExpr;
|
class PExpr;
|
||||||
class PGate;
|
class PGate;
|
||||||
class PTask;
|
class PTask;
|
||||||
|
|
@ -81,6 +82,10 @@ class Module {
|
||||||
a parameter-index to its name. */
|
a parameter-index to its name. */
|
||||||
list<string> param_names;
|
list<string> param_names;
|
||||||
|
|
||||||
|
/* Keep a table of named events declared in the module. */
|
||||||
|
map<string,PEvent*>events;
|
||||||
|
|
||||||
|
|
||||||
const string&get_name() const { return name_; }
|
const string&get_name() const { return name_; }
|
||||||
|
|
||||||
void add_gate(PGate*gate);
|
void add_gate(PGate*gate);
|
||||||
|
|
@ -130,6 +135,9 @@ class Module {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: Module.h,v $
|
* $Log: Module.h,v $
|
||||||
|
* Revision 1.17 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.16 2000/03/12 17:09:40 steve
|
* Revision 1.16 2000/03/12 17:09:40 steve
|
||||||
* Support localparam.
|
* Support localparam.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 200Stephen Williams (steve@icarus.com)
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
|
#ident "$Id: PEvent.cc,v 1.1 2000/04/01 19:31:57 steve Exp $"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# include "PEvent.h"
|
||||||
|
|
||||||
|
PEvent::PEvent(const string&n)
|
||||||
|
: name_(n)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PEvent::~PEvent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
string PEvent::name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: PEvent.cc,v $
|
||||||
|
* Revision 1.1 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
#ifndef __PEvent_H
|
||||||
|
#define __PEvent_H
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
|
#ident "$Id: PEvent.h,v 1.1 2000/04/01 19:31:57 steve Exp $"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# include "LineInfo.h"
|
||||||
|
# include <string>
|
||||||
|
class ostream;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The PEvent class represents event objects. These are things that
|
||||||
|
* are declared in Verilog as ``event foo;''
|
||||||
|
*/
|
||||||
|
class PEvent : public LineInfo {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PEvent(const string&name);
|
||||||
|
~PEvent();
|
||||||
|
|
||||||
|
string name() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string name_;
|
||||||
|
|
||||||
|
private: // not implemented
|
||||||
|
PEvent(const PEvent&);
|
||||||
|
PEvent& operator= (const PEvent&);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: PEvent.h,v $
|
||||||
|
* Revision 1.1 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
34
PExpr.cc
34
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.14 2000/03/12 18:22:11 steve Exp $"
|
#ident "$Id: PExpr.cc,v 1.15 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "PExpr.h"
|
# include "PExpr.h"
|
||||||
|
|
@ -83,6 +83,35 @@ PEConcat::~PEConcat()
|
||||||
delete repeat_;
|
delete repeat_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PEEvent::PEEvent(NetNEvent::Type t, PExpr*e)
|
||||||
|
: type_(t), expr_(e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PEEvent::PEEvent(const string&n)
|
||||||
|
: name_(n)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PEEvent::~PEEvent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NetNEvent::Type PEEvent::type() const
|
||||||
|
{
|
||||||
|
return type_;
|
||||||
|
}
|
||||||
|
|
||||||
|
PExpr* PEEvent::expr() const
|
||||||
|
{
|
||||||
|
return expr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
string PEEvent::name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An identifier can be in a constant expresion if (and only if) it is
|
* An identifier can be in a constant expresion if (and only if) it is
|
||||||
* a parameter.
|
* a parameter.
|
||||||
|
|
@ -135,6 +164,9 @@ bool PETernary::is_constant(Module*) const
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: PExpr.cc,v $
|
* $Log: PExpr.cc,v $
|
||||||
|
* Revision 1.15 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.14 2000/03/12 18:22:11 steve
|
* Revision 1.14 2000/03/12 18:22:11 steve
|
||||||
* Binary and unary operators in parameter expressions.
|
* Binary and unary operators in parameter expressions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
27
PExpr.h
27
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.32 2000/03/12 18:22:11 steve Exp $"
|
#ident "$Id: PExpr.h,v 1.33 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
@ -112,21 +112,33 @@ class PEConcat : public PExpr {
|
||||||
PExpr*repeat_;
|
PExpr*repeat_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
class PEEvent : public PExpr {
|
class PEEvent : public PExpr {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PEEvent(NetNEvent::Type t, PExpr*e)
|
// Use this constructor to create events based on edges or levels.
|
||||||
: type_(t), expr_(e)
|
PEEvent(NetNEvent::Type t, PExpr*e);
|
||||||
{ }
|
// Use this to create named events.
|
||||||
|
PEEvent(const string&n);
|
||||||
|
|
||||||
NetNEvent::Type type() const { return type_; }
|
~PEEvent();
|
||||||
PExpr* expr() const { return expr_; }
|
|
||||||
|
NetNEvent::Type type() const;
|
||||||
|
PExpr* expr() const;
|
||||||
|
string name() const;
|
||||||
|
|
||||||
virtual void dump(ostream&) const;
|
virtual void dump(ostream&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NetNEvent::Type type_;
|
NetNEvent::Type type_;
|
||||||
PExpr*expr_;
|
PExpr*expr_;
|
||||||
|
string name_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PEIdent : public PExpr {
|
class PEIdent : public PExpr {
|
||||||
|
|
@ -341,6 +353,9 @@ class PECallFunction : public PExpr {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: PExpr.h,v $
|
* $Log: PExpr.h,v $
|
||||||
|
* Revision 1.33 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.32 2000/03/12 18:22:11 steve
|
* Revision 1.32 2000/03/12 18:22:11 steve
|
||||||
* Binary and unary operators in parameter expressions.
|
* Binary and unary operators in parameter expressions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
31
Statement.cc
31
Statement.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: Statement.cc,v 1.17 2000/02/23 02:56:54 steve Exp $"
|
#ident "$Id: Statement.cc,v 1.18 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "Statement.h"
|
# include "Statement.h"
|
||||||
|
|
@ -129,6 +129,23 @@ PCondit::~PCondit()
|
||||||
delete else_;
|
delete else_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PEventStatement::PEventStatement(const svector<PEEvent*>&ee)
|
||||||
|
: expr_(ee), statement_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PEventStatement::PEventStatement(PEEvent*ee)
|
||||||
|
: expr_(1), statement_(0)
|
||||||
|
{
|
||||||
|
expr_[0] = ee;
|
||||||
|
}
|
||||||
|
|
||||||
|
PEventStatement::~PEventStatement()
|
||||||
|
{
|
||||||
|
// delete the events and the statement?
|
||||||
|
}
|
||||||
|
|
||||||
PForever::PForever(Statement*s)
|
PForever::PForever(Statement*s)
|
||||||
: statement_(s)
|
: statement_(s)
|
||||||
{
|
{
|
||||||
|
|
@ -155,6 +172,15 @@ PRepeat::~PRepeat()
|
||||||
delete statement_;
|
delete statement_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PTrigger::PTrigger(const string&e)
|
||||||
|
: event_(e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PTrigger::~PTrigger()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
PWhile::~PWhile()
|
PWhile::~PWhile()
|
||||||
{
|
{
|
||||||
delete cond_;
|
delete cond_;
|
||||||
|
|
@ -163,6 +189,9 @@ PWhile::~PWhile()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: Statement.cc,v $
|
* $Log: Statement.cc,v $
|
||||||
|
* Revision 1.18 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.17 2000/02/23 02:56:54 steve
|
* Revision 1.17 2000/02/23 02:56:54 steve
|
||||||
* Macintosh compilers do not support ident.
|
* Macintosh compilers do not support ident.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
36
Statement.h
36
Statement.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: Statement.h,v 1.22 2000/03/11 03:25:51 steve Exp $"
|
#ident "$Id: Statement.h,v 1.23 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
@ -258,15 +258,21 @@ class PDelayStatement : public Statement {
|
||||||
Statement*statement_;
|
Statement*statement_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The event statement represents the event delay in behavioral
|
||||||
|
* code. It comes from such things as:
|
||||||
|
*
|
||||||
|
* @name <statement>;
|
||||||
|
* @(expr) <statement>;
|
||||||
|
*/
|
||||||
class PEventStatement : public Statement {
|
class PEventStatement : public Statement {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PEventStatement(const svector<PEEvent*>&ee)
|
explicit PEventStatement(const svector<PEEvent*>&ee);
|
||||||
: expr_(ee), statement_(0) { }
|
explicit PEventStatement(PEEvent*ee);
|
||||||
|
|
||||||
PEventStatement(PEEvent*ee)
|
~PEventStatement();
|
||||||
: expr_(1), statement_(0) { expr_[0] = ee; }
|
|
||||||
|
|
||||||
void set_statement(Statement*st) { statement_ = st; }
|
void set_statement(Statement*st) { statement_ = st; }
|
||||||
|
|
||||||
|
|
@ -341,6 +347,23 @@ class PRepeat : public Statement {
|
||||||
Statement*statement_;
|
Statement*statement_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The PTrigger statement sends a trigger to a named event. Take the
|
||||||
|
* name here.
|
||||||
|
*/
|
||||||
|
class PTrigger : public Statement {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PTrigger(const string&ev);
|
||||||
|
~PTrigger();
|
||||||
|
|
||||||
|
virtual NetProc* elaborate(Design*des, const string&path) const;
|
||||||
|
virtual void dump(ostream&out, unsigned ind) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string event_;
|
||||||
|
};
|
||||||
|
|
||||||
class PWhile : public Statement {
|
class PWhile : public Statement {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -359,6 +382,9 @@ class PWhile : public Statement {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: Statement.h,v $
|
* $Log: Statement.h,v $
|
||||||
|
* Revision 1.23 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.22 2000/03/11 03:25:51 steve
|
* Revision 1.22 2000/03/11 03:25:51 steve
|
||||||
* Locate scopes in statements.
|
* Locate scopes in statements.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
13
elaborate.cc
13
elaborate.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: elaborate.cc,v 1.151 2000/03/29 04:37:11 steve Exp $"
|
#ident "$Id: elaborate.cc,v 1.152 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1828,6 +1828,14 @@ void PTask::elaborate_2(Design*des, const string&path) const
|
||||||
def->set_proc(st);
|
def->set_proc(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NetProc* PTrigger::elaborate(Design*des, const string&path) const
|
||||||
|
{
|
||||||
|
cerr << get_line() << ": sorry: named event trigger not supported."
|
||||||
|
<< endl;
|
||||||
|
des->errors += 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The while loop is fairly directly represented in the netlist.
|
* The while loop is fairly directly represented in the netlist.
|
||||||
*/
|
*/
|
||||||
|
|
@ -2003,6 +2011,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elaborate.cc,v $
|
* $Log: elaborate.cc,v $
|
||||||
|
* Revision 1.152 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.151 2000/03/29 04:37:11 steve
|
* Revision 1.151 2000/03/29 04:37:11 steve
|
||||||
* New and improved combinational primitives.
|
* New and improved combinational primitives.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
20
parse.y
20
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.86 2000/03/12 17:09:41 steve Exp $"
|
#ident "$Id: parse.y,v 1.87 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -388,8 +388,14 @@ dr_strength1 : K_supply1 | K_strong1 | K_pull1 | K_weak1 ;
|
||||||
|
|
||||||
event_control
|
event_control
|
||||||
: '@' IDENTIFIER
|
: '@' IDENTIFIER
|
||||||
{ yyerror(@1, "sorry: event control not supported.");
|
{ PEEvent*tmpe = new PEEvent($2);
|
||||||
$$ = 0;
|
tmpe->set_file(@2.text);
|
||||||
|
tmpe->set_lineno(@2.first_line);
|
||||||
|
delete[]$2;
|
||||||
|
PEventStatement*tmps = new PEventStatement(tmpe);
|
||||||
|
tmps->set_file(@1.text);
|
||||||
|
tmps->set_lineno(@1.first_line);
|
||||||
|
$$ = tmps;
|
||||||
}
|
}
|
||||||
| '@' '(' event_expression_list ')'
|
| '@' '(' event_expression_list ')'
|
||||||
{ PEventStatement*tmp = new PEventStatement(*$3);
|
{ PEventStatement*tmp = new PEventStatement(*$3);
|
||||||
|
|
@ -1093,7 +1099,7 @@ module_item
|
||||||
| block_item_decl
|
| block_item_decl
|
||||||
| K_defparam defparam_assign_list ';'
|
| K_defparam defparam_assign_list ';'
|
||||||
| K_event list_of_variables ';'
|
| K_event list_of_variables ';'
|
||||||
{ yyerror(@1, "sorry: named events not supported.");
|
{ pform_make_events($2, @1.text, @1.first_line);
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| K_parameter parameter_assign_list ';'
|
| K_parameter parameter_assign_list ';'
|
||||||
|
|
@ -1642,8 +1648,10 @@ statement
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
| K_TRIGGER IDENTIFIER ';'
|
| K_TRIGGER IDENTIFIER ';'
|
||||||
{ yyerror(@1, "sorry: event trigger not supported.");
|
{ PTrigger*tmp = new PTrigger($2);
|
||||||
$$ = 0;
|
tmp->set_file(@2.text);
|
||||||
|
tmp->set_lineno(@2.first_line);
|
||||||
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| K_forever statement
|
| K_forever statement
|
||||||
{ PForever*tmp = new PForever($2);
|
{ PForever*tmp = new PForever($2);
|
||||||
|
|
|
||||||
25
pform.cc
25
pform.cc
|
|
@ -17,12 +17,13 @@
|
||||||
* 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: pform.cc,v 1.56 2000/03/12 17:09:41 steve Exp $"
|
#ident "$Id: pform.cc,v 1.57 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "compiler.h"
|
# include "compiler.h"
|
||||||
# include "pform.h"
|
# include "pform.h"
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
# include "PEvent.h"
|
||||||
# include "PUdp.h"
|
# include "PUdp.h"
|
||||||
# include <list>
|
# include <list>
|
||||||
# include <map>
|
# include <map>
|
||||||
|
|
@ -265,6 +266,25 @@ void pform_make_udp(const char*name, list<string>*parms,
|
||||||
delete init_expr;
|
delete init_expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is invoked to make a named event. This is the declaration of
|
||||||
|
* the event, and not necessarily the use of it.
|
||||||
|
*/
|
||||||
|
static void pform_make_event(const string&name, const string&fn, unsigned ln)
|
||||||
|
{
|
||||||
|
PEvent*event = new PEvent(name);
|
||||||
|
event->set_file(fn);
|
||||||
|
event->set_lineno(ln);
|
||||||
|
pform_cur_module->events[name] = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pform_make_events(const list<string>*names, const string&fn, unsigned ln)
|
||||||
|
{
|
||||||
|
list<string>::const_iterator cur;
|
||||||
|
for (cur = names->begin() ; cur != names->end() ; cur++)
|
||||||
|
pform_make_event(*cur, fn, ln);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pform_makegates is called when a list of gates (with the same type)
|
* pform_makegates is called when a list of gates (with the same type)
|
||||||
* are ready to be instantiated. The function runs through the list of
|
* are ready to be instantiated. The function runs through the list of
|
||||||
|
|
@ -833,6 +853,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: pform.cc,v $
|
* $Log: pform.cc,v $
|
||||||
|
* Revision 1.57 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.56 2000/03/12 17:09:41 steve
|
* Revision 1.56 2000/03/12 17:09:41 steve
|
||||||
* Support localparam.
|
* Support localparam.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
8
pform.h
8
pform.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: pform.h,v 1.37 2000/03/12 17:09:41 steve Exp $"
|
#ident "$Id: pform.h,v 1.38 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "netlist.h"
|
# include "netlist.h"
|
||||||
|
|
@ -141,6 +141,9 @@ extern svector<PWire*>* pform_make_udp_input_ports(list<string>*);
|
||||||
|
|
||||||
extern bool pform_expression_is_constant(const PExpr*);
|
extern bool pform_expression_is_constant(const PExpr*);
|
||||||
|
|
||||||
|
extern void pform_make_events(const list<string>*names,
|
||||||
|
const string&file, unsigned lineno);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The makegate function creates a new gate (which need not have a
|
* The makegate function creates a new gate (which need not have a
|
||||||
* name) and connects it to the specified wires.
|
* name) and connects it to the specified wires.
|
||||||
|
|
@ -182,6 +185,9 @@ extern void pform_dump(ostream&out, Module*mod);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: pform.h,v $
|
* $Log: pform.h,v $
|
||||||
|
* Revision 1.38 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.37 2000/03/12 17:09:41 steve
|
* Revision 1.37 2000/03/12 17:09:41 steve
|
||||||
* Support localparam.
|
* Support localparam.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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: pform_dump.cc,v 1.51 2000/03/12 17:09:41 steve Exp $"
|
#ident "$Id: pform_dump.cc,v 1.52 2000/04/01 19:31:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
* module in question.
|
* module in question.
|
||||||
*/
|
*/
|
||||||
# include "pform.h"
|
# include "pform.h"
|
||||||
|
# include "PEvent.h"
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <iomanip>
|
# include <iomanip>
|
||||||
# include <typeinfo>
|
# include <typeinfo>
|
||||||
|
|
@ -80,20 +81,24 @@ void PECallFunction::dump(ostream &out) const
|
||||||
|
|
||||||
void PEEvent::dump(ostream&out) const
|
void PEEvent::dump(ostream&out) const
|
||||||
{
|
{
|
||||||
switch (type_) {
|
if (expr_) {
|
||||||
case NetNEvent::ANYEDGE:
|
switch (type_) {
|
||||||
break;
|
case NetNEvent::ANYEDGE:
|
||||||
case NetNEvent::POSEDGE:
|
break;
|
||||||
out << "posedge ";
|
case NetNEvent::POSEDGE:
|
||||||
break;
|
out << "posedge ";
|
||||||
case NetNEvent::NEGEDGE:
|
break;
|
||||||
out << "negedge ";
|
case NetNEvent::NEGEDGE:
|
||||||
break;
|
out << "negedge ";
|
||||||
case NetNEvent::POSITIVE:
|
break;
|
||||||
out << "positive ";
|
case NetNEvent::POSITIVE:
|
||||||
break;
|
out << "positive ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
out << *expr_;
|
||||||
|
} else {
|
||||||
|
out << "<event " << name_ << ">";
|
||||||
}
|
}
|
||||||
out << *expr_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PENumber::dump(ostream&out) const
|
void PENumber::dump(ostream&out) const
|
||||||
|
|
@ -541,6 +546,10 @@ void PTask::dump(ostream&out, unsigned ind) const
|
||||||
out << setw(ind) << "" << "/* NOOP */" << endl;
|
out << setw(ind) << "" << "/* NOOP */" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PTrigger::dump(ostream&out, unsigned ind) const
|
||||||
|
{
|
||||||
|
out << setw(ind) << "" << "-> " << event_ << ";" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
void PWhile::dump(ostream&out, unsigned ind) const
|
void PWhile::dump(ostream&out, unsigned ind) const
|
||||||
{
|
{
|
||||||
|
|
@ -627,6 +636,13 @@ void Module::dump(ostream&out) const
|
||||||
out << "/* ERROR */;" << endl;
|
out << "/* ERROR */;" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (map<string,PEvent*>::const_iterator cur = events.begin()
|
||||||
|
; cur != events.end() ; cur ++ ) {
|
||||||
|
PEvent*ev = (*cur).second;
|
||||||
|
out << " event " << ev->name() << "; // "
|
||||||
|
<< ev->get_line() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate through and display all the wires.
|
// Iterate through and display all the wires.
|
||||||
for (map<string,PWire*>::const_iterator wire = wires_.begin()
|
for (map<string,PWire*>::const_iterator wire = wires_.begin()
|
||||||
; wire != wires_.end()
|
; wire != wires_.end()
|
||||||
|
|
@ -720,6 +736,9 @@ void PUdp::dump(ostream&out) const
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: pform_dump.cc,v $
|
* $Log: pform_dump.cc,v $
|
||||||
|
* Revision 1.52 2000/04/01 19:31:57 steve
|
||||||
|
* Named events as far as the pform.
|
||||||
|
*
|
||||||
* Revision 1.51 2000/03/12 17:09:41 steve
|
* Revision 1.51 2000/03/12 17:09:41 steve
|
||||||
* Support localparam.
|
* Support localparam.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue