Skip to content

Commit

Permalink
Add support for procedural continuous assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed May 11, 2000
1 parent 4f0b0cb commit 367db72
Show file tree
Hide file tree
Showing 18 changed files with 586 additions and 91 deletions.
4 changes: 2 additions & 2 deletions Makefile.in
Expand Up @@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.52 2000/05/08 05:29:43 steve Exp $"
#ident "$Id: Makefile.in,v 1.53 2000/05/11 23:37:26 steve Exp $"
#
#
SHELL = /bin/sh
Expand Down Expand Up @@ -73,7 +73,7 @@ O = main.o cprop.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
elab_net.o elab_pexpr.o elab_scope.o elab_sig.o emit.o eval.o eval_tree.o \
expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
mangle.o netlist.o \
net_design.o net_event.o net_scope.o net_udp.o nexus_from_link.o \
net_design.o net_event.o net_force.o net_scope.o net_udp.o nexus_from_link.o \
pad_to_width.o \
parse.o parse_misc.o pform.o pform_dump.o \
set_width.o \
Expand Down
26 changes: 25 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.20 2000/04/22 04:20:19 steve Exp $"
#ident "$Id: Statement.cc,v 1.21 2000/05/11 23:37:26 steve Exp $"
#endif

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

PCAssign::PCAssign(PExpr*l, PExpr*r)
: lval_(l), expr_(r)
{
}

PCAssign::~PCAssign()
{
delete lval_;
delete expr_;
}

PCondit::PCondit(PExpr*ex, Statement*i, Statement*e)
: expr_(ex), if_(i), else_(e)
{
Expand All @@ -134,6 +145,16 @@ PCondit::~PCondit()
delete else_;
}

PDeassign::PDeassign(PExpr*l)
: lval_(l)
{
}

PDeassign::~PDeassign()
{
delete lval_;
}


PDelayStatement::PDelayStatement(PExpr*d, Statement*st)
: delay_(d), statement_(st)
Expand Down Expand Up @@ -231,6 +252,9 @@ PWhile::~PWhile()

/*
* $Log: Statement.cc,v $
* Revision 1.21 2000/05/11 23:37:26 steve
* Add support for procedural continuous assignment.
*
* Revision 1.20 2000/04/22 04:20:19 steve
* Add support for force assignment.
*
Expand Down
34 changes: 33 additions & 1 deletion Statement.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: Statement.h,v 1.25 2000/04/22 04:20:19 steve Exp $"
#ident "$Id: Statement.h,v 1.26 2000/05/11 23:37:26 steve Exp $"
#endif

# include <string>
Expand All @@ -31,6 +31,8 @@ class PExpr;
class Statement;
class PEventStatement;
class Design;
class NetCAssign;
class NetDeassign;
class NetScope;

/*
Expand Down Expand Up @@ -222,6 +224,20 @@ class PCase : public Statement {
PCase& operator= (const PCase&);
};

class PCAssign : public Statement {

public:
explicit PCAssign(PExpr*l, PExpr*r);
~PCAssign();

virtual NetCAssign* elaborate(Design*des, const string&path) const;
virtual void dump(ostream&out, unsigned ind) const;

private:
PExpr*lval_;
PExpr*expr_;
};

class PCondit : public Statement {

public:
Expand All @@ -242,6 +258,19 @@ class PCondit : public Statement {
PCondit& operator= (const PCondit&);
};

class PDeassign : public Statement {

public:
explicit PDeassign(PExpr*l);
~PDeassign();

virtual NetDeassign* elaborate(Design*des, const string&path) const;
virtual void dump(ostream&out, unsigned ind) const;

private:
PExpr*lval_;
};

class PDelayStatement : public Statement {

public:
Expand Down Expand Up @@ -408,6 +437,9 @@ class PWhile : public Statement {

/*
* $Log: Statement.h,v $
* Revision 1.26 2000/05/11 23:37:26 steve
* Add support for procedural continuous assignment.
*
* Revision 1.25 2000/04/22 04:20:19 steve
* Add support for force assignment.
*
Expand Down
24 changes: 23 additions & 1 deletion design_dump.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: design_dump.cc,v 1.84 2000/05/07 18:20:07 steve Exp $"
#ident "$Id: design_dump.cc,v 1.85 2000/05/11 23:37:27 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -176,6 +176,13 @@ void NetAddSub::dump_node(ostream&o, unsigned ind) const
dump_obj_attr(o, ind+4);
}

void NetCAssign::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "Procedural continuous assign (NetCAssign): "
<< name() << endl;
dump_node_pins(o, ind+4);
}

void NetCLShift::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "Combinatorial shift (NetCLShift): " <<
Expand Down Expand Up @@ -539,6 +546,12 @@ void NetCase::dump(ostream&o, unsigned ind) const
o << setw(ind) << "" << "endcase" << endl;
}

void NetCAssign::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "cassign " << lval_->name() << " = "
<< name() << ";" << endl;
}

void NetCondit::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "if (";
Expand All @@ -554,6 +567,12 @@ void NetCondit::dump(ostream&o, unsigned ind) const
}
}

void NetDeassign::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "deassign " << lval_->name() << "; "
<< "/* " << get_line() << " */" << endl;
}

