2003-09-19 05:30:04 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2003 Stephen Williams (steve@icarus.com)
|
|
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
#ifdef HAVE_CVS_IDENT
|
2007-05-24 06:07:11 +02:00
|
|
|
#ident "$Id: symbol_search.cc,v 1.6 2007/05/24 04:07:12 steve Exp $"
|
2003-09-19 05:30:04 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
# include "netlist.h"
|
|
|
|
|
# include <assert.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Search for the hierarchical name.
|
|
|
|
|
*/
|
2007-05-24 06:07:11 +02:00
|
|
|
NetScope*symbol_search(const Design*des, NetScope*scope, pform_name_t path,
|
2003-09-19 05:30:04 +02:00
|
|
|
NetNet*&net,
|
|
|
|
|
const NetExpr*&par,
|
2005-11-27 06:56:20 +01:00
|
|
|
NetEvent*&eve,
|
|
|
|
|
const NetExpr*&ex1, const NetExpr*&ex2)
|
2003-09-19 05:30:04 +02:00
|
|
|
{
|
|
|
|
|
assert(scope);
|
|
|
|
|
|
|
|
|
|
/* Get the tail name of the object we are looking for. */
|
2007-05-24 06:07:11 +02:00
|
|
|
perm_string key = peek_tail_name(path);
|
|
|
|
|
path.pop_back();
|
2003-09-19 05:30:04 +02:00
|
|
|
|
|
|
|
|
/* Initialize output argument to cleared. */
|
|
|
|
|
net = 0;
|
|
|
|
|
par = 0;
|
|
|
|
|
eve = 0;
|
|
|
|
|
|
|
|
|
|
/* If the path has a scope part, then search for the specified
|
|
|
|
|
scope that we are supposed to search. */
|
2007-05-24 06:07:11 +02:00
|
|
|
if (! path.empty())
|
2003-09-19 05:30:04 +02:00
|
|
|
scope = des->find_scope(scope, path);
|
|
|
|
|
|
|
|
|
|
while (scope) {
|
2007-04-26 05:06:21 +02:00
|
|
|
if ( (net = scope->find_signal(key)) )
|
2003-09-19 05:30:04 +02:00
|
|
|
return scope;
|
|
|
|
|
|
2007-04-26 05:06:21 +02:00
|
|
|
if ( (eve = scope->find_event(key)) )
|
2003-09-19 05:30:04 +02:00
|
|
|
return scope;
|
|
|
|
|
|
2007-04-26 05:06:21 +02:00
|
|
|
if ( (par = scope->get_parameter(key, ex1, ex2)) )
|
2003-09-19 05:30:04 +02:00
|
|
|
return scope;
|
|
|
|
|
|
|
|
|
|
if (scope->type() == NetScope::MODULE)
|
|
|
|
|
scope = 0;
|
|
|
|
|
else
|
|
|
|
|
scope = scope->parent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* $Log: symbol_search.cc,v $
|
2007-05-24 06:07:11 +02:00
|
|
|
* Revision 1.6 2007/05/24 04:07:12 steve
|
|
|
|
|
* Rework the heirarchical identifier parse syntax and pform
|
|
|
|
|
* to handle more general combinations of heirarch and bit selects.
|
|
|
|
|
*
|
2007-04-26 05:06:21 +02:00
|
|
|
* Revision 1.5 2007/04/26 03:06:22 steve
|
|
|
|
|
* Rework hname_t to use perm_strings.
|
|
|
|
|
*
|
2007-01-16 06:44:14 +01:00
|
|
|
* Revision 1.4 2007/01/16 05:44:15 steve
|
|
|
|
|
* Major rework of array handling. Memories are replaced with the
|
|
|
|
|
* more general concept of arrays. The NetMemory and NetEMemory
|
|
|
|
|
* classes are removed from the ivl core program, and the IVL_LPM_RAM
|
|
|
|
|
* lpm type is removed from the ivl_target API.
|
|
|
|
|
*
|
2005-11-27 06:56:20 +01:00
|
|
|
* Revision 1.3 2005/11/27 05:56:20 steve
|
|
|
|
|
* Handle bit select of parameter with ranges.
|
|
|
|
|
*
|
2005-07-11 18:56:50 +02:00
|
|
|
* Revision 1.2 2005/07/11 16:56:51 steve
|
|
|
|
|
* Remove NetVariable and ivl_variable_t structures.
|
|
|
|
|
*
|
2003-09-19 05:30:04 +02:00
|
|
|
* Revision 1.1 2003/09/19 03:30:05 steve
|
|
|
|
|
* Fix name search in elab_lval.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|