Add parse and elaboration of non-blocking assignments,

Replace list<PCase::Item*> with an svector version,
 Add integer support.
This commit is contained in:
steve 1999-06-06 20:45:38 +00:00
parent 7addc608a6
commit 7605a7b1f0
13 changed files with 373 additions and 61 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: Statement.cc,v 1.6 1999/05/10 00:16:58 steve Exp $"
#ident "$Id: Statement.cc,v 1.7 1999/06/06 20:45:38 steve Exp $"
#endif
# include "Statement.h"
@ -27,6 +27,18 @@ Statement::~Statement()
{
}
PAssign::~PAssign()
{
delete lval_;
delete expr_;
}
PAssignNB::~PAssignNB()
{
delete lval_;
delete rval_;
}
PBlock::PBlock(BL_TYPE t, const list<Statement*>&st)
: bl_type_(t)
{
@ -52,28 +64,17 @@ PCallTask::PCallTask(const string&n, const svector<PExpr*>&p)
{
}
PCase::PCase(PExpr*ex, list<PCase::Item*>*l)
: expr_(ex)
PCase::PCase(PExpr*ex, svector<PCase::Item*>*l)
: expr_(ex), items_(l)
{
nitems_ = l->size();
items_ = new Item[nitems_];
list<PCase::Item*>::const_iterator cur;
unsigned idx;
for (cur = l->begin(), idx = 0 ; cur != l->end() ; cur ++, idx += 1) {
items_[idx] = *(*cur);
delete (*cur);
}
delete l;
}
PCase::~PCase()
{
delete expr_;
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
if (items_[idx].expr) delete items_[idx].expr;
if (items_[idx].stat) delete items_[idx].stat;
for (unsigned idx = 0 ; idx < items_->count() ; idx += 1) {
if ((*items_)[idx]->expr) delete (*items_)[idx]->expr;
if ((*items_)[idx]->stat) delete (*items_)[idx]->stat;
}
delete[]items_;
@ -99,6 +100,11 @@ PWhile::~PWhile()
/*
* $Log: Statement.cc,v $
* Revision 1.7 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.6 1999/05/10 00:16:58 steve
* Parse and elaborate the concatenate operator
* in structural contexts, Replace vector<PExpr*>

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: Statement.h,v 1.8 1999/05/10 00:16:58 steve Exp $"
#ident "$Id: Statement.h,v 1.9 1999/06/06 20:45:38 steve Exp $"
#endif
# include <string>
@ -82,6 +82,8 @@ class PAssign : public Statement {
explicit PAssign(PExpr*lval, PExpr*ex)
: lval_(lval), expr_(ex) { }
~PAssign();
const PExpr* lval() const { return lval_; }
const PExpr* get_expr() const { return expr_; }
@ -96,6 +98,24 @@ class PAssign : public Statement {
Design*des, const string&path) const;
};
class PAssignNB : public Statement {
public:
explicit PAssignNB(PExpr*lval, PExpr*ex)
: lval_(lval), rval_(ex) { }
~PAssignNB();
const PExpr* lval() const { return lval_; }
const PExpr* rval() const { return rval_; }
virtual void dump(ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, const string&path) const;
private:
PExpr* lval_;
PExpr* rval_;
};
/*
* A block statement is an ordered list of statements that make up the
* block. The block can be sequential or parallel, which only affects
@ -160,7 +180,7 @@ class PCase : public Statement {
Statement*stat;
};
PCase(PExpr*ex, list<Item*>*);
PCase(PExpr*ex, svector<Item*>*);
~PCase();
virtual NetProc* elaborate(Design*des, const string&path) const;
@ -169,8 +189,7 @@ class PCase : public Statement {
private:
PExpr*expr_;
Item*items_;
unsigned nitems_;
svector<Item*>*items_;
private: // not implemented
PCase(const PCase&);
@ -278,6 +297,11 @@ class PWhile : public Statement {
/*
* $Log: Statement.h,v $
* Revision 1.9 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.8 1999/05/10 00:16:58 steve
* Parse and elaborate the concatenate operator
* in structural contexts, Replace vector<PExpr*>

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: design_dump.cc,v 1.26 1999/05/31 15:46:20 steve Exp $"
#ident "$Id: design_dump.cc,v 1.27 1999/06/06 20:45:38 steve Exp $"
#endif
/*
@ -127,6 +127,17 @@ void NetAssign::dump_node(ostream&o, unsigned ind) const
dump_node_pins(o, ind+4);
}
void NetAssignNB::dump_node(ostream&o, unsigned ind) const
{
if (bmux_)
o << setw(ind) << "" << "Procedural NB assign: " << name()
<< "[" << *bmux_ << "] <= " << *rval_ << endl;
else
o << setw(ind) << "" << "Procedural NB assign: " << name()
<< " <= " << *rval_ << endl;
dump_node_pins(o, ind+4);
}
void NetBUFZ::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "BUFZ: " << name() << endl;
@ -300,6 +311,19 @@ void NetAssign::dump(ostream&o, unsigned ind) const
o << ";" << endl;
}
void NetAssignNB::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "";
if (bmux_) {
o << name() << "[" << *bmux_ << "] <= " << *rval_ << ";" <<
endl;
} else {
o << name() << " <= " << *rval_ << ";" << endl;
}
}
void NetAssignMem::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "";
@ -598,6 +622,11 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.27 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.26 1999/05/31 15:46:20 steve
* Compilation warning.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elaborate.cc,v 1.33 1999/06/03 05:16:25 steve Exp $"
#ident "$Id: elaborate.cc,v 1.34 1999/06/06 20:45:38 steve Exp $"
#endif
/*
@ -938,6 +938,7 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
if (reg == 0) {
cerr << get_line() << ": Could not match signal: " <<
id->name() << endl;
des->errors += 1;
return 0;
}
assert(reg);
@ -952,7 +953,7 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
NetExpr*rval = expr_->elaborate_expr(des, path);
if (rval == 0) {
cerr << get_line() << ": " << "failed to elaborate expression."
cerr << get_line() << ": failed to elaborate expression."
<< endl;
return 0;
}
@ -965,6 +966,87 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
return cur;
}
/*
* The l-value of a procedural assignment is a very much constrained
* expression. To wit, only identifiers, bit selects and part selects
* are allowed. I therefore can elaborate the l-value by hand, without
* the help of recursive elaboration.
*
* (For now, this does not yet support concatenation in the l-value.)
*/
NetProc* PAssignNB::elaborate(Design*des, const string&path) const
{
/* Get the l-value, and assume that it is an identifier. */
const PEIdent*id = dynamic_cast<const PEIdent*>(lval_);
assert(id);
/* Get the signal referenced by the identifier, and make sure
it is a register. */
NetNet*reg = des->find_signal(path+"."+id->name());
if (reg == 0) {
cerr << get_line() << ": Could not match signal: " <<
id->name() << endl;
return 0;
}
assert(reg);
if (reg->type() != NetNet::REG) {
cerr << get_line() << ": " << *lval() << " is not a register."
<< endl;
return 0;
}
assert(reg->type() == NetNet::REG);
assert(rval_);
/* Elaborate the r-value expression. This generates a
procedural expression that I attach to the assignment. */
NetExpr*rval = rval_->elaborate_expr(des, path);
if (rval == 0) {
cerr << get_line() << ": " << "failed to elaborate expression."
<< endl;
return 0;
}
assert(rval);
/* Notice and handle bit selects of the signal. This is done
by making a mux expression to attach to the assignment
node. */
NetAssignNB*cur;
if (id->msb_) {
assert(id->lsb_ == 0);
verinum*v = id->msb_->eval_const(des, path);
if (v == 0) {
NetExpr*m = id->msb_->elaborate_expr(des, path);
assert(m);
cur = new NetAssignNB(des->local_symbol(path), des,
reg->pin_count(), m, rval);
for (unsigned idx = 0 ; idx < cur->pin_count() ; idx += 1)
connect(cur->pin(idx), reg->pin(idx));
} else {
cur = new NetAssignNB(des->local_symbol(path), des, 1, rval);
connect(cur->pin(0), reg->pin(v->as_ulong()));
}
} else {
cur = new NetAssignNB(des->local_symbol(path), des,
reg->pin_count(), rval);
for (unsigned idx = 0 ; idx < cur->pin_count() ; idx += 1)
connect(cur->pin(idx), reg->pin(idx));
}
/* All done with this node. mark its line number and check it in. */
cur->set_line(*this);
des->add_node(cur);
return cur;
}
/*
* This is the elaboration method for a begin-end block. Try to
* elaborate the entire block, even if it fails somewhere. This way I
@ -996,16 +1078,16 @@ NetProc* PBlock::elaborate(Design*des, const string&path) const
NetProc* PCase::elaborate(Design*des, const string&path) const
{
NetExpr*expr = expr_->elaborate_expr(des, path);
NetCase*res = new NetCase(expr, nitems_);
NetCase*res = new NetCase(expr, items_->count());
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
for (unsigned idx = 0 ; idx < items_->count() ; idx += 1) {
NetExpr*gu = 0;
NetProc*st = 0;
if (items_[idx].expr)
gu = items_[idx].expr->elaborate_expr(des, path);
if ((*items_)[idx]->expr)
gu = (*items_)[idx]->expr->elaborate_expr(des, path);
if (items_[idx].stat)
st = items_[idx].stat->elaborate(des, path);
if ((*items_)[idx]->stat)
st = (*items_)[idx]->stat->elaborate(des, path);
res->set_case(idx, gu, st);
}
@ -1142,6 +1224,12 @@ NetProc* PForStatement::elaborate(Design*des, const string&path) const
NetBlock*top = new NetBlock(NetBlock::SEQU);
NetNet*sig = des->find_signal(path+"."+id1->name());
if (sig == 0) {
cerr << id1->get_line() << ": register ``" << id1->name()
<< "'' unknown in this context." << endl;
des->errors += 1;
return 0;
}
assert(sig);
NetAssign*init = new NetAssign(des, sig,
expr1_->elaborate_expr(des, path));
@ -1272,6 +1360,11 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.34 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.33 1999/06/03 05:16:25 steve
* Compile time evalutation of constant expressions.
*

17
emit.cc
View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: emit.cc,v 1.11 1999/05/12 04:03:19 steve Exp $"
#ident "$Id: emit.cc,v 1.12 1999/06/06 20:45:38 steve Exp $"
#endif
/*
@ -50,6 +50,11 @@ void NetAssign::emit_node(ostream&o, struct target_t*tgt) const
tgt->net_assign(o, this);
}
void NetAssignNB::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->net_assign_nb(o, this);
}
void NetConst::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->net_const(o, this);
@ -85,6 +90,11 @@ void NetAssign::emit_proc(ostream&o, struct target_t*tgt) const
tgt->proc_assign(o, this);
}
void NetAssignNB::emit_proc(ostream&o, struct target_t*tgt) const
{
tgt->proc_assign_nb(o, this);
}
void NetAssignMem::emit_proc(ostream&o, struct target_t*tgt) const
{
tgt->proc_assign_mem(o, this);
@ -258,6 +268,11 @@ void emit(ostream&o, const Design*des, const char*type)
/*
* $Log: emit.cc,v $
* Revision 1.12 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.11 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: netlist.cc,v 1.31 1999/06/03 05:16:25 steve Exp $"
#ident "$Id: netlist.cc,v 1.32 1999/06/06 20:45:38 steve Exp $"
#endif
# include <cassert>
@ -30,6 +30,9 @@ ostream& operator<< (ostream&o, NetNet::Type t)
case NetNet::IMPLICIT:
o << "wire /*implicit*/";
break;
case NetNet::INTEGER:
o << "integer";
break;
case NetNet::REG:
o << "reg";
break;
@ -289,6 +292,36 @@ NetAssign::~NetAssign()
{
}
NetAssignNB::NetAssignNB(const string&n, Design*des, unsigned w, NetExpr*rv)
: NetNode(n, w), rval_(rv), bmux_(0)
{
bool flag = rval_->set_width(w);
if (flag == false) {
cerr << rv->get_line() << ": Expression bit width" <<
" conflicts with l-value bit width." << endl;
des->errors += 1;
}
}
NetAssignNB::NetAssignNB(const string&n, Design*des, unsigned w,
NetExpr*mu, NetExpr*rv)
: NetNode(n, w), rval_(rv), bmux_(mu)
{
bool flag = rval_->set_width(1);
if (flag == false) {
cerr << rv->get_line() << ": Expression bit width" <<
" conflicts with l-value bit width." << endl;
des->errors += 1;
}
}
NetAssignNB::~NetAssignNB()
{
delete rval_;
delete bmux_;
}
NetAssignMem::NetAssignMem(NetMemory*m, NetExpr*i, NetExpr*r)
: mem_(m), index_(i), rval_(r)
{
@ -588,12 +621,15 @@ NetESignal::~NetESignal()
{
}
/*
* The signal should automatically pad with zeros to get to th desired
* width. Do not allow signal bits to be truncated, however.
*/
bool NetESignal::set_width(unsigned w)
{
if (w != pin_count())
if (w < pin_count())
return false;
assert(w == pin_count());
expr_width(w);
return true;
}
@ -1118,6 +1154,11 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
/*
* $Log: netlist.cc,v $
* Revision 1.32 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.31 1999/06/03 05:16:25 steve
* Compile time evalutation of constant expressions.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: netlist.h,v 1.35 1999/06/03 05:16:25 steve Exp $"
#ident "$Id: netlist.h,v 1.36 1999/06/06 20:45:38 steve Exp $"
#endif
/*
@ -216,7 +216,7 @@ class NetNet : public NetObj, public LineInfo {
public:
enum Type { IMPLICIT, WIRE, TRI, TRI1, SUPPLY0, WAND, TRIAND,
TRI0, SUPPLY1, WOR, TRIOR, REG };
TRI0, SUPPLY1, WOR, TRIOR, REG, INTEGER };
enum PortType { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT };
@ -585,6 +585,35 @@ class NetAssign : public NetProc, public NetNode, public LineInfo {
NetExpr* rval_;
};
/*
* ... and this is a non-blocking version of above.
*/
class NetAssignNB : public NetProc, public NetNode, public LineInfo {
public:
explicit NetAssignNB(const string&, Design*des, unsigned w, NetExpr*rv);
explicit NetAssignNB(const string&, Design*des, unsigned w,
NetExpr*mux, NetExpr*rv);
~NetAssignNB();
// This is the (procedural) value that is to be assigned when
// the assignment is executed.
const NetExpr*rval() const { return rval_; }
// If this expression exists, then only a single bit is to be
// set from the rval, and the value of this expression selects
// the pin that gets the value.
const NetExpr*bmux() const { return bmux_; }
virtual void emit_proc(ostream&, struct target_t*) const;
virtual void emit_node(ostream&, struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
virtual void dump_node(ostream&, unsigned ind) const;
private:
NetExpr* rval_;
NetExpr* bmux_;
};
/*
* Assignment to memory is handled separately because memory is
* not a node.
@ -1178,6 +1207,11 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.36 1999/06/06 20:45:38 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.35 1999/06/03 05:16:25 steve
* Compile time evalutation of constant expressions.
*

22
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: parse.y,v 1.32 1999/06/02 15:38:46 steve Exp $"
#ident "$Id: parse.y,v 1.33 1999/06/06 20:45:39 steve Exp $"
#endif
# include "parse_misc.h"
@ -35,7 +35,7 @@ extern void lex_end_table();
list<string>*strings;
PCase::Item*citem;
list<PCase::Item*>*citems;
svector<PCase::Item*>*citems;
lgate*gate;
svector<lgate>*gates;
@ -169,13 +169,14 @@ case_item
case_items
: case_items case_item
{ list<PCase::Item*>*tmp = $1;
tmp->push_back($2);
{ svector<PCase::Item*>*tmp;
tmp = new svector<PCase::Item*>(*$1, $2);
delete $1;
$$ = tmp;
}
| case_item
{ list<PCase::Item*>*tmp = new list<PCase::Item*>;
tmp->push_back($1);
{ svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
(*tmp)[0] = $1;
$$ = tmp;
}
;
@ -825,8 +826,10 @@ module_item
}
| K_reg register_variable_list ';'
{ delete $2; }
| K_integer list_of_variables ';'
{ yyerror(@1, "Sorry, integer types not supported."); }
| K_integer register_variable_list ';'
{ pform_set_reg_integer($2);
delete $2;
}
| K_parameter parameter_assign_list ';'
| gatetype delay_opt gate_instance_list ';'
{ pform_makegates($1, $2, $3);
@ -1177,8 +1180,7 @@ statement
$$ = tmp;
}
| lpvalue K_LE expression ';'
{ yyerror(@1, "Sorry, non-blocking assignment not implemented.");
PAssign*tmp = new PAssign($1,$3);
{ PAssignNB*tmp = new PAssignNB($1,$3);
tmp->set_file(@1.text);
tmp->set_lineno(@1.first_line);
$$ = tmp;

View File

@ -17,9 +17,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pform.cc,v 1.22 1999/06/02 15:38:46 steve Exp $"
#ident "$Id: pform.cc,v 1.23 1999/06/06 20:45:39 steve Exp $"
#endif
# include "compiler.h"
# include "pform.h"
# include "parse_misc.h"
# include "PUdp.h"
@ -466,6 +467,17 @@ static void pform_set_net_range(const string&name, const svector<PExpr*>*range)
}
}
void pform_set_net_range(list<string>*names, const svector<PExpr*>*range)
{
assert(range->count() == 2);
for (list<string>::const_iterator cur = names->begin()
; cur != names->end()
; cur ++ ) {
pform_set_net_range(*cur, range);
}
}
void pform_set_parameter(const string&name, PExpr*expr)
{
cur_module->parameters[name] = expr;
@ -480,14 +492,23 @@ void pform_set_port_type(list<string>*names, NetNet::PortType pt)
}
}
void pform_set_net_range(list<string>*names, const svector<PExpr*>*range)
static void pform_set_reg_integer(const string&name)
{
assert(range->count() == 2);
PWire*cur = cur_module->get_wire(name);
assert(cur);
assert(cur->type == NetNet::REG);
cur->type = NetNet::INTEGER;
cur->msb = new PENumber(new verinum(INTEGER_WIDTH-1, INTEGER_WIDTH));
cur->lsb = new PENumber(new verinum(0UL, INTEGER_WIDTH));
}
void pform_set_reg_integer(list<string>*names)
{
for (list<string>::const_iterator cur = names->begin()
; cur != names->end()
; cur ++ ) {
pform_set_net_range(*cur, range);
pform_set_reg_integer(*cur);
}
}
@ -561,6 +582,11 @@ int pform_parse(const char*path, map<string,Module*>&modules,
/*
* $Log: pform.cc,v $
* Revision 1.23 1999/06/06 20:45:39 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.22 1999/06/02 15:38:46 steve
* Line information with nets.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pform.h,v 1.17 1999/06/02 15:38:46 steve Exp $"
#ident "$Id: pform.h,v 1.18 1999/06/06 20:45:39 steve Exp $"
#endif
# include "netlist.h"
@ -113,6 +113,7 @@ extern void pform_makewire(const struct vlltype&li, const list<string>*names,
extern void pform_set_port_type(list<string>*names, NetNet::PortType);
extern void pform_set_net_range(list<string>*names, const svector<PExpr*>*);
extern void pform_set_reg_idx(const string&name, PExpr*l, PExpr*r);
extern void pform_set_reg_integer(list<string>*names);
extern void pform_set_attrib(const string&name, const string&key,
const string&value);
extern void pform_set_type_attrib(const string&name, const string&key,
@ -151,6 +152,11 @@ extern void pform_dump(ostream&out, Module*mod);
/*
* $Log: pform.h,v $
* Revision 1.18 1999/06/06 20:45:39 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.17 1999/06/02 15:38:46 steve
* Line information with nets.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pform_dump.cc,v 1.17 1999/05/29 02:36:17 steve Exp $"
#ident "$Id: pform_dump.cc,v 1.18 1999/06/06 20:45:39 steve Exp $"
#endif
/*
@ -261,6 +261,13 @@ void PAssign::dump(ostream&out, unsigned ind) const
out << " /* " << get_line() << " */" << endl;
}
void PAssignNB::dump(ostream&out, unsigned ind) const
{
out << setw(ind) << "";
out << *lval_ << " <= " << *rval_ << ";";
out << " /* " << get_line() << " */" << endl;
}
void PBlock::dump(ostream&out, unsigned ind) const
{
out << setw(ind) << "" << "begin" << endl;
@ -297,15 +304,15 @@ void PCase::dump(ostream&out, unsigned ind) const
out << setw(ind) << "" << "case (" << *expr_ << ") /* " <<
get_line() << " */" << endl;
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
if (items_[idx].expr)
out << setw(ind+2) << "" << *items_[idx].expr << ":";
for (unsigned idx = 0 ; idx < items_->count() ; idx += 1) {
if ((*items_)[idx]->expr)
out << setw(ind+2) << "" << *(*items_)[idx]->expr << ":";
else
out << setw(ind+2) << "" << "default:";
if (items_[idx].stat) {
if ((*items_)[idx]->stat) {
out << endl;
items_[idx].stat->dump(out, ind+6);
(*items_)[idx]->stat->dump(out, ind+6);
} else {
out << " ;" << endl;
}
@ -356,8 +363,8 @@ void PEventStatement::dump(ostream&out, unsigned ind) const
void PForStatement::dump(ostream&out, unsigned ind) const
{
out << setw(ind) << "" << "for (" << name1_ << " = " << *expr1_
<< "; " << *cond_ << "; " << name2_ << " = " << *expr2_ <<
out << setw(ind) << "" << "for (" << *name1_ << " = " << *expr1_
<< "; " << *cond_ << "; " << *name2_ << " = " << *expr2_ <<
")" << endl;
statement_->dump(out, ind+3);
}
@ -468,6 +475,11 @@ void PUdp::dump(ostream&out) const
/*
* $Log: pform_dump.cc,v $
* Revision 1.18 1999/06/06 20:45:39 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.17 1999/05/29 02:36:17 steve
* module parameter bind by name.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: target.cc,v 1.9 1999/05/12 04:03:19 steve Exp $"
#ident "$Id: target.cc,v 1.10 1999/06/06 20:45:39 steve Exp $"
#endif
# include "target.h"
@ -61,6 +61,12 @@ void target_t::net_assign(ostream&os, const NetAssign*)
{
}
void target_t::net_assign_nb(ostream&os, const NetAssignNB*)
{
cerr << "target (" << typeid(*this).name() << "): "
"Unhandled non-blocking assignment node." << endl;
}
void target_t::net_const(ostream&os, const NetConst*)
{
cerr << "target (" << typeid(*this).name() << "): "
@ -93,6 +99,12 @@ void target_t::proc_assign_mem(ostream&os, const NetAssignMem*)
"Unhandled memory assignment." << endl;
}
void target_t::proc_assign_nb(ostream&os, const NetAssignNB*)
{
cerr << "target (" << typeid(*this).name() << "): "
"Unhandled non-blocking assignment." << endl;
}
void target_t::proc_block(ostream&os, const NetBlock*)
{
}
@ -190,6 +202,11 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
/*
* $Log: target.cc,v $
* Revision 1.10 1999/06/06 20:45:39 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.9 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: target.h,v 1.9 1999/05/12 04:03:20 steve Exp $"
#ident "$Id: target.h,v 1.10 1999/06/06 20:45:39 steve Exp $"
#endif
# include "netlist.h"
@ -66,6 +66,7 @@ struct target_t {
virtual void bufz(ostream&os, const NetBUFZ*);
virtual void udp(ostream&os, const NetUDP*);
virtual void net_assign(ostream&os, const NetAssign*);
virtual void net_assign_nb(ostream&os, const NetAssignNB*);
virtual void net_const(ostream&os, const NetConst*);
virtual void net_esignal(ostream&os, const NetESignal*);
virtual void net_event(ostream&os, const NetNEvent*);
@ -76,6 +77,7 @@ struct target_t {
/* Various kinds of process nodes are dispatched through these. */
virtual void proc_assign(ostream&os, const NetAssign*);
virtual void proc_assign_mem(ostream&os, const NetAssignMem*);
virtual void proc_assign_nb(ostream&os, const NetAssignNB*);
virtual void proc_block(ostream&os, const NetBlock*);
virtual void proc_case(ostream&os, const NetCase*);
virtual void proc_condit(ostream&os, const NetCondit*);
@ -122,6 +124,11 @@ extern const struct target *target_table[];
/*
* $Log: target.h,v $
* Revision 1.10 1999/06/06 20:45:39 steve
* Add parse and elaboration of non-blocking assignments,
* Replace list<PCase::Item*> with an svector version,
* Add integer support.
*
* Revision 1.9 1999/05/12 04:03:20 steve
* emit NetAssignMem objects in vvm target.
*