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

📄 oaveriloginvlitest.cpp

📁 openaccess与verilog互相转化时所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogInVliTest.cpp//// This file contains the implementation of the	oaVerilogInVliTest 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	istributed 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.14 $//  $Date: 2005/07/12 00:00:57 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogInTest.h"// *****************************************************************************// oaVerilogInVliTest::oaVerilogInVliTest()//// This is the constructor for the oaVerilogInVliTest class.// *****************************************************************************oaVerilogInVliTest::oaVerilogInVliTest(const oaString	&name,				       oaBoolean	doNoEMH,				       oaBoolean	doEMH,				       oaBoolean	trace):   oaVerilogInTest(name, doNoEMH, doEMH, trace){}// *****************************************************************************// oaVerilogInVliTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogInVliTest::test(){    preTest();    openOutputFile();    enableCallbacks(true);    try	{	verify(oaVerilog::Value::isNumber("123"));	verify(oaVerilog::Value::isNumber("123'h2"));	verify(oaVerilog::Value::isNumber("'b1"));	verify(!oaVerilog::Value::isNumber("a"));	verify(!oaVerilog::Value::isNumber("2*a"));	oaVerilog::Value    strValue("first string");	tout.print("strValue = %s\n", (const char*) strValue.toString());	strValue = "second string";	tout.print("strValue = %s\n", (const char*) strValue.toString());	oaUInt4		    myInt = 1;	oaVerilog::Value    minValue;	minValue = myInt;	tout.print("minValue = %d\n", minValue.toInt());	oaVerilog::Value    myInt2("'hf1");	verify(myInt2.toInt() == 0xf1);	oaVerilog::Value    myInt3("'o73");	verify(myInt3.toInt() == 073);	oaVerilog::Value    myInt4("4'b010");	verify(myInt4.getNumBits() == 4);	verify(myInt4.toInt() == 2);	oaVerilog::Value    myInt5(myInt);	verify(myInt5.toInt() == myInt);	oaDouble	    myDouble = 3.14159;	oaVerilog::Value    maxValue;	maxValue = myDouble;	tout.print("maxValue = %e\n", maxValue.toDouble());	Range	range1(minValue, maxValue);	tout.print("range1 = [%e, %e]\n", range1.getStartVal().toDouble(),	           range1.getStopVal().toDouble());	Range	range2(2);	tout.print("range2 = [%d, %d]\n", range2.getStartVal().toInt(),		   range2.getStopVal().toInt());	range2.setStartVal(minValue);	range2.setStopVal(maxValue);	tout.print("range2 = [%d, %d]\n", range2.getStartVal().toInt(),		   range2.getStopVal().toInt());	oaVerilog::Value    longBinaryValue("128'b00000000000000000000000000000"					    "0000000000000000000000000000000000"					    "0000000000000000000000000000000000"					    "0000000000000000000010000000000");	if (!longBinaryValue.testBit(10)) {	    tout.print("longBinaryValue bit 10 is not set\n");	}	if (longBinaryValue.getType() != PaddedBinaryValue) {	    tout.print("longBinaryValue has the wrong type\n");	}	if (longBinaryValue.getNumBits() != 128) {	    tout.print("longBinaryValue has the wrong number of bits\n");	}	if (longBinaryValue.testBit(127)) {	    tout.print("longBinaryValue bit 127 is set (but should not be set)\n");	}	tout.print("longBinaryValue converted to binary is: %s\n", 		   (const char*) longBinaryValue.toString());	oaVerilog::Value    longHexValue("'hfedcba9876543210");	if (!longHexValue.testBit(63)) {	    tout.print("longHexValue bit 63 is not set\n");	}	if (longHexValue.getType() != PaddedBinaryValue) {	    tout.print("longHexValue has the wrong type\n");	}	if (longHexValue.getNumBits() != 64) {	    tout.print("longHexValue has the wrong number of bits\n");	}	if (longHexValue.testBit(3)) {	    tout.print("longHexValue bit 3 is set (but should not be set)\n");	}	tout.print("longHexValue converted to binary is: %s\n", 		   (const char*) longHexValue.toString());	oaVerilog::Value    longOctalValue("'o765432107654321076543210");	if (!longOctalValue.testBit(71)) {	    tout.print("longOctalValue bit 71 is not set\n");	}	if (longOctalValue.getType() != PaddedBinaryValue) {	    tout.print("longOctalValue has the wrong type\n");	}	if (longOctalValue.getNumBits() != 72) {	    tout.print("longOctalValue has the wrong number of bits\n");	}	if (longOctalValue.testBit(2)) {	    tout.print("longOctalValue bit 2 is set (but should not be set)\n");	}	tout.print("longOctalValue converted to binary is: %s\n", 		   (const char*) longOctalValue.toString());	oaVerilog::Value    decimalValue("128");	if (!decimalValue.testBit(7)) {	    tout.print("decimalValue bit 7 is not set\n");	}	if (decimalValue.getType() != PaddedBinaryValue) {	    tout.print("decimalValue has the wrong type\n");	}	if (decimalValue.getNumBits() != 32) {	    tout.print("decimalValue has the wrong number of bits\n");	}	if (decimalValue.testBit(0)) {	    tout.print("decimalValue bit 0 is set (but should not be set)\n");	}	tout.print("decimalValue converted to binary is: %s\n", 		   (const char*) decimalValue.toString());    }    catch(Error    &verr) {	tout.print(verr.getMsg());	closeOutputFile();	enableCallbacks(false);	throw;    }    catch(oaException	 &oaErr) {	tout.print((const char*) oaErr.getMsg());	closeOutputFile();	enableCallbacks(false);	throw;    }    catch(...) {	tout.print("Caught an exception that was not handled by the reader.\n");	closeOutputFile();	enableCallbacks(false);	throw;    }    closeOutputFile();    enableCallbacks(false);    return result && compareOutputByName(getName());}

⌨️ 快捷键说明

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