From 44131d4b160388d845772ff5e85e3f1d5eb1239c Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 15 Dec 2000 21:54:43 +0000 Subject: [PATCH] Allow non-blocking assign to pad memory word with zeros. --- t-vvm.cc | 10 ++++++++-- vvm/vvm_memory.cc | 13 +++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/t-vvm.cc b/t-vvm.cc index 5e3dc6548..0f603775a 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.193 2000/12/15 21:40:26 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.194 2000/12/15 21:54:43 steve Exp $" #endif # include @@ -2660,7 +2660,10 @@ void target_vvm::proc_assign_mem_nb(const NetAssignMemNB*amem) defn << " /* " << amem->get_line() << " */" << endl; - assert(mem->width() <= amem->rval()->expr_width()); + /* Note here that the vvm_memory_t::assign_nb constructor will + pad the rval with St0 if it is not as wide as the memory + word. If this is not what is desired, then it should have + been fixed up by semantic analysis anyhow. */ defn << " (new vvm_memory_t::assign_nb(" << mangle(mem->name()) << ", " << index << ".as_unsigned(), " << rval << @@ -3410,6 +3413,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.194 2000/12/15 21:54:43 steve + * Allow non-blocking assign to pad memory word with zeros. + * * Revision 1.193 2000/12/15 21:40:26 steve * concatenation as parameter to system tasks. PR#64) * diff --git a/vvm/vvm_memory.cc b/vvm/vvm_memory.cc index 7097b1aa1..9efffe127 100644 --- a/vvm/vvm_memory.cc +++ b/vvm/vvm_memory.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_memory.cc,v 1.1 2000/12/15 20:05:16 steve Exp $" +#ident "$Id: vvm_memory.cc,v 1.2 2000/12/15 21:54:43 steve Exp $" #endif # include "vvm_signal.h" @@ -80,8 +80,14 @@ vvm_memory_t::assign_nb::assign_nb(vvm_memory_t&m, unsigned i, const vvm_bitset_t&v) : mem_(m), index_(i), bits_(new vpip_bit_t[m.width]), val_(bits_, m.width) { - for (unsigned idx = 0 ; idx < m.width ; idx += 1) + unsigned top = m.width; + if (top > v.nbits) + top = v.nbits; + + for (unsigned idx = 0 ; idx < top ; idx += 1) val_[idx] = v[idx]; + for (unsigned idx = top ; idx < m.width ; idx += 1) + val_[idx] = St0; } @@ -97,6 +103,9 @@ void vvm_memory_t::assign_nb::event_function() /* * $Log: vvm_memory.cc,v $ + * Revision 1.2 2000/12/15 21:54:43 steve + * Allow non-blocking assign to pad memory word with zeros. + * * Revision 1.1 2000/12/15 20:05:16 steve * Fix memory access in vvm. (PR#70) *