Skip to content

Commit 28717b4

Browse files
Don't include duplicate nodes in NetEvent objects (issue #1286).
Currently, when a constant bit/part select is found in the implicit sensitivity list for an always_* construct, it is replaced by the entire signal. If there is more than one bit/part select from the same signal, that signal gets added to the list multiple times. This breaks the algorithm used to detect duplicate events in the nodangle functor, causing it to erroneously merge non-identical events in some cases. The proper fix is to support sensitivity at the bit/part level, as required by IEEE 1800. But for now, just make sure we only include the entire signal once, regardless of how many different bit/part selects we find. Enhance the "sorry" message to report which signals are contributing excessively to the process sensitivity.
1 parent 3b20930 commit 28717b4

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

elaborate.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4908,11 +4908,9 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
49084908
unsigned vwid = nset->at(idx).lnk.nexus()->vector_width();
49094909
// Is this a part select?
49104910
if (always_sens_ && (wid != vwid)) {
4911-
cerr << get_fileline() << ": sorry: constant "
4912-
"selects in always_* processes are not "
4913-
"currently supported (all bits will be "
4914-
"included)." << endl;
49154911
# if 0
4912+
// Once this is fixed, enable constant bit/part select sensitivity in
4913+
// NetESelect::nex_input().
49164914
unsigned base = nset->at(idx).base;
49174915
cerr << get_fileline() << ": base = " << base << endl;
49184916
// FIXME: make this work with selects that go before the base.

net_nex_input.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,20 @@ NexusSet* NetESelect::nex_input(bool rem_out, bool always_sens, bool nested_func
144144
NexusSet*tmp = expr_->nex_input(rem_out, always_sens, nested_func);
145145
bool const_select = result->size() == 0;
146146
if (always_sens && const_select) {
147-
if (const NetEConst *val = dynamic_cast <NetEConst*> (base_)) {
147+
if (/* const NetEConst *val = */ dynamic_cast <NetEConst*> (base_)) {
148148
assert(select_type() == IVL_SEL_OTHER);
149149
if (const NetESignal *sig = dynamic_cast<NetESignal*> (expr_)) {
150+
cerr << get_fileline() << ": sorry: constant selects "
151+
"in always_* processes are not fully supported "
152+
"(the process will be sensitive to all bits in '"
153+
<< *sig << "')." << endl;
154+
#if 0
155+
// Enable this code once PEventStatement::elaborate_st() has been enhanced to
156+
// support bit/part select sensitivity.
150157
delete tmp;
151158
tmp = sig->nex_input_base(rem_out, always_sens, nested_func,
152159
val->value().as_unsigned(), expr_width());
160+
#endif
153161
} else {
154162
cerr << get_fileline() << ": Sorry, cannot determine the sensitivity "
155163
<< "for the select of " << *expr_ << ", using all bits." << endl;

0 commit comments

Comments
 (0)