const bool V3Ntk::setBddOrder(V3NtkHandler* const handler, const bool& file) const { unsigned supportSize = getInputSize() + getInoutSize() + 2*getLatchSize(); if(supportSize >= bddMgrV->getNumSupports()) { Msg(MSG_ERR) << "BDD Support Size is Smaller Than Current Design Required !!" << endl; return false; } // build support unsigned supportId = 1; for(unsigned i = 0, n = getInputSize(); i < n; ++i) { const V3NetId& nId = (file)? getInput(i) : getInput(n-i-1); bddMgrV->addBddNodeV(nId.id, bddMgrV->getSupport(supportId)()); bddMgrV->addBddNodeV(handler->getNetNameOrFormedWithId(nId), bddMgrV->getSupport(supportId)()); ++supportId; } for(unsigned i = 0, n = getInoutSize(); i < n; ++i) { const V3NetId& nId = (file)? getInout(i) : getInout(n-i-1); bddMgrV->addBddNodeV(nId.id, bddMgrV->getSupport(supportId)()); bddMgrV->addBddNodeV(handler->getNetNameOrFormedWithId(nId), bddMgrV->getSupport(supportId)()); ++supportId; } for(unsigned i = 0, n = getLatchSize(); i < n; ++i) { const V3NetId& nId = (file)? getLatch(i) : getLatch(n-i-1); bddMgrV->addBddNodeV(nId.id, bddMgrV->getSupport(supportId)()); bddMgrV->addBddNodeV(handler->getNetNameOrFormedWithId(nId), bddMgrV->getSupport(supportId)()); ++supportId; } // Next State for(unsigned i = 0, n = getLatchSize(); i < n; ++i) { const V3NetId& nId = (file)? getLatch(i) : getLatch(n-i-1); bddMgrV->addBddNodeV(handler->getNetNameOrFormedWithId(nId)+"_ns", bddMgrV->getSupport(supportId)()); ++supportId; } // Constants for (uint32_t i = 0; i < getConstSize(); ++i) { assert(getGateType(getConst(i)) == AIG_FALSE); bddMgrV->addBddNodeV(getConst(i).id, BddNodeV::_zero()); } return true; }
bool cpptype::operator==(cpptype rhs) { if(getConst() == rhs.getConst()) { std::string lhss, rhss; for(int i = 0; i < qual_list.size(); ++i) lhss += qual_list[i]; for(int i = 0; i < rhs.qual_list.size(); ++i) rhss += rhs.qual_list[i]; if(lhss == rhss) return true; } return false; }
int main(void){ system("clear"); printf("Programa que calcula el área bajo la curva (1/(σ sqrt(2π)))e^((-1/2)((x-µ)/σ)))² por el método rectangular.\n\n"); int sh=0; char opc='\0'; double sigma=-1; // σ double mu=0.0; //µ double c1;// constante que acompaña a la integral double auxa=0,auxb=0,a=0,b=0; //límites de integración double areaBajoCurva=0.0; long int iteraciones=300;//Númerod e iteraciones por defecto double x,iteracionesaux=0; do{ fflush( stdin );fflush( stdin );fflush( stdin ); puts ("Constantes: \nIngrese el valor de σ:"); while(sigma<=0){ getConst(&sigma,&sh); if(sigma==0)printf("No puedo hacer eso, ya que haré el cálculo:\n (1/(σ sqrt(2π))) y si σ=0 eso se indetermina. Intenta con otro número: \n "); if(sigma<0.0)printf("Sigma debe ser estrictamente mayor que 0 \n "); } puts("Ingrese el valor de µ:"); getConst(&mu,&sh); while(auxa==auxb){ puts("Límites de integración:\nCalcular área desde (ingrese el valor de a):"); getConst(&auxa,&sh); printf("Hasta (ingrese el valor de b):"); getConst(&auxb,&sh); if(auxb>auxa) { a=auxa; b=auxb; }else if(auxa>auxb){ printf("Parece que tus límites están en el orden incorrecto, a debe ser menor a b por definición, pero puedo manejarlo, invirtiendo..\n"); b=auxa; a=auxb; } else{ printf("Eh!, ahí no hay área!, escribe límites de integración que no sean iguales...Va de nuevo:\n"); } } x=a; printf("Calculando área con σ=%2.2f,µ=%2.2f,a=%2.2f,b=%2.2f\n ",sigma,mu,a,b); double base=(b-a)/iteraciones; c1=1/(sigma*(sqrt(2*pi))); double ev; for(int i=1;i<=iteraciones;i++){ ev=evalInt(x,mu,sigma); areaBajoCurva=areaBajoCurva+((c1)*(ev)*(base)); //printf("[%f] x=%f",ev,x); x=x+base; } printf("Area bajo (1/(σ sqrt(2π)))e^((-1/2)((x-µ)/σ)))²:[%f]\n\n\n ",areaBajoCurva); printf("Detalles:\n Calculé el área desde: %2.2f hasta %2.2f\n ",a,b,iteraciones); printf("Otro Cálculo? S para si.\n"); //getchar(); scanf("%c",&opc); a=0; b=0; auxa=0; auxb=0; sigma=-1; getchar(); system("clear"); }while(opc=='S'||opc=='s'); }
uint32_t transfer(char **arguments, assembler *instState,table_t *t){ int P_Bit; char *Rd = arguments[0]; char *address = arguments[1]; uint32_t rd = getConst(Rd); int addrlen = strlen(address); if(*address == '='){ //numeric constant; int val = getConst(address); if(val <= 0xFF){ //mov instruction; isMov = 1; char **inst = malloc(sizeof(char*)*3); for(int i=0; i<3; i++){ inst[i] = malloc(sizeof(char)*20); } strcpy(inst[0],"mov"); strcpy(inst[1],Rd); strcpy(inst[2],(address+1)); inst[2] = prepend(inst[2],'#'); return ass_data_process(inst,t); }else{ strip(arguments[1]); insertExpression(instState->BigVals,arguments[1],val,instState->counter); rd <<= 12; uint32_t val_mask = 0xE59F0000; return val_mask | rd; } } char **splitAddress = tokeniser(address,","); if(address[0] == '[' && address[4] != ']' && address[3] != ']'){ //PRE instruction; P_Bit = 1; char *pre_address = removeBrackets(address); char **expression = tokeniser(pre_address,"."); uint32_t rn = getConst(expression[0]); uint32_t transfer_mask1 = 0xE5900000; uint32_t incVal = getConst(expression[1]); uint32_t offset = incVal; //TODO: ONCE MOV is fixed replace this with the val generated by mov rn <<= 16; rd <<= 12; return transfer_mask1 | rn | rd | offset; }else if(addrlen <= 5){ //PRE instruction; P_Bit = 1; char *Rn = removeBrackets(splitAddress[0]); uint32_t rn = getConst(Rn); uint32_t transfer_mask2 = 0xE5900000; rn <<= 16; rd <<= 12; return transfer_mask2 | rn | rd; }else{ //Post instruction; P_Bit = 0; uint32_t transfer_mask3 = 0xE6900000; char **expression = tokeniser(address,"."); uint32_t rn = getConst(removeBrackets(expression[0])); uint32_t offset = getConst(expression[1]); rn <<= 16; rd <<= 12; return transfer_mask3 | rn | rd | offset; } }