set width of procedural r-values when then

l-value is a memory word.
This commit is contained in:
steve 1999-08-01 21:48:11 +00:00
parent dd8daf40df
commit 444c83b19a
3 changed files with 49 additions and 18 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: elaborate.cc,v 1.64 1999/08/01 21:18:55 steve Exp $" #ident "$Id: elaborate.cc,v 1.65 1999/08/01 21:48:11 steve Exp $"
#endif #endif
/* /*
@ -1163,6 +1163,7 @@ NetProc* PAssign::assign_to_memory_(NetMemory*mem, PExpr*ix,
} }
assert(rv); assert(rv);
rv->set_width(mem->width());
NetExpr*idx = ix->elaborate_expr(des, path); NetExpr*idx = ix->elaborate_expr(des, path);
assert(idx); assert(idx);
@ -2044,6 +2045,10 @@ Design* elaborate(const map<string,Module*>&modules,
/* /*
* $Log: elaborate.cc,v $ * $Log: elaborate.cc,v $
* Revision 1.65 1999/08/01 21:48:11 steve
* set width of procedural r-values when then
* l-value is a memory word.
*
* Revision 1.64 1999/08/01 21:18:55 steve * Revision 1.64 1999/08/01 21:18:55 steve
* elaborate rise/fall/decay for continuous assign. * elaborate rise/fall/decay for continuous assign.
* *

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: netlist.cc,v 1.50 1999/07/31 19:14:47 steve Exp $" #ident "$Id: netlist.cc,v 1.51 1999/08/01 21:48:11 steve Exp $"
#endif #endif
# include <cassert> # include <cassert>
@ -841,6 +841,28 @@ NetEMemory::~NetEMemory()
{ {
} }
NetMemory::NetMemory(const string&n, long w, long s, long e)
: name_(n), width_(w), idxh_(s), idxl_(e)
{
}
unsigned NetMemory::count() const
{
if (idxh_ < idxl_)
return idxl_ - idxh_ + 1;
else
return idxh_ - idxl_ + 1;
}
unsigned NetMemory::index_to_address(long idx) const
{
if (idxh_ < idxl_)
return idx - idxh_;
else
return idx - idxl_;
}
void NetMemory::set_attributes(const map<string,string>&attr) void NetMemory::set_attributes(const map<string,string>&attr)
{ {
assert(attributes_.size() == 0); assert(attributes_.size() == 0);
@ -1530,6 +1552,10 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
/* /*
* $Log: netlist.cc,v $ * $Log: netlist.cc,v $
* Revision 1.51 1999/08/01 21:48:11 steve
* set width of procedural r-values when then
* l-value is a memory word.
*
* Revision 1.50 1999/07/31 19:14:47 steve * Revision 1.50 1999/07/31 19:14:47 steve
* Add functions up to elaboration (Ed Carter) * Add functions up to elaboration (Ed Carter)
* *

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.53 1999/08/01 16:34:50 steve Exp $" #ident "$Id: netlist.h,v 1.54 1999/08/01 21:48:11 steve Exp $"
#endif #endif
/* /*
@ -283,30 +283,26 @@ class NetNet : public NetObj, public LineInfo {
* This class represents the declared memory object. The parser * This class represents the declared memory object. The parser
* creates one of these for each declared memory in the elaborated * creates one of these for each declared memory in the elaborated
* design. A reference to one of these is handled by the NetEMemory * design. A reference to one of these is handled by the NetEMemory
* object, which is derived from NetExpr. * object, which is derived from NetExpr. This is not a node because
* memory objects can only be accessed by behavioral code.
*/ */
class NetMemory { class NetMemory {
public: public:
NetMemory(const string&n, long w, long s, long e) NetMemory(const string&n, long w, long s, long e);
: name_(n), width_(w), idxh_(s), idxl_(e) { }
const string&name() const { return name_; } const string&name() const { return name_; }
// This is the width (in bits) of a single memory position.
unsigned width() const { return width_; } unsigned width() const { return width_; }
unsigned count() const // This is the number of memory positions.
{ if (idxh_ < idxl_) unsigned count() const;
return idxl_ - idxh_ + 1;
else
return idxh_ - idxl_ + 1;
}
unsigned index_to_address(long idx) const // This method returns a 0 based address of a memory entry as
{ if (idxh_ < idxl_) // indexed by idx. The Verilog source may give index ranges
return idx - idxh_; // that are not zero based.
else unsigned index_to_address(long idx) const;
return idx - idxl_;
}
void set_attributes(const map<string,string>&a); void set_attributes(const map<string,string>&a);
@ -1444,6 +1440,10 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.54 1999/08/01 21:48:11 steve
* set width of procedural r-values when then
* l-value is a memory word.
*
* Revision 1.53 1999/08/01 16:34:50 steve * Revision 1.53 1999/08/01 16:34:50 steve
* Parse and elaborate rise/fall/decay times * Parse and elaborate rise/fall/decay times
* for gates, and handle the rules for partial * for gates, and handle the rules for partial