Handle memory assignments out of range during synthesis

This commit is contained in:
steve 2006-05-05 01:56:36 +00:00
parent 3a6e2df958
commit 452eaeaea8
2 changed files with 25 additions and 4 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: net_nex_output.cc,v 1.11.2.3 2006/04/16 19:26:38 steve Exp $"
#ident "$Id: net_nex_output.cc,v 1.11.2.4 2006/05/05 01:56:36 steve Exp $"
#endif
# include "config.h"
@ -72,8 +72,14 @@ void NetAssignBase::nex_output(NexusSet&out)
long adr= ae->value().as_long();
adr = lmem->index_to_address(adr) * lmem->width();
for (unsigned idx = 0; idx < cur->lwidth(); idx += 1)
out.add(tmp->pin(adr+idx).nexus());
if (adr >= lmem->count()*lmem->width()) {
/* Skip assignments with constant
addresses that are outside the
range of memories. */
} else {
for (unsigned idx=0; idx<cur->lwidth(); idx += 1)
out.add(tmp->pin(adr+idx).nexus());
}
} else {
/* Put all the bits of the memory into the
@ -154,6 +160,9 @@ void NetWhile::nex_output(NexusSet&out)
/*
* $Log: net_nex_output.cc,v $
* Revision 1.11.2.4 2006/05/05 01:56:36 steve
* Handle memory assignments out of range during synthesis
*
* Revision 1.11.2.3 2006/04/16 19:26:38 steve
* Fix handling of exploded memories with partial or missing resets.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: synth2.cc,v 1.39.2.29 2006/04/16 19:26:39 steve Exp $"
#ident "$Id: synth2.cc,v 1.39.2.30 2006/05/05 01:56:36 steve Exp $"
#endif
# include "config.h"
@ -236,6 +236,15 @@ bool NetAssignBase::synth_async_mem_sync_(Design*des, NetScope*scope,
constant. In this case, just hook up the pertinent bits. */
if (NetEConst*ae = dynamic_cast<NetEConst*>(cur->bmux())) {
long adr= ae->value().as_long();
if (adr >= lmem->count()) {
cerr << get_line() << ": error: "
<< "Address " << adr
<< " is outside range of memory."
<< " Skipping assignment." << endl;
des->errors += 1;
return false;
}
adr = lmem->index_to_address(adr) * lmem->width();
for (unsigned idx = 0 ; idx < cur->lwidth() ; idx += 1) {
unsigned off = adr+idx;
@ -1810,6 +1819,9 @@ void synth2(Design*des)
/*
* $Log: synth2.cc,v $
* Revision 1.39.2.30 2006/05/05 01:56:36 steve
* Handle memory assignments out of range during synthesis
*
* Revision 1.39.2.29 2006/04/16 19:26:39 steve
* Fix handling of exploded memories with partial or missing resets.
*