void VerilatedVcd::printTime (vluint64_t timeui) {
    // VCD file format specification does not allow non-integers for timestamps
    // Dinotrace doesn't mind, but Cadence vvision seems to choke
    if (VL_UNLIKELY(timeui < m_timeLastDump)) {
	timeui = m_timeLastDump;
	static bool backTime = false;
	if (!backTime) {
	    backTime = true;
	    VL_PRINTF("VCD time is moving backwards, wave file may be incorrect.\n");
	}
    }
    m_timeLastDump = timeui;
    printQuad(timeui);
}
Esempio n. 2
0
void SpTraceVcd::printTime (uint64_t timeui) {
    // VCD file format specification does not allow non-integers for timestamps
    // Dinotrace doesn't mind, but Cadence vvision seems to choke
    if (SP_UNLIKELY(timeui < m_timeLastDump)) {
	timeui = m_timeLastDump;
	static bool backTime = false;
	if (!backTime) {
	    backTime = true;
	    SP_NOTICE_LN(__FILE__,__LINE__, "VCD time is moving backwards, wave file may be incorrect.\n");
	}
    }
    m_timeLastDump = timeui;
    printQuad(timeui);
}
Esempio n. 3
0
bool LRGramar::startGrammarAnalysis(const char codeBuffer[])
{
    int returnCode;         //每次识别字符串的code
    int startPosition = 0;  //每次读出字符的起始位置
    int charA;             //每次从输入串中读出的字符保存到a
    int statusTopStack;   //栈顶状态


    morphology.setPreIsOp(true);//初始化操作符信号
    double num = 0;    //记录scanner扫描到数字的数值
    ////////////////////////////////////////////////////////
    /*do{
    	returnCode = morphology.scaner(codeBuffer,startPosition,bufferToken);

    	if(returnCode == DIGIT)
    	{
    		Complier::strToNumber(bufferToken,num);
    		printf("(%d,%g)\n",returnCode,num);
    	}
    	else if(returnCode == ERROR)
    	{
    		printf("('%s')不能有该文法生成!\n",bufferToken);
    	}
    	else if(returnCode==NOTE)
    	{
    		//
    	}
    	else
    	{
    		printf("(%d,'%s')\n",returnCode,bufferToken);
    	}

    }while(returnCode!=END_JINGHAO);*/
    //初始化相关堆栈
    quadCount = 0; //记录四元式数组存放位置
    nextq = 1;     //记录下一个四元式标号
    trueChainHead = 0;//记录回填真链的链首
    variableBufferPtr = -1;//存放变量名或者标示符的栈的指针
    OpPtr = -1;//ptr to the stack of op
    tempCount = 0;
    startPosition = 0;  //每次读出字符的起始位置
    statusStackPtr = -1;
    charStackPtr = -1;
    doTruePtr = -1;
    falseChainPtr = -1;
    push(statusStack,statusStackPtr,0); //将0状态压入堆栈
    push(charStack,charStackPtr,END_JINGHAO);
    charA = morphology.scaner(codeBuffer,startPosition,bufferToken);  //将字符串读入a
    if(charA==DIGIT || charA == IDENTIFIER)//如果为数字或者标示符及时保存
    {
        strcpy(variableBuffer[++variableBufferPtr],bufferToken);
    }
    statusTopStack = statusStack[statusStackPtr];         //栈顶状态
    int actionStatus = ActionTable[statusTopStack][mapPosition(charA)] ;
    while(actionStatus != ACC)
    {
        //如果是转移状态
        if(isTransferStatus(actionStatus))
        {
            //将状态和a压入堆栈
            push(statusStack,statusStackPtr,actionStatus);
            push(charStack,charStackPtr,charA);
            //读取下一个字符a
            do {
                charA = morphology.scaner(codeBuffer,startPosition,bufferToken);  //将字符串读入a
                if(charA==DIGIT || charA == IDENTIFIER)//如果为数字或者标示符及时保存
                {
                    strcpy(variableBuffer[++variableBufferPtr],bufferToken);
                }
            } while(charA==NOTE);
        }
        //如果是规约状态
        else if(isGuiYueStatus(actionStatus))
        {
            //用actionStatus所对应的规则(A->a)规约,并将|a|个状态和|a|个输入符号退栈,
            //当前栈顶状态为S,将A和GOTO[S][A]=S`进栈
            if(!doGuiYue(actionStatus))  //如果规约失败返回错误
            {
                return false;
            }
        }
        //some status else
        else
        {
            //error
            return false;
        }
        statusTopStack = statusStack[statusStackPtr];         //栈顶状态
        actionStatus = ActionTable[statusTopStack][mapPosition(charA)] ;
    }
    printf("---------------------------------------------------\n");
    printQuad();
    return true;
}