Allow memories without indices in expressions.

This commit is contained in:
steve 1999-12-12 06:03:14 +00:00
parent 3e1738dcec
commit 76655ce2bb
4 changed files with 27 additions and 7 deletions

View File

@ -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) #if !defined(WINNT)
#ident "$Id: design_dump.cc,v 1.62 1999/12/05 02:24:08 steve Exp $" #ident "$Id: design_dump.cc,v 1.63 1999/12/12 06:03:14 steve Exp $"
#endif #endif
/* /*
@ -741,7 +741,7 @@ void NetESubSignal::dump(ostream&o) const
void NetEMemory::dump(ostream&o) const void NetEMemory::dump(ostream&o) const
{ {
o << mem_->name() << "["; o << mem_->name() << "[";
idx_->dump(o); if (idx_) idx_->dump(o);
o << "]"; o << "]";
} }
@ -862,6 +862,9 @@ void Design::dump(ostream&o) const
/* /*
* $Log: design_dump.cc,v $ * $Log: design_dump.cc,v $
* Revision 1.63 1999/12/12 06:03:14 steve
* Allow memories without indices in expressions.
*
* Revision 1.62 1999/12/05 02:24:08 steve * Revision 1.62 1999/12/05 02:24:08 steve
* Synthesize LPM_RAM_DQ for writes into memories. * Synthesize LPM_RAM_DQ for writes into memories.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: elab_expr.cc,v 1.12 1999/11/30 04:54:01 steve Exp $" #ident "$Id: elab_expr.cc,v 1.13 1999/12/12 06:03:14 steve Exp $"
#endif #endif
@ -263,10 +263,15 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) const
// object to handle it. // object to handle it.
if (NetMemory*mem = des->find_memory(path, text_)) { if (NetMemory*mem = des->find_memory(path, text_)) {
if (msb_ == 0) { if (msb_ == 0) {
NetEMemory*node = new NetEMemory(mem);
node->set_line(*this);
return node;
#if 0
cerr << get_line() << ": error: Memory ``" << name << cerr << get_line() << ": error: Memory ``" << name <<
"'' referenced without an index expression." << endl; "'' referenced without an index expression." << endl;
des->errors += 1; des->errors += 1;
return 0; return 0;
#endif
} }
assert(msb_ != 0); assert(msb_ != 0);
assert(lsb_ == 0); assert(lsb_ == 0);
@ -332,6 +337,9 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const
/* /*
* $Log: elab_expr.cc,v $ * $Log: elab_expr.cc,v $
* Revision 1.13 1999/12/12 06:03:14 steve
* Allow memories without indices in expressions.
*
* Revision 1.12 1999/11/30 04:54:01 steve * Revision 1.12 1999/11/30 04:54:01 steve
* Match scope names as last resort. * Match scope names as last resort.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: netlist.h,v 1.100 1999/12/09 06:00:00 steve Exp $" #ident "$Id: netlist.h,v 1.101 1999/12/12 06:03:14 steve Exp $"
#endif #endif
/* /*
@ -1803,12 +1803,14 @@ class NetEIdent : public NetExpr {
}; };
/* /*
* A reference to a memory is represented by this expression. * A reference to a memory is represented by this expression. If the
* index is not supplied, then the node is only valid in certain
* specific contexts.
*/ */
class NetEMemory : public NetExpr { class NetEMemory : public NetExpr {
public: public:
NetEMemory(NetMemory*mem, NetExpr*idx); NetEMemory(NetMemory*mem, NetExpr*idx =0);
virtual ~NetEMemory(); virtual ~NetEMemory();
const string& name () const { return mem_->name(); } const string& name () const { return mem_->name(); }
@ -2067,6 +2069,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.101 1999/12/12 06:03:14 steve
* Allow memories without indices in expressions.
*
* Revision 1.100 1999/12/09 06:00:00 steve * Revision 1.100 1999/12/09 06:00:00 steve
* Fix const/non-const errors. * Fix const/non-const errors.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: t-vvm.cc,v 1.88 1999/12/05 02:24:09 steve Exp $" #ident "$Id: t-vvm.cc,v 1.89 1999/12/12 06:03:14 steve Exp $"
#endif #endif
# include <iostream> # include <iostream>
@ -242,6 +242,7 @@ void vvm_proc_rval::expr_ident(const NetEIdent*expr)
void vvm_proc_rval::expr_memory(const NetEMemory*mem) void vvm_proc_rval::expr_memory(const NetEMemory*mem)
{ {
const string mname = mangle(mem->name()); const string mname = mangle(mem->name());
assert(mem->index());
mem->index()->expr_scan(this); mem->index()->expr_scan(this);
result = mname + ".get_word(" + result + ".as_unsigned())"; result = mname + ".get_word(" + result + ".as_unsigned())";
} }
@ -1958,6 +1959,9 @@ extern const struct target tgt_vvm = {
}; };
/* /*
* $Log: t-vvm.cc,v $ * $Log: t-vvm.cc,v $
* Revision 1.89 1999/12/12 06:03:14 steve
* Allow memories without indices in expressions.
*
* Revision 1.88 1999/12/05 02:24:09 steve * Revision 1.88 1999/12/05 02:24:09 steve
* Synthesize LPM_RAM_DQ for writes into memories. * Synthesize LPM_RAM_DQ for writes into memories.
* *