diff --git a/elab_net.cc b/elab_net.cc index efd392c00..9398a44e4 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -2334,25 +2334,18 @@ NetNet* PEFNumber::elaborate_net(Design*des, NetScope*scope, NetNet* PEIdent::make_implicit_net_(Design*des, NetScope*scope) const { NetNet::Type nettype = scope->default_nettype(); - NetNet*sig = 0; + assert(nettype != NetNet::NONE); - if (!error_implicit && nettype!=NetNet::NONE) { - sig = new NetNet(scope, peek_tail_name(path_), - NetNet::IMPLICIT, 1); - /* Implicit nets are always scalar logic. */ - sig->data_type(IVL_VT_LOGIC); + NetNet*sig = new NetNet(scope, peek_tail_name(path_), + NetNet::IMPLICIT, 1); + sig->set_line(*this); + /* Implicit nets are always scalar logic. */ + sig->data_type(IVL_VT_LOGIC); - if (warn_implicit) { - cerr << get_fileline() << ": warning: implicit " - "definition of wire logic " << scope_path(scope) - << "." << peek_tail_name(path_) << "." << endl; - } - - } else { - cerr << get_fileline() << ": error: Net " << path_ - << " is not defined in this context." << endl; - des->errors += 1; - return 0; + if (warn_implicit) { + cerr << get_fileline() << ": warning: implicit " + "definition of wire logic " << scope_path(scope) + << "." << peek_tail_name(path_) << "." << endl; } return sig; diff --git a/elab_sig.cc b/elab_sig.cc index e336f8ab3..a81f83622 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -250,6 +250,12 @@ bool PEIdent::elaborate_sig(Design*des, NetScope*scope) const const NetExpr*par = 0; NetEvent* eve = 0; + // If implicit net creation is turned off, then stop now. + if (scope->default_nettype() == NetNet::NONE) + return true; + if (error_implicit) + return true; + symbol_search(des, scope, path_, sig, par, eve); if (eve != 0) @@ -293,6 +299,16 @@ bool PGModule::elaborate_sig_mod_(Design*des, NetScope*scope, { bool flag = true; + // First, elaborate the signals that may be created implicitly + // by ports to this module instantiation. + for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) { + const PExpr*tmp = pin(idx); + if (tmp == 0) + continue; + flag = tmp->elaborate_sig(des, scope) && flag; + } + + NetScope::scope_vec_t instance = scope->instance_arrays[get_name()]; for (unsigned idx = 0 ; idx < instance.count() ; idx += 1) {