diff --git a/emit.cc b/emit.cc index f0c9340fe..2f90c2294 100644 --- a/emit.cc +++ b/emit.cc @@ -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.10 1999/05/07 01:21:18 steve Exp $" +#ident "$Id: emit.cc,v 1.11 1999/05/12 04:03:19 steve Exp $" #endif /* @@ -85,6 +85,11 @@ void NetAssign::emit_proc(ostream&o, struct target_t*tgt) const tgt->proc_assign(o, this); } +void NetAssignMem::emit_proc(ostream&o, struct target_t*tgt) const +{ + tgt->proc_assign_mem(o, this); +} + void NetBlock::emit_proc(ostream&o, struct target_t*tgt) const { tgt->proc_block(o, this); @@ -253,6 +258,9 @@ void emit(ostream&o, const Design*des, const char*type) /* * $Log: emit.cc,v $ + * Revision 1.11 1999/05/12 04:03:19 steve + * emit NetAssignMem objects in vvm target. + * * Revision 1.10 1999/05/07 01:21:18 steve * Handle total lack of nodes and signals. * diff --git a/netlist.cc b/netlist.cc index 13efce97a..91aed7005 100644 --- a/netlist.cc +++ b/netlist.cc @@ -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.23 1999/05/10 00:16:58 steve Exp $" +#ident "$Id: netlist.cc,v 1.24 1999/05/12 04:03:19 steve Exp $" #endif # include @@ -457,6 +457,7 @@ NetEBinary::NetEBinary(char op, NetExpr*l, NetExpr*r) case 'e': case 'n': expr_width(1); + right_->set_width(left_->expr_width()); break; default: expr_width(left_->expr_width() > right_->expr_width() @@ -469,8 +470,8 @@ void NetEBinary::set_width(unsigned w) { switch (op_) { /* Comparison operators allow the subexpressions to have - their own natural width. Do not recurse the - set_width(). */ + their own natural width. However, I do need to make + sure that the subexpressions have the same width. */ case 'e': assert(w == 1); expr_width(w); @@ -1050,6 +1051,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*)) /* * $Log: netlist.cc,v $ + * Revision 1.24 1999/05/12 04:03:19 steve + * emit NetAssignMem objects in vvm target. + * * Revision 1.23 1999/05/10 00:16:58 steve * Parse and elaborate the concatenate operator * in structural contexts, Replace vector diff --git a/netlist.h b/netlist.h index a4fc5dc6c..dc0979e79 100644 --- a/netlist.h +++ b/netlist.h @@ -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.29 1999/05/10 00:16:58 steve Exp $" +#ident "$Id: netlist.h,v 1.30 1999/05/12 04:03:19 steve Exp $" #endif /* @@ -624,6 +624,11 @@ class NetAssignMem : public NetProc, public LineInfo { explicit NetAssignMem(NetMemory*, NetExpr*idx, NetExpr*rv); ~NetAssignMem(); + const NetMemory*memory()const { return mem_; } + const NetExpr*index()const { return index_.ref(); } + const NetExpr*rval()const { return rval_.ref(); } + + virtual void emit_proc(ostream&, struct target_t*) const; virtual void dump(ostream&, unsigned ind) const; private: @@ -1173,6 +1178,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.30 1999/05/12 04:03:19 steve + * emit NetAssignMem objects in vvm target. + * * Revision 1.29 1999/05/10 00:16:58 steve * Parse and elaborate the concatenate operator * in structural contexts, Replace vector diff --git a/t-vvm.cc b/t-vvm.cc index 4772ea8ba..ff478eeee 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-1999 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) -#ident "$Id: t-vvm.cc,v 1.20 1999/05/03 01:51:29 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.21 1999/05/12 04:03:19 steve Exp $" #endif # include @@ -50,6 +50,7 @@ class target_vvm : public target_t { virtual void net_event(ostream&os, const NetNEvent*); virtual void start_process(ostream&os, const NetProcTop*); virtual void proc_assign(ostream&os, const NetAssign*); + virtual void proc_assign_mem(ostream&os, const NetAssignMem*); virtual void proc_block(ostream&os, const NetBlock*); virtual void proc_case(ostream&os, const NetCase*net); virtual void proc_condit(ostream&os, const NetCondit*); @@ -700,6 +701,17 @@ void target_vvm::proc_assign(ostream&os, const NetAssign*net) } } +void target_vvm::proc_assign_mem(ostream&os, const NetAssignMem*amem) +{ + string index = emit_proc_rval(os, 8, amem->index()); + string rval = emit_proc_rval(os, 8, amem->rval()); + const NetMemory*mem = amem->memory(); + + os << " /* " << amem->get_line() << " */" << endl; + os << " " << mangle(mem->name()) + << "[" << index << ".as_unsigned()] = " << rval << ";" << endl; +} + void target_vvm::proc_block(ostream&os, const NetBlock*net) { net->emit_recurse(os, this); @@ -946,6 +958,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.21 1999/05/12 04:03:19 steve + * emit NetAssignMem objects in vvm target. + * * Revision 1.20 1999/05/03 01:51:29 steve * Restore support for wait event control. * diff --git a/target.cc b/target.cc index 82f649534..6f31031e9 100644 --- a/target.cc +++ b/target.cc @@ -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.8 1999/05/01 02:57:53 steve Exp $" +#ident "$Id: target.cc,v 1.9 1999/05/12 04:03:19 steve Exp $" #endif # include "target.h" @@ -87,6 +87,12 @@ void target_t::proc_assign(ostream&os, const NetAssign*) { } +void target_t::proc_assign_mem(ostream&os, const NetAssignMem*) +{ + cerr << "target (" << typeid(*this).name() << "): " + "Unhandled memory assignment." << endl; +} + void target_t::proc_block(ostream&os, const NetBlock*) { } @@ -184,6 +190,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex) /* * $Log: target.cc,v $ + * Revision 1.9 1999/05/12 04:03:19 steve + * emit NetAssignMem objects in vvm target. + * * Revision 1.8 1999/05/01 02:57:53 steve * Handle much more complex event expressions. * diff --git a/target.h b/target.h index 587dd595e..ef53b193e 100644 --- a/target.h +++ b/target.h @@ -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.8 1999/05/01 02:57:53 steve Exp $" +#ident "$Id: target.h,v 1.9 1999/05/12 04:03:20 steve Exp $" #endif # include "netlist.h" @@ -75,6 +75,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_block(ostream&os, const NetBlock*); virtual void proc_case(ostream&os, const NetCase*); virtual void proc_condit(ostream&os, const NetCondit*); @@ -121,6 +122,9 @@ extern const struct target *target_table[]; /* * $Log: target.h,v $ + * Revision 1.9 1999/05/12 04:03:20 steve + * emit NetAssignMem objects in vvm target. + * * Revision 1.8 1999/05/01 02:57:53 steve * Handle much more complex event expressions. *