Exemple #1
0
bool VerifyIdea::verify(Circuit &cir, Wave *waves, int patternID , const string &workspace)
{
	cir_ = ○
	// circuit directory
	stringstream ss;
	ss << patternID;
	string patDir = workspace + "/pat" + ss.str();

	// open hspice simulation result
	string simResult = patDir + "/sp_result.txt";
	ifstream fin(simResult.c_str());

	// if hspice result doesn't exist, try nanosim simulation result
	if(!fin)
	{
		cout << "**WARRN: can't find result in " << patDir << "/sp_result.txt" << endl;
		return false;
		string simResult2 = patDir + "/nano_result.txt";
		fin.open(simResult2.c_str());
	}

	// if both result not exist, stop verify
	if(!fin)
	{
		cout << "**WARRN: can't find result in " << patDir << "/nano_result.txt" << endl;
		return false;
	}

	string measName;
	double pathDelay;
	double extraDelay;

	fin >> measName >> measName >> pathDelay >> extraDelay;

	// there is no transition in po or ppo
	// happend at s27 pattern 1
	if(pathDelay == 0 && extraDelay == 0)
		return true;
	
	// measure names in sp_result have an addition character '='
	// we need to delete it
	if(*measName.rbegin() == '=')
		measName.erase(measName.end()-1);
	
	// remove _r_delay or _f_delay
	measName.erase(measName.end()-8,measName.end());
	cout << "test: " << measName << endl;


	
	int cellID = cir.getCellID(measName);
	int netID = -1;
	if(cellID == -1)
		netID = cir.getNetID(measName);
	
	if(cellID == -1 && netID == -1)
	{
		cout << "can't match po or ppo" << endl;
		return false;
	}

	
	if(netID == -1)
		netID = cir.cells[cellID].ipt_net_id[0];
	

	cout << "net name: " << cir.nets[netID].name << endl;
	
	if(waves[netID].transition.size() == 0)
		return false;

	const Transition *lastTrans = &waves[netID].transition.back();
		
	pathVerify(lastTrans , pathDelay , extraDelay);
	
	cout << "success" << endl;
	return true;
}