2 * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: symbol_search.cc,v 1.7 2007/06/02 03:42:13 steve Exp $"
29 * Search for the hierarchical name.
31 NetScope
*symbol_search(Design
*des
, NetScope
*scope
, pform_name_t path
,
35 const NetExpr
*&ex1
, const NetExpr
*&ex2
)
39 /* Get the tail name of the object we are looking for. */
40 perm_string key
= peek_tail_name(path
);
43 /* Initialize output argument to cleared. */
48 /* If the path has a scope part, then search for the specified
49 scope that we are supposed to search. */
51 list
<hname_t
> path_list
= eval_scope_path(des
, scope
, path
);
52 assert(path_list
.size() <= path
.size());
54 // If eval_scope_path returns a short list, then some
55 // part of the scope was not found. Abort.
56 if (path_list
.size() < path
.size())
59 scope
= des
->find_scope(scope
, path_list
);
63 if ( (net
= scope
->find_signal(key
)) )
66 if ( (eve
= scope
->find_event(key
)) )
69 if ( (par
= scope
->get_parameter(key
, ex1
, ex2
)) )
72 if (scope
->type() == NetScope::MODULE
)
75 scope
= scope
->parent();