diff --git a/elab_net.cc b/elab_net.cc index ab7a89642..388f01491 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -502,13 +502,10 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, { ivl_assert(*this, scope); - NetNet* sig = 0; - const NetExpr*par = 0; - NetEvent* eve = 0; + symbol_search_results sr; + symbol_search(this, des, scope, path_.name, &sr); - symbol_search(this, des, scope, path_.name, sig, par, eve); - - if (eve != 0) { + if (sr.eve != 0) { cerr << get_fileline() << ": error: named events (" << path_ << ") cannot be l-values in continuous " << "assignments." << endl; @@ -516,17 +513,9 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, return 0; } - pform_name_t base_path = path_.name; - pform_name_t member_path; - while (sig == 0 && !base_path.empty()) { - symbol_search(this, des, scope, base_path, sig, par, eve); - // Found it! - if (sig != 0) break; - // Not found. Try to pop another name off the base_path - // and push it to the front of the member_path. - member_path.push_front( base_path.back() ); - base_path.pop_back(); - } + NetNet*sig = sr.net; + pform_name_t base_path = sr.path_head; + pform_name_t member_path = sr.path_tail; if (sig == 0) { cerr << get_fileline() << ": error: Net " << path_ @@ -1148,15 +1137,14 @@ bool PEIdent::is_collapsible_net(Design*des, NetScope*scope, { ivl_assert(*this, scope); - NetNet* sig = 0; - const NetExpr*par = 0; - NetEvent* eve = 0; + symbol_search_results sr; + symbol_search(this, des, scope, path_.name, &sr); - symbol_search(this, des, scope, path_.name, sig, par, eve); - - if (eve != 0) + if (sr.eve != 0) return false; + NetNet*sig = sr.net; + if (sig == 0) return false; diff --git a/elaborate.cc b/elaborate.cc index 31aae1d8f..6e4cc99a0 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1267,14 +1267,11 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const for (unsigned j = 0 ; j < nexp ; j += 1) { if (rmod->ports[j] && !pins[j] && !pins_is_explicitly_not_connected[j]) { pins_fromwc[j] = true; - NetNet* net = 0; - const NetExpr*par = 0; - NetEvent* eve = 0; pform_name_t path_; path_.push_back(name_component_t(rmod->ports[j]->name)); - symbol_search(this, des, scope, - path_, net, par, eve); - if (net != 0) { + symbol_search_results sr; + symbol_search(this, des, scope, path_, &sr); + if (sr.net != 0) { pins[j] = new PEIdent(rmod->ports[j]->name, true); pins[j]->set_lineno(get_lineno()); pins[j]->set_file(get_file()); @@ -3805,11 +3802,6 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope, perm_string method_name = peek_tail_name(use_path); use_path.pop_back(); - NetNet *net; - const NetExpr *par; - ivl_type_t par_type = 0; - NetEvent *eve; - /* Add the implicit this reference when requested. */ if (add_this_flag) { ivl_assert(*this, use_path.empty()); @@ -3831,8 +3823,10 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope, // resolve to a class object. Note that the "this" symbol // (internally represented as "@") is handled by there being a // "this" object in the instance scope. - symbol_search(this, des, scope, use_path, net, par, eve, par_type); + symbol_search_results sr; + symbol_search(this, des, scope, use_path, &sr); + NetNet*net = sr.net; if (net == 0) return 0; @@ -3976,7 +3970,7 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope, } } - if (const netclass_t*class_type = dynamic_cast(par_type)) { + if (const netclass_t*class_type = dynamic_cast(sr.type)) { NetScope*task = class_type->method_from_name(method_name); if (task == 0) { // If an implicit this was added it is not an error if we @@ -6066,21 +6060,15 @@ NetProc* PNBTrigger::elaborate(Design*des, NetScope*scope) const { ivl_assert(*this, scope); - NetNet* sig = 0; - const NetExpr*par = 0; - NetEvent* eve = 0; - - NetScope*found_in = symbol_search(this, des, scope, event_, - sig, par, eve); - - if (found_in == 0) { + symbol_search_results sr; + if (!symbol_search(this, des, scope, event_, &sr)) { cerr << get_fileline() << ": error: event <" << event_ << ">" << " not found." << endl; des->errors += 1; return 0; } - if (eve == 0) { + if (sr.eve == 0) { cerr << get_fileline() << ": error: <" << event_ << ">" << " is not a named event." << endl; des->errors += 1; @@ -6089,7 +6077,7 @@ NetProc* PNBTrigger::elaborate(Design*des, NetScope*scope) const NetExpr*dly = 0; if (dly_) dly = elab_and_eval(des, scope, dly_, -1); - NetEvNBTrig*trig = new NetEvNBTrig(eve, dly); + NetEvNBTrig*trig = new NetEvNBTrig(sr.eve, dly); trig->set_line(*this); return trig; } diff --git a/netmisc.h b/netmisc.h index 87d95db7b..d9da5af76 100644 --- a/netmisc.h +++ b/netmisc.h @@ -113,43 +113,6 @@ extern bool symbol_search(const LineInfo *li, Design *des, NetScope *scope, const pform_scoped_name_t &path, struct symbol_search_results*res); -/* - * Search for a symbol using the "start" scope as the starting - * point. If the path includes a scope part, then locate the - * scope first. - * - * The return value is the scope where the symbol was found. - * If the symbol was not found, return 0. The output arguments - * get 0 except for the pointer to the object that represents - * the located symbol. - * - * The ex1 and ex2 output arguments are extended results. If the - * symbol is a parameter (par!=0) then ex1 is the msb expression and - * ex2 is the lsb expression for the range. If there is no range, then - * these values are set to 0. - */ -extern NetScope* symbol_search(const LineInfo*li, - Design*des, - NetScope*start, - const pform_name_t&path, - NetNet*&net, /* net/reg */ - const NetExpr*&par,/* parameter/expr */ - NetEvent*&eve, /* named event */ - ivl_type_t&par_type); - -inline NetScope* symbol_search(const LineInfo*li, - Design*des, - NetScope*start, - const pform_name_t&path, - NetNet*&net, /* net/reg */ - const NetExpr*&par,/* parameter/expr */ - NetEvent*&eve /* named event */) -{ - ivl_type_t par_type; - return symbol_search(li, des, start, path, net, par, eve, - par_type); -} - /* * This function transforms an expression by either zero or sign extending * the high bits until the expression has the desired width. This may mean diff --git a/symbol_search.cc b/symbol_search.cc index dd81c22b1..d96f2a5f0 100644 --- a/symbol_search.cc +++ b/symbol_search.cc @@ -326,43 +326,3 @@ bool symbol_search(const LineInfo *li, Design *des, NetScope *scope, return symbol_search(li, des, search_scope, path.name, res, search_scope, prefix_scope); } - -/* - * Compatibility version. Remove me! - */ -NetScope*symbol_search(const LineInfo*li, Design*des, NetScope*scope, - const pform_name_t&path, - NetNet*&net, - const NetExpr*&par, - NetEvent*&eve, - ivl_type_t&par_type) -{ - symbol_search_results recurse; - bool flag = symbol_search(li, des, scope, path, &recurse); - - net = 0; - par = 0; - par_type = 0; - eve = 0; - - // The compatible version doesn't know how to handle unmatched tail - // components, so report them as errors. - if (! recurse.path_tail.empty()) { - if (debug_elaborate) { - cerr << li->get_fileline() << ": symbol_search (compat): " - << "path_tail items found: " << recurse.path_tail << endl; - } - return 0; - } - - // Convert the extended results to the compatible results. - net = recurse.net; - par = recurse.par_val; - par_type = recurse.type; - eve = recurse.eve; - if (! flag) { - return 0; - } - - return recurse.scope; -}