예제 #1
0
	// This method is cloned from Operator, just resetting sign and exception bits
	// (because we don't have any exception support in this toy example)
	TestCase* FPSumOf3Squares::buildRandomTestCase(int i){

		TestCase *tc;
		/* Generate test cases using random input numbers */
			tc = new TestCase(this); // TODO free all this memory when exiting TestBench
			/* Fill inputs */
			for (unsigned int j = 0; j < ioList_.size(); j++) {
				Signal* s = ioList_[j]; 
				if (s->type() == Signal::in) {
					// ****** Modification: positive normal numbers with small exponents 
					mpz_class m = getLargeRandom(wF);
					mpz_class bias = (mpz_class(1)<<(wE-1)) - 1; 
					mpz_class e = getLargeRandom(wE-2) - (mpz_class(1)<<(wE-3)) + bias; // ensure no overflow
					mpz_class a = (mpz_class(1)<<(wE+wF+1)) // 01 to denote a normal number
						+ (e<<wF) + m;
					tc->addInput(s->getName(), a);
				}
			}
			/* Get correct outputs */
			emulate(tc);

			//		cout << tc->getInputVHDL();
			//    cout << tc->getExpectedOutputVHDL();

			return tc;
	}
예제 #2
0
int main( void ) {
	
	s1.setParameters( 3,2 );
	
	WRITE(2,&qfin);
	WRITE(2,&qfin);
	WRITE(2,&qfin);
	WRITE(3,&qfin2);	

	READ(3,qfout); // No data available yet
	READ(4,qfout);
	DUMP();
	READ(4,qfout);
	READ(4,qfout);
	
	cout << "Value QFOUT: " << (*qfout) << endl;
	
	READ(5,qfout);
	
	cout << "Value QFOUT: " << (*qfout) << endl;

	WRITE(7,&qfin); // READ in  9
	WRITE(8,&qfin); // READ in 10
	
	//DUMP();


	cout << "Name: \"" << s1.getName() << "\"" << endl;
	cout << "Bandwidth: " << s1.getBandwidth() << endl;
	cout << "Latency: " << s1.getLatency() << endl;

	return 0;
}
예제 #3
0
std::string  Operator::getClkName() {
    int size = getIOListSize();
    for (int i = 0; i<size; i++) {
      Signal *s = getIOListSignal(i);
      if (s->isClk() == 1) { 
        return s->getName();
      }
    }
    return "";
}