void NetEvProbe::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "";
Expand Down Expand Up @@ -960,6 +979,9 @@ void Design::dump(ostream&o) const

/*
* $Log: design_dump.cc,v $
* Revision 1.85 2000/05/11 23:37:27 steve
* Add support for procedural continuous assignment.
*
* Revision 1.84 2000/05/07 18:20:07 steve
* Import MCD support from Stephen Tell, and add
* system function parameter support to the IVL core.
Expand Down
45 changes: 44 additions & 1 deletion elaborate.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: elaborate.cc,v 1.171 2000/05/08 05:28:29 steve Exp $"
#ident "$Id: elaborate.cc,v 1.172 2000/05/11 23:37:27 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -1527,6 +1527,46 @@ NetProc* PCallTask::elaborate_usr(Design*des, const string&path) const
return block;
}

NetCAssign* PCAssign::elaborate(Design*des, const string&path) const
{
NetScope*scope = des->find_scope(path);
assert(scope);

NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0);
if (lval == 0)
return 0;

NetNet*rval = expr_->elaborate_net(des, path, lval->pin_count(),
0, 0, 0);
if (rval == 0)
return 0;

if (rval->pin_count() < lval->pin_count())
rval = pad_to_width(des, path, rval, lval->pin_count());

NetCAssign* dev = new NetCAssign(des->local_symbol(path), lval);
des->add_node(dev);

for (unsigned idx = 0 ; idx < dev->pin_count() ; idx += 1)
connect(dev->pin(idx), rval->pin(idx));

return dev;
}

NetDeassign* PDeassign::elaborate(Design*des, const string&path) const
{
NetScope*scope = des->find_scope(path);
assert(scope);

NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0);
if (lval == 0)
return 0;

NetDeassign*dev = new NetDeassign(lval);
dev->set_line( *this );
return dev;
}

NetProc* PDelayStatement::elaborate(Design*des, const string&path) const
{
verinum*num = delay_->eval_const(des, path);
Expand Down Expand Up @@ -2382,6 +2422,9 @@ Design* elaborate(const map<string,Module*>&modules,

/*
* $Log: elaborate.cc,v $
* Revision 1.172 2000/05/11 23:37:27 steve
* Add support for procedural continuous assignment.
*
* Revision 1.171 2000/05/08 05:28:29 steve
* Use bufz to make assignments directional.
*
Expand Down
20 changes: 19 additions & 1 deletion emit.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: emit.cc,v 1.44 2000/05/04 03:37:58 steve Exp $"
#ident "$Id: emit.cc,v 1.45 2000/05/11 23:37:27 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -70,6 +70,11 @@ void NetCaseCmp::emit_node(ostream&o, struct target_t*tgt) const
tgt->net_case_cmp(o, this);
}

void NetCAssign::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->net_cassign(o, this);
}

void NetCLShift::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->lpm_clshift(o, this);
Expand Down Expand Up @@ -166,12 +171,22 @@ bool NetCase::emit_proc(ostream&o, struct target_t*tgt) const
return true;
}

bool NetCAssign::emit_proc(ostream&o, struct target_t*tgt) const
{
return tgt->proc_cassign(o, this);
}

bool NetCondit::emit_proc(ostream&o, struct target_t*tgt) const
{
tgt->proc_condit(o, this);
return true;
}

bool NetDeassign::emit_proc(ostream&o, struct target_t*tgt) const
{
return tgt->proc_deassign(o, this);
}

bool NetForce::emit_proc(ostream&o, struct target_t*tgt) const
{
return tgt->proc_force(o, this);
Expand Down Expand Up @@ -434,6 +449,9 @@ bool emit(ostream&o, const Design*des, const char*type)

/*
* $Log: emit.cc,v $
* Revision 1.45 2000/05/11 23:37:27 steve
* Add support for procedural continuous assignment.
*
* Revision 1.44 2000/05/04 03:37:58 steve
* Add infrastructure for system functions, move
* $time to that structure and add $random.
Expand Down

0 comments on commit 367db72

Please sign in to comment.