⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oaverilogparserbase.cpp

📁 openaccess与verilog互相转化时所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogParserBase.cpp//// This file contains the implementation of the ParserBase class.//// *****************************************************************************// Except as specified in the OpenAccess terms of use of Cadence or Silicon// Integration Initiative, this material may not be copied, modified,// re-published, uploaded, executed, or distributed in any way, in any medium,// in whole or in part, without prior written permission from Cadence.////		  Copyright 2003-2005 Cadence Design Systems, Inc.//			     All Rights	Reserved.////  $Author: shaun $//  $Revision: 1.13 $//  $Date: 2005/05/14 02:51:41 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogInPvt.h"BEGIN_VERILOG_NAMESPACE// *****************************************************************************// ParserBase::ParserBase()//// This is the constructor for the ParserBase class. // *****************************************************************************ParserBase::ParserBase(const ParserParam    &param):   scanner(*param.getScanner()),    callback(param.getCallbacks()),    verilogFileNames(NULL),    currentMaster(NULL),    currentParameters(NULL),    stackCleared(false){}// *****************************************************************************// ParserBase::init()//// This function initializes the parser prior to calling the parse method. It// sets the list of the Verilog files to parse and the name of the output// OpenAccess library.// *****************************************************************************voidParserBase::init(StringList *verilogFileL){    verilogFileNames = verilogFileL;    currentMaster = NULL;    currentParameters = NULL;    stackCleared = false;    scanner.init(verilogFileNames);}// *****************************************************************************// ParserBase::setCallbacks()//// This function sets the callbacks used by the parser when certain rules are // accepted.// *****************************************************************************voidParserBase::setCallbacks(CallbacksIn	&cbIn){    callback = &cbIn;}// *****************************************************************************// ParserBase::resetCurrentInstOptions()//// This function resets the current options, that affect the future inst // declarations, to a default state.  This default state has no inst master// or parameters.// *****************************************************************************voidParserBase::resetCurrentInstOptions(){    delete currentMaster;    currentMaster = NULL;    delete currentParameters;    currentParameters = NULL;}// *****************************************************************************// ParserBase::pushFrontParamArray()//// This function pushes the given element onto the front of the given parameter // array, increasing the size of the array by 1 and retaining all the original// elements of the array. // *****************************************************************************voidParserBase::pushFrontParamArray(oaParam	    &elt,				ParamList   &array){   array.prefix(elt);}// *****************************************************************************// ParserBase::pushBackParamArray()//// This function pushes the given element onto the back of the given parameter // array, increasing the size of the array by 1 and retaining all the original// elements of the array.  // *****************************************************************************voidParserBase::pushBackParamArray(ParamList    &array,			       oaParam      &elt){    array.append(elt);}// *****************************************************************************// connectByParamArray//// This function establish connections based on the contents of a parameter // array.  The net name is stored in the name of the parameter and the inst // term name is stored in the parameter value.  The parameters are in the order // that the connections are specified in the input Verilog file.  If there is // no inst term name (IE: the parameter value is not a string type), then the // nets are connected to the inst terms by order.// *****************************************************************************voidParserBase::connectByParamArray(oaString    &instNameStr,				ParamList   &connections){    oaUInt4	i = 0;    oaName	instName(nameSpace, instNameStr);    oaName	termName;    oaName	netName;    oaString	netNameStr;    for (ParamListIter conn = connections.begin(); conn != connections.end(); 	 conn++) {	oaParam	    &param = **conn;	param.getName(netNameStr);	Options::oaStringToName(netNameStr, netName);	if (param.getType() == oacStringParamType) {	    callback->oaCharToName(param.getStringVal(), termName);	    callback->connectByName(instName, netName, termName);	} else if (param.getType() == oacBooleanParamType		   && param.getBooleanVal()) {	    callback->connectByOrder(instName, netName, i);	}	i++;    }}// *****************************************************************************// makeParamForConnection()//// These methods create a parameter that describes a connection.  If the // parameter value is a string, then the connection is a connection-by-name // where the name of the parameter represents the connecting net and the value // of the parameter represents the name of the connected term.  If the // parameter value is a boolean, then the connection a connection-by-order,// where the name of the parameter is the name of the connecting net and// the connected term is determined by the position of this parameter in // a parameter array.  If the boolean value is false, then there is no// actual connection at this position and the parameter acts only as a // placeholder.// *****************************************************************************oaParam*ParserBase::makeParamForConnection(oaString &netNameStr,				   oaString &portNameStr){    return new oaParam(netNameStr, portNameStr);}oaParam*ParserBase::makeParamForConnection(const char   *netName,				   oaBoolean    connected){    oaParam     *param = new oaParam;    oaString    netNameStr(netName);    param->setName(netName);    param->setBooleanVal(connected);    return param;}oaParam*ParserBase::makeParamForConnection(oaString     &netNameStr,				   oaBoolean    connected){    oaParam *param = new oaParam;    param->setName((const oaChar*) netNameStr);    param->setBooleanVal(connected);    return param;}// *****************************************************************************// ParserBase::yylex()//// This function returns the next token from the scanner.  It is a wrapper // around the scanner's yylex function.// *****************************************************************************intParserBase::yylex(ParserStypeWrapper	*value){    return scanner.yylex(value);}END_VERILOG_NAMESPACE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -