2002-06-30 04:21:31 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
|
|
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
2002-08-12 03:34:58 +02:00
|
|
|
#ifdef HAVE_CVS_IDENT
|
2006-05-05 03:56:36 +02:00
|
|
|
#ident "$Id: net_nex_output.cc,v 1.11.2.4 2006/05/05 01:56:36 steve Exp $"
|
2002-06-30 04:21:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
# include "config.h"
|
|
|
|
|
|
|
|
|
|
# include <iostream>
|
|
|
|
|
|
|
|
|
|
# include <cassert>
|
|
|
|
|
# include <typeinfo>
|
|
|
|
|
# include "netlist.h"
|
|
|
|
|
# include "netmisc.h"
|
|
|
|
|
|
|
|
|
|
void NetProc::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
cerr << get_line()
|
|
|
|
|
<< ": internal error: NetProc::nex_output not implemented"
|
|
|
|
|
<< endl;
|
2004-06-30 17:32:18 +02:00
|
|
|
cerr << get_line()
|
|
|
|
|
<< ": : on object type " << typeid(*this).name()
|
|
|
|
|
<< endl;
|
2002-06-30 04:21:31 +02:00
|
|
|
}
|
|
|
|
|
|
2004-09-16 05:17:33 +02:00
|
|
|
/*
|
|
|
|
|
* Assignments have as output all the bits of the concatenated signals
|
|
|
|
|
* of the l-value.
|
|
|
|
|
*/
|
2002-07-01 02:54:21 +02:00
|
|
|
void NetAssignBase::nex_output(NexusSet&out)
|
2002-06-30 04:21:31 +02:00
|
|
|
{
|
2004-09-16 05:17:33 +02:00
|
|
|
for (NetAssign_*cur = lval_ ; cur ; cur = cur->more) {
|
|
|
|
|
if (NetNet*lsig = cur->sig()) {
|
2006-03-12 08:34:16 +01:00
|
|
|
|
|
|
|
|
/* Handle l-value signals. We don't need to worry
|
|
|
|
|
here about whether there is a bmux, because the
|
|
|
|
|
synthesizer will detect that mux and create a
|
|
|
|
|
decoder between the expression and the signal. */
|
2004-09-16 05:17:33 +02:00
|
|
|
for (unsigned idx = 0 ; idx < cur->lwidth() ; idx += 1) {
|
|
|
|
|
unsigned off = cur->get_loff() + idx;
|
|
|
|
|
out.add(lsig->pin(off).nexus());
|
|
|
|
|
}
|
2006-03-12 08:34:16 +01:00
|
|
|
|
|
|
|
|
} else if (NetMemory*lmem = cur->mem()) {
|
|
|
|
|
|
|
|
|
|
/* Memories here are treated as a bunch of reg
|
|
|
|
|
devices. Use the explode_to_reg method to get
|
|
|
|
|
access to the FF version of the memory and use
|
|
|
|
|
that in our l-value management. */
|
|
|
|
|
NetNet*tmp = lmem->explode_to_reg();
|
|
|
|
|
|
|
|
|
|
if (NetEConst*ae = dynamic_cast<NetEConst*>(cur->bmux())) {
|
|
|
|
|
/* The address is constant, so simply
|
|
|
|
|
connect to the right pins and we are
|
|
|
|
|
done. */
|
|
|
|
|
long adr= ae->value().as_long();
|
|
|
|
|
adr = lmem->index_to_address(adr) * lmem->width();
|
|
|
|
|
|
2006-05-05 03:56:36 +02:00
|
|
|
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());
|
|
|
|
|
}
|
2006-03-12 08:34:16 +01:00
|
|
|
|
|
|
|
|
} else {
|
2006-04-16 21:26:37 +02:00
|
|
|
/* Put all the bits of the memory into the
|
|
|
|
|
set. The synthesis will generate a
|
|
|
|
|
decoder to handle this. */
|
|
|
|
|
for (unsigned idx = 0; idx < tmp->pin_count(); idx+=1)
|
|
|
|
|
out.add(tmp->pin(idx).nexus());
|
2006-03-12 08:34:16 +01:00
|
|
|
}
|
|
|
|
|
|
2004-09-16 05:17:33 +02:00
|
|
|
} else {
|
|
|
|
|
/* Quoting from netlist.h comments for class NetMemory:
|
|
|
|
|
* "This is not a node because memory objects can only be
|
|
|
|
|
* accessed by behavioral code."
|
|
|
|
|
*/
|
|
|
|
|
cerr << get_line() << ": internal error: "
|
|
|
|
|
<< "NetAssignBase::nex_output on unsupported lval ";
|
|
|
|
|
dump_lval(cerr);
|
|
|
|
|
cerr << endl;
|
2003-12-20 01:59:31 +01:00
|
|
|
}
|
2002-09-17 06:39:20 +02:00
|
|
|
}
|
2002-06-30 04:21:31 +02:00
|
|
|
}
|
|
|
|
|
|
2002-07-29 02:00:28 +02:00
|
|
|
void NetBlock::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
if (last_ == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
NetProc*cur = last_;
|
|
|
|
|
do {
|
|
|
|
|
cur = cur->next_;
|
|
|
|
|
cur->nex_output(out);
|
|
|
|
|
} while (cur != last_);
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-08 00:32:15 +02:00
|
|
|
void NetCase::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
|
|
|
|
|
|
|
|
|
|
assert(items_[idx].statement);
|
|
|
|
|
items_[idx].statement->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-30 04:21:31 +02:00
|
|
|
void NetCondit::nex_output(NexusSet&out)
|
|
|
|
|
{
|
2002-07-01 02:54:21 +02:00
|
|
|
if (if_ != 0)
|
|
|
|
|
if_->nex_output(out);
|
|
|
|
|
if (else_ != 0)
|
|
|
|
|
else_->nex_output(out);
|
2002-06-30 04:21:31 +02:00
|
|
|
}
|
|
|
|
|
|
2002-07-01 02:54:21 +02:00
|
|
|
void NetEvWait::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
assert(statement_);
|
|
|
|
|
statement_->nex_output(out);
|
|
|
|
|
}
|
2002-06-30 04:21:31 +02:00
|
|
|
|
2004-06-30 17:32:18 +02:00
|
|
|
void NetPDelay::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
if (statement_) statement_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-28 18:23:05 +02:00
|
|
|
/*
|
|
|
|
|
* For the purposes of synthesis, system task calls have no output at
|
|
|
|
|
* all. This is OK because most system tasks are not synthesizeable in
|
|
|
|
|
* the first place.
|
|
|
|
|
*/
|
|
|
|
|
void NetSTask::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-26 05:51:38 +01:00
|
|
|
void NetWhile::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
if (proc_ != 0)
|
|
|
|
|
proc_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-30 04:21:31 +02:00
|
|
|
/*
|
|
|
|
|
* $Log: net_nex_output.cc,v $
|
2006-05-05 03:56:36 +02:00
|
|
|
* Revision 1.11.2.4 2006/05/05 01:56:36 steve
|
|
|
|
|
* Handle memory assignments out of range during synthesis
|
|
|
|
|
*
|
2006-04-16 21:26:37 +02:00
|
|
|
* Revision 1.11.2.3 2006/04/16 19:26:38 steve
|
|
|
|
|
* Fix handling of exploded memories with partial or missing resets.
|
|
|
|
|
*
|
2006-03-12 08:34:16 +01:00
|
|
|
* Revision 1.11.2.2 2006/03/12 07:34:17 steve
|
|
|
|
|
* Fix the memsynth1 case.
|
|
|
|
|
*
|
2006-01-18 02:23:23 +01:00
|
|
|
* Revision 1.11.2.1 2006/01/18 01:23:23 steve
|
|
|
|
|
* Rework l-value handling to allow for more l-value type flexibility.
|
|
|
|
|
*
|
2004-09-16 05:17:33 +02:00
|
|
|
* Revision 1.11 2004/09/16 03:17:33 steve
|
|
|
|
|
* net_output handles l-value concatenations.
|
|
|
|
|
*
|
2004-08-28 18:23:05 +02:00
|
|
|
* Revision 1.10 2004/08/28 16:23:05 steve
|
|
|
|
|
* Fix use of system tasks in AT_STAR statements.
|
|
|
|
|
*
|
2004-06-30 17:32:18 +02:00
|
|
|
* Revision 1.9 2004/06/30 15:32:18 steve
|
|
|
|
|
* nex_output for NetPDelay statements.
|
|
|
|
|
*
|
2003-12-20 01:59:31 +01:00
|
|
|
* Revision 1.8 2003/12/20 00:59:31 steve
|
|
|
|
|
* Synthesis debug messages.
|
|
|
|
|
*
|
2003-10-26 05:51:38 +01:00
|
|
|
* Revision 1.7 2003/10/26 04:51:39 steve
|
|
|
|
|
* Output of While is output of while substatement.
|
|
|
|
|
*
|
2002-09-17 06:39:20 +02:00
|
|
|
* Revision 1.6 2002/09/17 04:39:20 steve
|
|
|
|
|
* Account for part select in l-value.
|
|
|
|
|
*
|
2002-08-12 03:34:58 +02:00
|
|
|
* Revision 1.5 2002/08/12 01:34:59 steve
|
|
|
|
|
* conditional ident string using autoconfig.
|
|
|
|
|
*
|
2002-07-29 02:00:28 +02:00
|
|
|
* Revision 1.4 2002/07/29 00:00:28 steve
|
|
|
|
|
* Asynchronous synthesis of sequential blocks.
|
|
|
|
|
*
|
2002-07-08 00:32:15 +02:00
|
|
|
* Revision 1.3 2002/07/07 22:32:15 steve
|
|
|
|
|
* Asynchronous synthesis of case statements.
|
|
|
|
|
*
|
2002-07-01 02:54:21 +02:00
|
|
|
* Revision 1.2 2002/07/01 00:54:21 steve
|
|
|
|
|
* synth_asych of if/else requires redirecting the target
|
|
|
|
|
* if sub-statements. Use NetNet objects to manage the
|
|
|
|
|
* situation.
|
|
|
|
|
*
|
2002-06-30 04:21:31 +02:00
|
|
|
* Revision 1.1 2002/06/30 02:21:32 steve
|
|
|
|
|
* Add structure for asynchronous logic synthesis.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|