Skip to content

Commit

Permalink
set width of procedural r-values when then
Browse files Browse the repository at this point in the history
 l-value is a memory word.
  • Loading branch information
steve committed Aug 1, 1999
1 parent dd8daf4 commit 444c83b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 18 deletions.
7 changes: 6 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)
#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

/*
Expand Down Expand Up @@ -1163,6 +1163,7 @@ NetProc* PAssign::assign_to_memory_(NetMemory*mem, PExpr*ix,
}
assert(rv);

rv->set_width(mem->width());
NetExpr*idx = ix->elaborate_expr(des, path);
assert(idx);

Expand Down Expand Up @@ -2044,6 +2045,10 @@ Design* elaborate(const map<string,Module*>&modules,

/*
* $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
* elaborate rise/fall/decay for continuous assign.
*
Expand Down
28 changes: 27 additions & 1 deletion netlist.cc
Expand Up @@ -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.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

# include <cassert>
Expand Down Expand Up @@ -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)
{
assert(attributes_.size() == 0);
Expand Down Expand Up @@ -1530,6 +1552,10 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))

/*
* $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
* Add functions up to elaboration (Ed Carter)
*
Expand Down
32 changes: 16 additions & 16 deletions netlist.h
Expand Up @@ -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.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

/*
Expand Down Expand Up @@ -283,30 +283,26 @@ class NetNet : public NetObj, public LineInfo {
* This class represents the declared memory object. The parser
* creates one of these for each declared memory in the elaborated
* 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 {

public:
NetMemory(const string&n, long w, long s, long e)
: name_(n), width_(w), idxh_(s), idxl_(e) { }
NetMemory(const string&n, long w, long s, long e);

const string&name() const { return name_; }

// This is the width (in bits) of a single memory position.
unsigned width() const { return width_; }

unsigned count() const
{ if (idxh_ < idxl_)
return idxl_ - idxh_ + 1;
else
return idxh_ - idxl_ + 1;
}
// This is the number of memory positions.
unsigned count() const;

unsigned index_to_address(long idx) const
{ if (idxh_ < idxl_)
return idx - idxh_;
else
return idx - idxl_;
}
// This method returns a 0 based address of a memory entry as
// indexed by idx. The Verilog source may give index ranges
// that are not zero based.
unsigned index_to_address(long idx) const;

void set_attributes(const map<string,string>&a);

Expand Down Expand Up @@ -1444,6 +1440,10 @@ extern ostream& operator << (ostream&, NetNet::Type);

/*
* $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
* Parse and elaborate rise/fall/decay times
* for gates, and handle the rules for partial
Expand Down

0 comments on commit 444c83b

Please sign in to comment.