From bb39d09d5e4849b046041738217ddc4a7895b752 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 26 Oct 2013 23:05:21 +0100 Subject: [PATCH] Eliminate spurious error message for array word lval in always @* block. --- net_nex_output.cc | 65 +++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/net_nex_output.cc b/net_nex_output.cc index 5b3f4b1ca..761937fb8 100644 --- a/net_nex_output.cc +++ b/net_nex_output.cc @@ -38,38 +38,43 @@ void NetProc::nex_output(NexusSet&) void NetAssign_::nex_output(NexusSet&out) { - if (sig_ && !word_) { - Nexus*nex = sig_->pin(0).nexus(); - unsigned use_base = 0; - unsigned use_wid = lwidth(); - if (base_) { - long tmp = 0; - bool flag = eval_as_long(tmp, base_); - if (!flag) { - // 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. - use_base = 0; - use_wid = nex->vector_width(); - - } else { - use_base = tmp; - } + 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; } - - out.add(nex, use_base, use_wid); - - } 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 << "?:?" << ": internal error: " - << "NetAssignBase::nex_output on unsupported lval "; - dump_lval(cerr); - cerr << endl; } + Nexus*nex = sig_->pin(use_word).nexus(); + if (base_) { + long tmp = 0; + bool flag = eval_as_long(tmp, base_); + if (!flag) { + // 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. + use_base = 0; + use_wid = nex->vector_width(); + + } else { + use_base = tmp; + } + } + out.add(nex, use_base, use_wid); } /*