Пример #1
0
void DMTC1(unsigned long word)
{	//05 (05)
    sprintf(dis_op, "dmtc1\t%s, %s", gpr_rn[getRT(word)], fpr_rn[getFD(word)]);
}
Пример #2
0
void CTC1(unsigned long word)
{		//06 (06)
    sprintf(dis_op, "ctc1\t%s, %s", gpr_rn[getRT(word)], fpr_rn[getFD(word)]);
}
Пример #3
0
void CFC1(unsigned long word)
{		//02 (02)
    sprintf(dis_op, "cfc1\t%s, %s", gpr_rn[getRT(word)], fpr_rn[getFD(word)]);
}
Пример #4
0
void MTC1(unsigned long word)
{		//04 (04)
    sprintf(dis_op, "mtc1\t%s, %s", gpr_rn[getRT(word)], fpr_rn[getFD(word)]);
}
Пример #5
0
void DMFC1(unsigned long word)
{	//01 (01)
    sprintf(dis_op, "dmfc1\t%s, %s", gpr_rn[getRT(word)], fpr_rn[getFD(word)]);
}
Пример #6
0
void MFC1(unsigned long word)
{		//00 (00)
    sprintf(dis_op, "mfc1\t%s, %s", gpr_rn[getRT(word)], fpr_rn[getFD(word)]);
}
Пример #7
0
int main (void)
{
    //定义状态返回值
    uchar ret;

    uchar adCnt;
    uchar iCnt;
    //初始化发送地址
    for (adCnt = 0; adCnt < TX_ADR_WIDTH; adCnt ++)
        txAddr[adCnt] = TX_ADDRESS[adCnt];

    //初始化打印终端
    termialInit();
    //开启硬件接收中断
    ret = uartRxISR();
    if (!ret)
        printf ("Error: enable Rx ISR error!\n");
    //spi模块初始化
    spiInit();
    //输出logo
    logoPrint();

    while (1)
    {
        //进入命令模式(默认进入)
        if (mode == CMD_MODE)
        {
            //输出命令提示信息
            printCmdRe();
            //获取命令
            getCommand();
        }
        //进入正常模式
        else if (mode == NOMAL_MODE)
        {
            printf ("Enter NOMAL_MODE\n");
            //输出模式选择选项
            printRTRe();
            //等待接收选择的模式
            getRT();
        }
        //进入到数据发送模式
        else if (mode == TX_MODE)
        {
            //发送缓冲区中的数据
            if (txCnt != 0)
            {
                printf ("sendOne\n");
                nrfSend(txAddr, txBuf);
                txCnt = 0;
                for (iCnt = 0; iCnt < TX_PLOAD_WIDTH; iCnt ++)
                    txBuf[iCnt] = '\0';
            }
        }
        //进入到数据接收模式
        else if (mode == RX_MODE)
        {
            //printf ("Enter RX_MODE\n");
            //接收数据并放入到缓冲区rxBuf中
            nrfRecv(txAddr, rxBuf);
            //将rxBuf中的数据通过串口发送出去
            if (rxBuf[0] != '\0')
            {
                printf ("%s", rxBuf);
                for (iCnt = 0; iCnt < TX_PLOAD_WIDTH; iCnt++)
                    rxBuf[iCnt] = '\0';
            }
        }
        else
            printf ("ERROR: MODE SELECT ERROR!!!\n");
    }
    return 0;
}
Пример #8
0
void
InteractionEnergyVrna::
computeES( const Accessibility & acc, InteractionEnergyVrna::EsMatrix & esToFill )
{

	// prepare container
	esToFill.resize( acc.getSequence().size(), acc.getSequence().size() );

	// sequence length
	const int seqLength = (int)acc.getSequence().size();
	const E_type RT = getRT();

	// VRNA compatible data structures
	char * sequence = (char *) vrna_alloc(sizeof(char) * (seqLength + 1));
	char * structureConstraint = (char *) vrna_alloc(sizeof(char) * (seqLength + 1));
	for (int i=0; i<seqLength; i++) {
		// copy sequence
		sequence[i] = acc.getSequence().asString().at(i);
		// copy accessibility constraint if present
		structureConstraint[i] = acc.getAccConstraint().getVrnaDotBracket(i);
	}
	sequence[seqLength] = structureConstraint[seqLength] = '\0';
	// prepare folding data
	vrna_md_t curModel;
	vrna_md_copy( &curModel, &foldModel );
	// set maximal base pair span
	curModel.max_bp_span = acc.getAccConstraint().getMaxBpSpan();
	if (curModel.max_bp_span >= (int)acc.getSequence().size()) {
		curModel.max_bp_span = -1;
	}
	// TODO check if VRNA_OPTION_WINDOW reasonable to speedup
	vrna_fold_compound_t * foldData = vrna_fold_compound( sequence, &foldModel, VRNA_OPTION_PF);

	// Adding hard constraints from pseudo dot-bracket
	unsigned int constraint_options = VRNA_CONSTRAINT_DB_DEFAULT;
	// enforce constraints
	constraint_options |= VRNA_CONSTRAINT_DB_ENFORCE_BP;

	vrna_constraints_add( foldData, (const char *)structureConstraint, constraint_options);

    // compute correct partition function scaling via mfe
    FLT_OR_DBL min_free_energy = vrna_mfe( foldData, NULL );
    vrna_exp_params_rescale( foldData, &min_free_energy);

	// compute partition functions
	const float ensembleE = vrna_pf( foldData, NULL );

	if (foldData->exp_matrices == NULL) {
		throw std::runtime_error("AccessibilityVrna::computeES() : partition functions after computation not available");
	}
	if (foldData->exp_matrices->qm == NULL) {
		throw std::runtime_error("AccessibilityVrna::computeES() : partition functions Qm after computation not available");
	}
	// copy ensemble energies of multi loop parts = ES values
	FLT_OR_DBL qm_val = 0.0;
	const int minLoopSubseqLength = foldModel.min_loop_size + 2;
	for (int i=0; i<seqLength; i++) {
		for (int j=i; j<seqLength; j++) {
			// check if too short to enable a base pair
			if (j-i+1 < minLoopSubseqLength) {
				// make unfavorable
				esToFill(i,j) = E_INF;
			} else {
				// get Qm value
				// indexing via iindx starts with 1 instead of 0
				qm_val = foldData->exp_matrices->qm[foldData->iindx[i+1]-j+1];
				if ( E_equal(qm_val, 0.) ) {
					esToFill(i,j) = E_INF;
				} else {
					// ES energy = -RT*log( Qm )
					esToFill(i,j) =  (E_type)( - RT*( std::log(qm_val)
													+((FLT_OR_DBL)(j-i+1))*std::log(foldData->exp_params->pf_scale)));
				}
			}
		}
	}
	// garbage collection
	vrna_fold_compound_free(foldData);
	free(structureConstraint);
	free(sequence);

}
Пример #9
0
/* Very hackish way to get arguments for function calls. It'll work for now */
void mips_EvalWord(unsigned int * words, int pos)
{
	unsigned int word = flip32(words[pos]), CalcAddr;
	int i, imm;
	for(i=0;i<SpecialOpCount;i++){
		if((word & SpecialOps[i].mask) == SpecialOps[i].Op){
			if(!(word & 0xFC000000))	//R type ops
				regs[getRD(word)] = SpecialOps[i].Value;
			else
				regs[getRT(word)] = SpecialOps[i].Value;
			return;
		}
	}
	switch((word >> 26) & 0x3F)
	{
	case MIPS_OP_JAL:
	{
		/* delay slot */
		mips_EvalWord( words, pos+1);

		/* report function */
		mips_ReportFunc( getTARGET(word) );

		/* clear registers */
		clearregs:
		regs[1] = 0;
		regs[2] = 0;
		regs[3] = 0;
		regs[4] = 0;
		regs[5] = 0;
		regs[6] = 0;
		regs[7] = 0;
		regs[8] = 0;
		regs[9] = 0;
		regs[10] = 0;
		regs[11] = 0;
		regs[12] = 0;
		regs[13] = 0;
		regs[14] = 0;
		regs[15] = 0;
		regs[24] = 0;
		regs[25] = 0;
		regs[26] = 0;
		regs[27] = 0;
		break;
	}
	case MIPS_OP_ADDIU:
		imm = getIMM(word);
		if(imm & 0x8000){
			imm |= 0xFFFF0000;
		}
		regs[getRT(word)] = regs[getRS(word)] + imm;
		if(getRT(word) == getRS(word) && getRT(word) == MIPS_REG_SP){
			stack_pos += (signed short)imm;
		}
		break;
	case MIPS_OP_LUI:
		regs[getRT(word)] = getIMM(word)<<16;
		break;
	case MIPS_OP_ORI:
		regs[getRT(word)] = regs[getRS(word)] | getIMM(word);
		break;
	case MIPS_OP_SW:
		if(getRS(word) == MIPS_REG_SP){
			stack[stack_pos+getIMM(word)] = regs[getRT(word)];

		}
		break;
	case MIPS_OP_LW:
		imm = getIMM(word);
		if(imm & 0x8000){
			imm |= 0xFFFF0000;
		}
		CalcAddr = imm + regs[getRS(word)];
		if(getRS(word) == MIPS_REG_SP){
			regs[getRT(word)] = stack[stack_pos+imm];
			break;
		}
		for(i=0; i<mipsRAMSetCount; i++){
			if(CalcAddr  > mipsRAM[i].Addr && mipsRAM[i].Size + mipsRAM[i].Addr > CalcAddr){
				regs[getRT(word)] = Read32(mipsRAM[i].Data, CalcAddr -mipsRAM[i].Addr );
				break;
			}
		}
		break;
	case MIPS_OP_TYPE_R:
	{
		switch (word & 0x3F)
		{
		case MIPS_ROP_SLL:
			regs[getRD(word)] = regs[getRT(word)] << getSA(word);
			break;
		case MIPS_ROP_SRA:
			regs[getRD(word)] = regs[getRT(word)] >> getSA(word);
			break;
		case MIPS_ROP_ADDU:
			regs[getRD(word)] = regs[getRT(word)] + regs[getRS(word)];
			break;
		case MIPS_ROP_JR:
			if(getRS(word) == mips_ra){
				goto clearregs;
			}
			break;
		}
	}
		break;
	}
}