Add support for conbinational events by finding
the inputs to expressions and some statements. Get case and assignment statements working.
This commit is contained in:
parent
eb708c1540
commit
b094bbdcf4
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.118 2002/04/07 00:50:13 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.119 2002/04/21 04:59:07 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -130,7 +130,7 @@ elab_sig.o emit.o eval.o eval_rconst.o \
|
|||
eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
|
||||
load_module.o mangle.o netlist.o netmisc.o net_assign.o \
|
||||
net_design.o net_event.o net_expr.o net_force.o net_func.o \
|
||||
net_link.o net_modulo.o \
|
||||
net_link.o net_modulo.o net_nex_input.o \
|
||||
net_proc.o net_scope.o net_udp.o pad_to_width.o \
|
||||
parse.o parse_misc.o pform.o pform_dump.o \
|
||||
set_width.o \
|
||||
|
|
|
|||
13
Statement.cc
13
Statement.cc
|
|
@ -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.25 2001/12/03 04:47:14 steve Exp $"
|
||||
#ident "$Id: Statement.cc,v 1.26 2002/04/21 04:59:07 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -188,6 +188,7 @@ PDisable::~PDisable()
|
|||
PEventStatement::PEventStatement(const svector<PEEvent*>&ee)
|
||||
: expr_(ee), statement_(0)
|
||||
{
|
||||
assert(expr_.count() > 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -197,6 +198,11 @@ PEventStatement::PEventStatement(PEEvent*ee)
|
|||
expr_[0] = ee;
|
||||
}
|
||||
|
||||
PEventStatement::PEventStatement(void)
|
||||
: statement_(0)
|
||||
{
|
||||
}
|
||||
|
||||
PEventStatement::~PEventStatement()
|
||||
{
|
||||
// delete the events and the statement?
|
||||
|
|
@ -287,6 +293,11 @@ PWhile::~PWhile()
|
|||
|
||||
/*
|
||||
* $Log: Statement.cc,v $
|
||||
* Revision 1.26 2002/04/21 04:59:07 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.25 2001/12/03 04:47:14 steve
|
||||
* Parser and pform use hierarchical names as hname_t
|
||||
* objects instead of encoded strings.
|
||||
|
|
|
|||
10
Statement.h
10
Statement.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: Statement.h,v 1.31 2001/12/03 04:47:14 steve Exp $"
|
||||
#ident "$Id: Statement.h,v 1.32 2002/04/21 04:59:07 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <string>
|
||||
|
|
@ -308,6 +308,7 @@ class PDisable : public Statement {
|
|||
*
|
||||
* @name <statement>;
|
||||
* @(expr) <statement>;
|
||||
* @* <statement>;
|
||||
*/
|
||||
class PEventStatement : public Statement {
|
||||
|
||||
|
|
@ -315,6 +316,8 @@ class PEventStatement : public Statement {
|
|||
|
||||
explicit PEventStatement(const svector<PEEvent*>&ee);
|
||||
explicit PEventStatement(PEEvent*ee);
|
||||
// Make an @* statement.
|
||||
explicit PEventStatement(void);
|
||||
|
||||
~PEventStatement();
|
||||
|
||||
|
|
@ -450,6 +453,11 @@ class PWhile : public Statement {
|
|||
|
||||
/*
|
||||
* $Log: Statement.h,v $
|
||||
* Revision 1.32 2002/04/21 04:59:07 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.31 2001/12/03 04:47:14 steve
|
||||
* Parser and pform use hierarchical names as hname_t
|
||||
* objects instead of encoded strings.
|
||||
|
|
|
|||
40
elaborate.cc
40
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elaborate.cc,v 1.242 2002/04/13 02:33:17 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.243 2002/04/21 04:59:07 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1843,7 +1843,38 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
|
|||
NetEvWait*wa = new NetEvWait(enet);
|
||||
wa->set_line(*this);
|
||||
|
||||
for (unsigned idx = 0 ; idx < expr_.count() ; idx += 1) {
|
||||
/* If there are no expressions, this is a signal that it is an
|
||||
@* statement. Generate an expression to use. */
|
||||
|
||||
if (expr_.count() == 0) {
|
||||
assert(enet);
|
||||
NexusSet*nset = enet->nex_input();
|
||||
if (nset == 0) {
|
||||
cerr << get_line() << ": internal error: No NexusSet"
|
||||
<< " from statement." << endl;
|
||||
enet->dump(cerr, 6);
|
||||
des->errors += 1;
|
||||
return enet;
|
||||
}
|
||||
|
||||
if (nset->count() == 0) {
|
||||
cerr << get_line() << ": warning: No inputs to statement."
|
||||
<< " Ignoring @*." << endl;
|
||||
return enet;
|
||||
}
|
||||
|
||||
NetEvProbe*pr = new NetEvProbe(scope, scope->local_hsymbol(),
|
||||
ev, NetEvProbe::ANYEDGE,
|
||||
nset->count());
|
||||
for (unsigned idx = 0 ; idx < nset->count() ; idx += 1)
|
||||
connect(nset[0][idx], pr->pin(idx));
|
||||
|
||||
delete nset;
|
||||
des->add_node(pr);
|
||||
|
||||
expr_count = 1;
|
||||
|
||||
} else for (unsigned idx = 0 ; idx < expr_.count() ; idx += 1) {
|
||||
|
||||
assert(expr_[idx]->expr());
|
||||
|
||||
|
|
@ -2423,6 +2454,11 @@ Design* elaborate(list<const char*>roots)
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.243 2002/04/21 04:59:07 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.242 2002/04/13 02:33:17 steve
|
||||
* Detect missing indices to memories (PR#421)
|
||||
*
|
||||
|
|
|
|||
98
net_link.cc
98
net_link.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: net_link.cc,v 1.5 2001/07/25 03:10:49 steve Exp $"
|
||||
#ident "$Id: net_link.cc,v 1.6 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -28,6 +28,28 @@
|
|||
# include <strstream>
|
||||
# include <string>
|
||||
# include <typeinfo>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
void connect(Nexus*l, Link&r)
|
||||
{
|
||||
assert(l);
|
||||
assert(r.nexus_);
|
||||
|
||||
if (l == r.nexus_)
|
||||
return;
|
||||
|
||||
|
||||
Nexus*tmp = r.nexus_;
|
||||
while (Link*cur = tmp->first_nlink()) {
|
||||
tmp->unlink(cur);
|
||||
l->relink(cur);
|
||||
}
|
||||
|
||||
assert(tmp->list_ == 0);
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
void connect(Link&l, Link&r)
|
||||
{
|
||||
|
|
@ -352,8 +374,82 @@ const char* Nexus::name() const
|
|||
return name_;
|
||||
}
|
||||
|
||||
|
||||
NexusSet::NexusSet()
|
||||
{
|
||||
items_ = 0;
|
||||
nitems_ = 0;
|
||||
}
|
||||
|
||||
NexusSet::~NexusSet()
|
||||
{
|
||||
if (nitems_ > 0) {
|
||||
assert(items_ != 0);
|
||||
delete[] items_;
|
||||
} else {
|
||||
assert(items_ == 0);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned NexusSet::count() const
|
||||
{
|
||||
return nitems_;
|
||||
}
|
||||
|
||||
void NexusSet::add(Nexus*that)
|
||||
{
|
||||
if (nitems_ == 0) {
|
||||
assert(items_ == 0);
|
||||
items_ = (Nexus**)malloc(sizeof(Nexus*));
|
||||
items_[0] = that;
|
||||
nitems_ = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned ptr = bsearch_(that);
|
||||
if ((ptr < nitems_) && (items_[ptr] == that))
|
||||
return;
|
||||
|
||||
items_ = (Nexus**)realloc(items_, (nitems_+1) * sizeof(Nexus*));
|
||||
for (unsigned idx = nitems_ ; idx > ptr ; idx -= 1)
|
||||
items_[idx] = items_[idx-1];
|
||||
|
||||
items_[ptr] = that;
|
||||
nitems_ += 1;
|
||||
}
|
||||
|
||||
void NexusSet::add(const NexusSet&that)
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < that.nitems_ ; idx += 1)
|
||||
add(that.items_[idx]);
|
||||
}
|
||||
|
||||
Nexus* NexusSet::operator[] (unsigned idx)
|
||||
{
|
||||
assert(idx < nitems_);
|
||||
return items_[idx];
|
||||
}
|
||||
|
||||
unsigned NexusSet::bsearch_(Nexus*that)
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
||||
if (items_[idx] < that)
|
||||
continue;
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
return nitems_;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: net_link.cc,v $
|
||||
* Revision 1.6 2002/04/21 04:59:08 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.5 2001/07/25 03:10:49 steve
|
||||
* Create a config.h.in file to hold all the config
|
||||
* junk, and support gcc 3.0. (Stephan Boettcher)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* Copyright (c) 2002 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)
|
||||
#ident "$Id: net_nex_input.cc,v 1.1 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
||||
# include <iostream>
|
||||
|
||||
# include <cassert>
|
||||
# include <typeinfo>
|
||||
# include "netlist.h"
|
||||
# include "netmisc.h"
|
||||
|
||||
NexusSet* NetExpr::nex_input()
|
||||
{
|
||||
cerr << get_line()
|
||||
<< ": internal error: nex_input not implemented: "
|
||||
<< *this << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NexusSet* NetProc::nex_input()
|
||||
{
|
||||
cerr << get_line()
|
||||
<< ": internal error: NetProc::nex_input not implemented"
|
||||
<< endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NexusSet* NetEBinary::nex_input()
|
||||
{
|
||||
NexusSet*result = left_->nex_input();
|
||||
NexusSet*tmp = right_->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetEBitSel::nex_input()
|
||||
{
|
||||
NexusSet*result = sig_->nex_input();
|
||||
NexusSet*tmp = idx_->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetEConcat::nex_input()
|
||||
{
|
||||
NexusSet*result = parms_[0]->nex_input();
|
||||
for (unsigned idx = 1 ; idx < parms_.count() ; idx += 1) {
|
||||
NexusSet*tmp = parms_[idx]->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* A constant has not inputs, so always return an empty set.
|
||||
*/
|
||||
NexusSet* NetEConst::nex_input()
|
||||
{
|
||||
return new NexusSet;
|
||||
}
|
||||
|
||||
NexusSet* NetEMemory::nex_input()
|
||||
{
|
||||
NexusSet*result = idx_->nex_input();
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* A parameter by definition has no inputs. It represents a constant
|
||||
* value, even if that value is a constant expression.
|
||||
*/
|
||||
NexusSet* NetEParam::nex_input()
|
||||
{
|
||||
return new NexusSet;
|
||||
}
|
||||
|
||||
NexusSet* NetEScope::nex_input()
|
||||
{
|
||||
return new NexusSet;
|
||||
}
|
||||
|
||||
NexusSet* NetESelect::nex_input()
|
||||
{
|
||||
NexusSet*result = base_->nex_input();
|
||||
NexusSet*tmp = expr_->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetESFunc::nex_input()
|
||||
{
|
||||
if (nparms_ == 0)
|
||||
return new NexusSet;
|
||||
|
||||
NexusSet*result = parms_[0]->nex_input();
|
||||
for (unsigned idx = 1 ; idx < nparms_ ; idx += 1) {
|
||||
NexusSet*tmp = parms_[idx]->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetESignal::nex_input()
|
||||
{
|
||||
NexusSet*result = new NexusSet;
|
||||
for (unsigned idx = 0 ; idx < net_->pin_count() ; idx += 1)
|
||||
result->add(net_->pin(idx).nexus());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetETernary::nex_input()
|
||||
{
|
||||
NexusSet*tmp;
|
||||
NexusSet*result = cond_->nex_input();
|
||||
|
||||
tmp = true_val_->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
|
||||
tmp = false_val_->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetEUFunc::nex_input()
|
||||
{
|
||||
NexusSet*result = new NexusSet;
|
||||
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) {
|
||||
NexusSet*tmp = parms_[idx]->nex_input();
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NexusSet* NetEUnary::nex_input()
|
||||
{
|
||||
return expr_->nex_input();
|
||||
}
|
||||
|
||||
NexusSet* NetAssign::nex_input()
|
||||
{
|
||||
NexusSet*result = rval()->nex_input();
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* The inputs to a case statement are the inputs to the expression,
|
||||
* the inputs to all the guards, and the inputs to all the guarded
|
||||
* statements.
|
||||
*/
|
||||
NexusSet* NetCase::nex_input()
|
||||
{
|
||||
NexusSet*result = expr_->nex_input();
|
||||
if (result == 0)
|
||||
return 0;
|
||||
|
||||
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
||||
|
||||
assert(items_[idx].statement);
|
||||
NexusSet*tmp = items_[idx].statement->nex_input();
|
||||
assert(tmp);
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
|
||||
assert(items_[idx].guard);
|
||||
tmp = items_[idx].guard->nex_input();
|
||||
assert(tmp);
|
||||
result->add(*tmp);
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: net_nex_input.cc,v $
|
||||
* Revision 1.1 2002/04/21 04:59:08 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
*/
|
||||
|
||||
43
net_proc.cc
43
net_proc.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2000-2002 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
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: net_proc.cc,v 1.3 2001/07/25 03:10:49 steve Exp $"
|
||||
#ident "$Id: net_proc.cc,v 1.4 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -25,6 +25,40 @@
|
|||
# include "netlist.h"
|
||||
# include <assert.h>
|
||||
|
||||
NetCase::NetCase(NetCase::TYPE c, NetExpr*ex, unsigned cnt)
|
||||
: type_(c), expr_(ex), nitems_(cnt)
|
||||
{
|
||||
assert(expr_);
|
||||
items_ = new Item[nitems_];
|
||||
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
||||
items_[idx].statement = 0;
|
||||
}
|
||||
}
|
||||
|
||||
NetCase::~NetCase()
|
||||
{
|
||||
delete expr_;
|
||||
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
||||
delete items_[idx].guard;
|
||||
if (items_[idx].statement) delete items_[idx].statement;
|
||||
}
|
||||
delete[]items_;
|
||||
}
|
||||
|
||||
NetCase::TYPE NetCase::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void NetCase::set_case(unsigned idx, NetExpr*e, NetProc*p)
|
||||
{
|
||||
assert(idx < nitems_);
|
||||
items_[idx].guard = e;
|
||||
items_[idx].statement = p;
|
||||
if (items_[idx].guard)
|
||||
items_[idx].guard->set_width(expr_->expr_width());
|
||||
}
|
||||
|
||||
NetDisable::NetDisable(NetScope*tgt)
|
||||
: target_(tgt)
|
||||
{
|
||||
|
|
@ -95,6 +129,11 @@ const NetExpr* NetRepeat::expr() const
|
|||
|
||||
/*
|
||||
* $Log: net_proc.cc,v $
|
||||
* Revision 1.4 2002/04/21 04:59:08 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.3 2001/07/25 03:10:49 steve
|
||||
* Create a config.h.in file to hold all the config
|
||||
* junk, and support gcc 3.0. (Stephan Boettcher)
|
||||
|
|
|
|||
41
netlist.cc
41
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.cc,v 1.183 2002/04/14 19:02:34 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.184 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1537,40 +1537,6 @@ NetBUFZ::~NetBUFZ()
|
|||
}
|
||||
|
||||
|
||||
NetCase::NetCase(NetCase::TYPE c, NetExpr*ex, unsigned cnt)
|
||||
: type_(c), expr_(ex), nitems_(cnt)
|
||||
{
|
||||
assert(expr_);
|
||||
items_ = new Item[nitems_];
|
||||
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
||||
items_[idx].statement = 0;
|
||||
}
|
||||
}
|
||||
|
||||
NetCase::~NetCase()
|
||||
{
|
||||
delete expr_;
|
||||
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
||||
delete items_[idx].guard;
|
||||
if (items_[idx].statement) delete items_[idx].statement;
|
||||
}
|
||||
delete[]items_;
|
||||
}
|
||||
|
||||
NetCase::TYPE NetCase::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void NetCase::set_case(unsigned idx, NetExpr*e, NetProc*p)
|
||||
{
|
||||
assert(idx < nitems_);
|
||||
items_[idx].guard = e;
|
||||
items_[idx].statement = p;
|
||||
if (items_[idx].guard)
|
||||
items_[idx].guard->set_width(expr_->expr_width());
|
||||
}
|
||||
|
||||
NetCaseCmp::NetCaseCmp(NetScope*s, const string&n)
|
||||
: NetNode(s, n, 3)
|
||||
{
|
||||
|
|
@ -2428,6 +2394,11 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.184 2002/04/21 04:59:08 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.183 2002/04/14 19:02:34 steve
|
||||
* Ternary expressions can be signed.
|
||||
*
|
||||
|
|
|
|||
57
netlist.h
57
netlist.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.h,v 1.232 2002/03/09 02:10:22 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.233 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -134,6 +134,7 @@ class NetObj {
|
|||
class Link {
|
||||
|
||||
friend void connect(Link&, Link&);
|
||||
friend void connect(Nexus*, Link&);
|
||||
friend class NetObj;
|
||||
friend class Nexus;
|
||||
|
||||
|
|
@ -246,6 +247,7 @@ class Link {
|
|||
class Nexus {
|
||||
|
||||
friend void connect(Link&, Link&);
|
||||
friend void connect(Nexus*, Link&);
|
||||
friend class Link;
|
||||
|
||||
public:
|
||||
|
|
@ -274,6 +276,29 @@ class Nexus {
|
|||
Nexus& operator= (const Nexus&);
|
||||
};
|
||||
|
||||
class NexusSet {
|
||||
|
||||
public:
|
||||
~NexusSet();
|
||||
NexusSet();
|
||||
|
||||
unsigned count() const;
|
||||
|
||||
void add(Nexus*that);
|
||||
void add(const NexusSet&that);
|
||||
|
||||
Nexus* operator[] (unsigned idx);
|
||||
|
||||
private:
|
||||
Nexus**items_;
|
||||
unsigned nitems_;
|
||||
|
||||
unsigned bsearch_(Nexus*that);
|
||||
|
||||
private: // not implemented
|
||||
NexusSet(const NexusSet&);
|
||||
NexusSet& operator= (const NexusSet&);
|
||||
};
|
||||
|
||||
/*
|
||||
* A NetNode is a device of some sort, where each pin has a different
|
||||
|
|
@ -895,6 +920,11 @@ class NetExpr : public LineInfo {
|
|||
// any. This is a deep copy operation.
|
||||
virtual NetExpr*dup_expr() const =0;
|
||||
|
||||
// Get the Nexus that are the input to this
|
||||
// expression. Normally this descends down to the reference to
|
||||
// a signal that reads from its input.
|
||||
virtual NexusSet* nex_input() =0;
|
||||
|
||||
// Return a version of myself that is structural. This is used
|
||||
// for converting expressions to gates.
|
||||
virtual NetNet*synthesize(Design*);
|
||||
|
|
@ -934,6 +964,7 @@ class NetEConst : public NetExpr {
|
|||
|
||||
virtual NetEConst* dup_expr() const;
|
||||
virtual NetNet*synthesize(Design*);
|
||||
virtual NexusSet* nex_input();
|
||||
|
||||
private:
|
||||
verinum value_;
|
||||
|
|
@ -1139,6 +1170,11 @@ class NetProc : public LineInfo {
|
|||
explicit NetProc();
|
||||
virtual ~NetProc();
|
||||
|
||||
// Find the Nexa that are input by the statement. This is used
|
||||
// for example by @* to find the inputs to the process for the
|
||||
// sensitivity list.
|
||||
virtual NexusSet* nex_input();
|
||||
|
||||
// This method is called to emit the statement to the
|
||||
// target. The target returns true if OK, false for errors.
|
||||
virtual bool emit_proc(struct target_t*) const;
|
||||
|
|
@ -1263,6 +1299,7 @@ class NetAssign : public NetAssignBase {
|
|||
explicit NetAssign(NetAssign_*lv, NetExpr*rv);
|
||||
~NetAssign();
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool emit_proc(struct target_t*) const;
|
||||
virtual int match_proc(struct proc_match_t*);
|
||||
virtual void dump(ostream&, unsigned ind) const;
|
||||
|
|
@ -1411,6 +1448,7 @@ class NetCase : public NetProc {
|
|||
const NetExpr*expr(unsigned idx) const { return items_[idx].guard;}
|
||||
const NetProc*stat(unsigned idx) const { return items_[idx].statement; }
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool emit_proc(struct target_t*) const;
|
||||
virtual void dump(ostream&, unsigned ind) const;
|
||||
|
||||
|
|
@ -1960,6 +1998,7 @@ class NetEUFunc : public NetExpr {
|
|||
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual NetEUFunc*dup_expr() const;
|
||||
virtual NexusSet* nex_input();
|
||||
|
||||
private:
|
||||
NetScope*func_;
|
||||
|
|
@ -2096,6 +2135,7 @@ class NetEBinary : public NetExpr {
|
|||
virtual bool has_width() const;
|
||||
|
||||
virtual NetEBinary* dup_expr() const;
|
||||
virtual NexusSet* nex_input();
|
||||
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
|
@ -2295,6 +2335,7 @@ class NetEConcat : public NetExpr {
|
|||
unsigned nparms() const { return parms_.count() ; }
|
||||
NetExpr* parm(unsigned idx) const { return parms_[idx]; }
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool set_width(unsigned w);
|
||||
virtual NetEConcat* dup_expr() const;
|
||||
virtual NetEConst* eval_tree();
|
||||
|
|
@ -2322,6 +2363,7 @@ class NetEParam : public NetExpr {
|
|||
NetEParam(class Design*des, NetScope*scope, const hname_t&name);
|
||||
~NetEParam();
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool set_width(unsigned w);
|
||||
virtual bool has_width() const;
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
|
|
@ -2353,6 +2395,7 @@ class NetESelect : public NetExpr {
|
|||
const NetExpr*sub_expr() const;
|
||||
const NetExpr*select() const;
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool set_width(unsigned w);
|
||||
virtual bool has_width() const;
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
|
|
@ -2378,6 +2421,7 @@ class NetEScope : public NetExpr {
|
|||
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual NetEScope* dup_expr() const;
|
||||
virtual NexusSet* nex_input();
|
||||
|
||||
virtual void dump(ostream&os) const;
|
||||
|
||||
|
|
@ -2403,6 +2447,7 @@ class NetESFunc : public NetExpr {
|
|||
NetExpr* parm(unsigned idx);
|
||||
const NetExpr* parm(unsigned idx) const;
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool set_width(unsigned);
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
|
|
@ -2439,6 +2484,7 @@ class NetETernary : public NetExpr {
|
|||
virtual NetETernary* dup_expr() const;
|
||||
virtual NetExpr* eval_tree();
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
virtual NetNet*synthesize(Design*);
|
||||
|
|
@ -2478,6 +2524,7 @@ class NetEUnary : public NetExpr {
|
|||
virtual NetEUnary* dup_expr() const;
|
||||
virtual NetEConst* eval_tree();
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
|
|
@ -2530,6 +2577,7 @@ class NetEMemory : public NetExpr {
|
|||
NetExpr* eval_tree();
|
||||
virtual NetEMemory*dup_expr() const;
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
|
|
@ -2563,6 +2611,7 @@ class NetESignal : public NetExpr {
|
|||
|
||||
virtual NetESignal* dup_expr() const;
|
||||
NetNet* synthesize(Design*des);
|
||||
NexusSet* nex_input();
|
||||
|
||||
// These methods actually reference the properties of the
|
||||
// NetNet object that I point to.
|
||||
|
|
@ -2605,6 +2654,7 @@ class NetEBitSel : public NetExpr {
|
|||
|
||||
NetEBitSel* dup_expr() const;
|
||||
|
||||
virtual NexusSet* nex_input();
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
|
|
@ -2920,6 +2970,11 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.233 2002/04/21 04:59:08 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.232 2002/03/09 02:10:22 steve
|
||||
* Add the NetUserFunc netlist node.
|
||||
*
|
||||
|
|
|
|||
12
parse.y
12
parse.y
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2002 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
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: parse.y,v 1.147 2002/04/12 02:57:08 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.148 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -2256,9 +2256,11 @@ statement
|
|||
}
|
||||
}
|
||||
| '@' '*' statement_opt
|
||||
{ yyerror(@2, "sorry: Combinational event control "
|
||||
"is not supported yet.");
|
||||
$$ = $3;
|
||||
{ PEventStatement*tmp = new PEventStatement;
|
||||
tmp->set_file(@1.text);
|
||||
tmp->set_lineno(@1.first_line);
|
||||
tmp->set_statement($3);
|
||||
$$ = tmp;
|
||||
}
|
||||
| lpvalue '=' expression ';'
|
||||
{ PAssign*tmp = new PAssign($1,$3);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: pform_dump.cc,v 1.69 2002/01/26 05:28:28 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.70 2002/04/21 04:59:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -555,13 +555,17 @@ void PDisable::dump(ostream&out, unsigned ind) const
|
|||
|
||||
void PEventStatement::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "@(" << *(expr_[0]);
|
||||
if (expr_.count() > 1)
|
||||
for (unsigned idx = 1 ; idx < expr_.count() ; idx += 1)
|
||||
out << " or " << *(expr_[idx]);
|
||||
if (expr_.count() == 0) {
|
||||
out << setw(ind) << "" << "@* ";
|
||||
|
||||
out << ")";
|
||||
} else {
|
||||
out << setw(ind) << "" << "@(" << *(expr_[0]);
|
||||
if (expr_.count() > 1)
|
||||
for (unsigned idx = 1 ; idx < expr_.count() ; idx += 1)
|
||||
out << " or " << *(expr_[idx]);
|
||||
|
||||
out << ")";
|
||||
}
|
||||
|
||||
if (statement_) {
|
||||
out << endl;
|
||||
|
|
@ -820,6 +824,11 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.70 2002/04/21 04:59:08 steve
|
||||
* Add support for conbinational events by finding
|
||||
* the inputs to expressions and some statements.
|
||||
* Get case and assignment statements working.
|
||||
*
|
||||
* Revision 1.69 2002/01/26 05:28:28 steve
|
||||
* Detect scalar/vector declarion mismatch.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue