// $Id$ //************************************************************************* // DESCRIPTION: Verilator: Symbol table // // Code available from: http://www.veripool.com/verilator // // AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli // //************************************************************************* // // Copyright 2003-2006 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // General Public License or the Perl Artistic License. // // Verilator 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. // //************************************************************************* #ifndef _V3LINKSYMTABLE_H_ #define _V3LINKSYMTABLE_H_ 1 #include "config.h" #include #include #include #include #include "V3Global.h" //###################################################################### // Symbol table class V3SymTable : public AstNUser { // Symbol table that can have a "superior" table for resolving upper references private: // MEMBERS typedef std::map IdNameMap; IdNameMap m_idNameMap; // Hash of variables by name V3SymTable* m_upperp; // Table "above" this one in name scope public: // METHODS V3SymTable(V3SymTable* upperTablep) { m_upperp = upperTablep; } V3SymTable() { m_upperp = NULL; } ~V3SymTable() {} void insert(const string& name, AstNode* nodep) { //UINFO(9, " SymInsert "<v3fatalSrc("Inserting two symbols with same name: "<second); // Then scan the upper begin/end block or module for the name if (m_upperp) return m_upperp->findIdName(name); return NULL; } }; #endif // guard