本文整理汇总了C++中Signal::type方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::type方法的具体用法?C++ Signal::type怎么用?C++ Signal::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestCase
// 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: inPortMap
void Operator::inPortMap(Operator* op, string componentPortName, string actualSignalName) throw(std::string) {
Signal* formal;
ostringstream e;
string name;
e << "ERROR in inPortMap(), "; // just in case
if(isSequential()) {
Signal *s;
try {
s=getSignalByName(actualSignalName);
}
catch (string e2) {
e << endl << tab << e2;
throw e.str();
}
if(s->getCycle() < 0) {
ostringstream e;
e << "signal " << actualSignalName<< " doesn't have (yet?) a valid cycle";
throw e.str();
}
if(s->getCycle() > currentCycle_) {
ostringstream e;
e << "active cycle of signal " << actualSignalName<< " is later than current cycle, cannot delay it";
throw e.str();
}
// update the lifeSpan of s
s->updateLifeSpan( currentCycle_ - s->getCycle() );
name = s->delayedName( currentCycle_ - s->getCycle() );
}
else
name = actualSignalName;
try {
formal=op->getSignalByName(componentPortName);
}
catch (string e2) {
e << endl << tab << e2;
throw e.str();
}
if (formal->type()!=Signal::in){
e << "signal " << componentPortName << " of component " << op->getName()
<< " doesn't seem to be an input port";
throw e.str();
}
// add the mapping to the mapping list of Op
op->portMap_[componentPortName] = name;
}
示例3: inPortMapCst
void Operator::inPortMapCst(Operator* op, string componentPortName, string actualSignal) throw(std::string) {
Signal* formal;
ostringstream e;
string name;
e << "ERROR in inPortMap(), "; // just in case
try {
formal=op->getSignalByName(componentPortName);
}
catch (string e2) {
e << endl << tab << e2;
throw e.str();
}
if (formal->type()!=Signal::in){
e << "signal " << componentPortName << " of component " << op->getName()
<< " doesn't seem to be an input port";
throw e.str();
}
// add the mapping to the mapping list of Op
op->portMap_[componentPortName] = actualSignal;
}
示例4: outPortMap
void Operator::outPortMap(Operator* op, string componentPortName, string actualSignalName) throw(std::string) {
Signal* formal;
Signal* s;
ostringstream e;
e << "ERROR in outPortMap(), "; // just in case
// check the signals doesn't already exist
if(signalMap_.find(actualSignalName) != signalMap_.end()) {
e << "signal " << actualSignalName << " already exists";
throw e.str();
}
try {
formal=op->getSignalByName(componentPortName);
}
catch (string e2) {
e << endl << tab << e2;
throw e.str();
}
if (formal->type()!=Signal::out){
e << "signal " << componentPortName << " of component " << op->getName()
<< " doesn't seem to be an output port";
throw e.str();
}
int width = formal -> width();
bool isbus = formal -> isBus();
// construct the signal (lifeSpan and cycle are reset to 0 by the constructor)
s = new Signal(actualSignalName, Signal::wire, width, isbus);
// define its cycle
if(isSequential())
s->setCycle( this->currentCycle_ + op->getPipelineDepth() );
// add the signal to signalMap and signalList
signalList_.push_back(s);
signalMap_[actualSignalName] = s ;
// add the mapping to the mapping list of Op
op->portMap_[componentPortName] = actualSignalName;
}