2002-06-30 04:21:31 +02:00
|
|
|
/*
|
2021-02-20 08:21:12 +01:00
|
|
|
* Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com)
|
2002-06-30 04:21:31 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-06-30 04:21:31 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "config.h"
|
|
|
|
|
|
|
|
|
|
# include <iostream>
|
|
|
|
|
|
|
|
|
|
# include <cassert>
|
|
|
|
|
# include <typeinfo>
|
|
|
|
|
# include "netlist.h"
|
|
|
|
|
# include "netmisc.h"
|
|
|
|
|
|
2021-11-04 17:12:04 +01:00
|
|
|
using namespace std;
|
|
|
|
|
|
2010-11-01 22:37:06 +01:00
|
|
|
void NetProc::nex_output(NexusSet&)
|
2002-06-30 04:21:31 +02:00
|
|
|
{
|
2007-12-20 18:31:01 +01:00
|
|
|
cerr << get_fileline()
|
2002-06-30 04:21:31 +02:00
|
|
|
<< ": internal error: NetProc::nex_output not implemented"
|
|
|
|
|
<< endl;
|
2007-12-20 18:31:01 +01:00
|
|
|
cerr << get_fileline()
|
2004-06-30 17:32:18 +02:00
|
|
|
<< ": : on object type " << typeid(*this).name()
|
|
|
|
|
<< endl;
|
2002-06-30 04:21:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-12-27 23:41:43 +01:00
|
|
|
void NetAlloc::nex_output(NexusSet&)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-09 03:18:31 +02:00
|
|
|
void NetAssign_::nex_output(NexusSet&out)
|
|
|
|
|
{
|
2017-12-27 23:41:43 +01:00
|
|
|
assert(! nest_);
|
2013-10-27 00:05:21 +02:00
|
|
|
assert(sig_);
|
|
|
|
|
unsigned use_word = 0;
|
|
|
|
|
unsigned use_base = 0;
|
|
|
|
|
unsigned use_wid = lwidth();
|
|
|
|
|
if (word_) {
|
|
|
|
|
long tmp = 0;
|
|
|
|
|
if (eval_as_long(tmp, word_)) {
|
|
|
|
|
// A constant word select, so add the selected word.
|
|
|
|
|
use_word = tmp;
|
|
|
|
|
} else {
|
|
|
|
|
// A variable word select. The obvious thing to do
|
|
|
|
|
// is to add the whole array, but this could cause
|
|
|
|
|
// NetBlock::nex_input() to overprune the input set.
|
|
|
|
|
// As array access is not yet handled in synthesis,
|
|
|
|
|
// I'll leave this as TBD - the output set is not
|
|
|
|
|
// otherwise used when elaborating an always @*
|
|
|
|
|
// block.
|
|
|
|
|
return;
|
2013-09-09 03:18:31 +02:00
|
|
|
}
|
2013-10-27 00:05:21 +02:00
|
|
|
}
|
|
|
|
|
Nexus*nex = sig_->pin(use_word).nexus();
|
|
|
|
|
if (base_) {
|
2013-09-09 03:18:31 +02:00
|
|
|
|
2014-07-14 03:09:13 +02:00
|
|
|
// Unable to evaluate the bit/part select of
|
|
|
|
|
// the l-value, so this is a mux. Pretty
|
|
|
|
|
// sure I don't know how to handle this yet
|
|
|
|
|
// in synthesis, so punt for now.
|
|
|
|
|
|
|
|
|
|
// Even with constant bit/part select, we want to
|
|
|
|
|
// return the entire signal as an output. The
|
|
|
|
|
// context will need to sort out which bits are
|
|
|
|
|
// actually assigned.
|
|
|
|
|
use_base = 0;
|
|
|
|
|
use_wid = nex->vector_width();
|
2013-09-09 03:18:31 +02:00
|
|
|
}
|
2013-10-27 00:05:21 +02:00
|
|
|
out.add(nex, use_base, use_wid);
|
2013-09-09 03:18: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) {
|
2013-09-09 03:18:31 +02:00
|
|
|
cur->nex_output(out);
|
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)
|
|
|
|
|
{
|
2017-12-27 23:41:43 +01:00
|
|
|
if (last_ == 0) return;
|
2002-07-29 02:00:28 +02:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2014-06-14 03:01:41 +02:00
|
|
|
for (size_t idx = 0 ; idx < items_.size() ; idx += 1) {
|
2002-07-08 00:32:15 +02:00
|
|
|
|
2007-04-05 03:53:52 +02:00
|
|
|
// Empty statements clearly have no output.
|
2017-12-27 23:41:43 +01:00
|
|
|
if (items_[idx].statement == 0) continue;
|
2007-04-05 03:53:52 +02:00
|
|
|
|
2002-07-08 00:32:15 +02:00
|
|
|
items_[idx].statement->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-30 04:21:31 +02:00
|
|
|
void NetCondit::nex_output(NexusSet&out)
|
|
|
|
|
{
|
2017-12-27 23:41:43 +01:00
|
|
|
if (if_) if_->nex_output(out);
|
|
|
|
|
if (else_) else_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetDisable::nex_output(NexusSet&)
|
|
|
|
|
{
|
2002-06-30 04:21:31 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-17 05:01:06 +02:00
|
|
|
void NetDoWhile::nex_output(NexusSet&out)
|
|
|
|
|
{
|
2017-12-27 23:41:43 +01:00
|
|
|
if (proc_) proc_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetEvTrig::nex_output(NexusSet&)
|
|
|
|
|
{
|
2013-09-17 05:01:06 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-20 08:21:12 +01:00
|
|
|
void NetEvNBTrig::nex_output(NexusSet&)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-01 02:54:21 +02:00
|
|
|
void NetEvWait::nex_output(NexusSet&out)
|
|
|
|
|
{
|
2017-12-27 23:41:43 +01:00
|
|
|
if (statement_) statement_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetForever::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
if (statement_) statement_->nex_output(out);
|
2002-07-01 02:54:21 +02:00
|
|
|
}
|
2002-06-30 04:21:31 +02:00
|
|
|
|
2014-05-02 05:37:33 +02:00
|
|
|
void NetForLoop::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
if (statement_) statement_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-27 23:41:43 +01:00
|
|
|
void NetFree::nex_output(NexusSet&)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-30 17:32:18 +02:00
|
|
|
void NetPDelay::nex_output(NexusSet&out)
|
|
|
|
|
{
|
|
|
|
|
if (statement_) statement_->nex_output(out);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-27 23:41:43 +01:00
|
|
|
void NetRepeat::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
|
2008-01-25 23:53:36 +01:00
|
|
|
* all. This is OK because most system tasks are not synthesizable in
|
2004-08-28 18:23:05 +02:00
|
|
|
* the first place.
|
|
|
|
|
*/
|
2010-11-01 22:37:06 +01:00
|
|
|
void NetSTask::nex_output(NexusSet&)
|
2004-08-28 18:23:05 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-17 06:34:23 +02:00
|
|
|
/*
|
|
|
|
|
* Consider a task call to not have any outputs. This is not quite
|
|
|
|
|
* right, we should be listing as outputs all the output ports, but for
|
|
|
|
|
* the purposes that this method is used, this will do for now.
|
|
|
|
|
*/
|
2010-11-01 22:37:06 +01:00
|
|
|
void NetUTask::nex_output(NexusSet&)
|
2007-04-17 06:34:23 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-26 05:51:38 +01:00
|
|
|
void NetWhile::nex_output(NexusSet&out)
|
|
|
|
|
{
|
2017-12-27 23:41:43 +01:00
|
|
|
if (proc_) proc_->nex_output(out);
|
2003-10-26 05:51:38 +01:00
|
|
|
}
|