Пример #1
0
void myPlacement::getInstsOfNet(myNet* net, vector<Inst*>& insts){
	vector<InstTerm> terms = net->getTerms();
	insts.clear();
	insts.push_back(getInst(terms[0]));
	long index1, index2;
	for (long i = 1; i < terms.size(); ++i){
		index1 = terms[i-1].getIndexInst();
		index2 = terms[i].getIndexInst();
		if (index1 != index2){
			insts.push_back(getInst(terms[i]));
		}
	}
	long numPins = net->getNumTerms();
	return;
}
Пример #2
0
FileLogger* FileLogger::getInst(void)
{
    if(s_inst == NULL)
        s_inst = getInst(s_defaultFile);

    return s_inst;
}
Пример #3
0
// Get bytes representing sped up/slowed down sound and put up to lenBytes
// into ret.
// Returns number of bytes read, or -1 if we run out of memory.
jint Java_org_vinuxproject_sonic_Sonic_receiveBytesNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jbyteArray ret,
    jint lenBytes)
{
    sonicInst inst = getInst(sonicID);
    sonicStream stream = inst->stream;
    int available = sonicSamplesAvailable(stream)*sizeof(short)*sonicGetNumChannels(stream);
    int samplesRead, bytesRead;

    LOGV("Reading %d bytes from stream", lenBytes);
    if(lenBytes > available) {
        lenBytes = available;
    }
    if(lenBytes > inst->byteBufSize*sizeof(short)) {
        inst->byteBufSize = lenBytes*(2/sizeof(short));
        inst->byteBuf = (short *)realloc(inst->byteBuf, inst->byteBufSize*sizeof(short));
        if(inst->byteBuf == NULL) {
            return -1;
        }
    }
    //LOGV("Doing read %d", lenBytes);
    samplesRead = sonicReadShortFromStream(stream, inst->byteBuf,
	lenBytes/(sizeof(short)*sonicGetNumChannels(stream)));
    bytesRead = samplesRead*sizeof(short)*sonicGetNumChannels(stream); 
    //LOGV("Returning %d", samplesRead);
    (*env)->SetByteArrayRegion(env, ret, 0, bytesRead, (jbyte *)inst->byteBuf);
    return bytesRead;
}
Пример #4
0
Instruction* Basic_block::get_first_instruction(){
  if(_firstInst==NULL){
      _firstInst= getInst(this->get_first_line_instruction());
      this->link_instructions();
  }
   return _firstInst;
}
Пример #5
0
bool Basic_block::is_delayed_slot(Instruction *i){
   if (get_branch()== NULL)
      return false;
   int j = (getInst(get_branch()))->get_index();
   return (j < i-> get_index());

}
Пример #6
0
myPoint myPlacement::getOrigin(InstTerm& it) {
	Inst* inst = getInst(it);
	long cx = inst->getCenterX();
	long cy = inst->getCenterY();
	long ox = it.getOffsetX();
	long oy = it.getOffsetY();

	switch(inst->getOrient()){
	case kR0:
		return myPoint(cx + ox, cy + oy);
	case kR90:
		return myPoint(cx + oy, cy - ox);
	case kR180:
		return myPoint(cx - ox, cy - oy);
	case kR270:
		return myPoint(cx - oy, cy + ox);
	case kMY:
		return myPoint(cx - ox, cy + oy);
	case kMYR90:
		return myPoint(cx + oy, cy + ox);
	case kMX:
		return myPoint(cx + ox, cy - oy);
	case kMXR90:
		return myPoint(cx - oy, cy - ox);
	default:
		cout<<"unknown orientation!!!"<<endl;
		return myPoint(0,0);
	}

	return myPoint(cx, cy);
}
Пример #7
0
/* Put bytes into the input buffer of the sound alteration object
   lenBytes bytes will be read from buffer into the sound alteration object
   buffer is not guaranteed not to change after this function is called,
   so data should be copied from it */
jboolean Java_org_vinuxproject_sonic_Sonic_putBytesNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jbyteArray buffer,
    jint lenBytes)
{
    sonicInst inst = getInst(sonicID);
    sonicStream stream = inst->stream;
    int samples = lenBytes/(sizeof(short)*sonicGetNumChannels(stream));
    int remainingBytes = lenBytes - samples*sizeof(short)*sonicGetNumChannels(stream);

if(remainingBytes != 0) {
    LOGV("Remaining bytes == %d!!!", remainingBytes);
}
    if(lenBytes > inst->byteBufSize*sizeof(short)) {
        inst->byteBufSize = lenBytes*(2/sizeof(short));
        inst->byteBuf = (short *)realloc(inst->byteBuf, inst->byteBufSize*sizeof(short));
        if(inst->byteBuf == NULL) {
            return 0;
        }
    }
    LOGV("Writing %d bytes to stream", lenBytes);
    (*env)->GetByteArrayRegion(env, buffer, 0, lenBytes, (jbyte *)inst->byteBuf);
    return sonicWriteShortToStream(stream, inst->byteBuf, samples);
}
Пример #8
0
myPoint myPlacement::getOrigin(InstTerm* it) {
	Inst* inst = getInst(it);
	long cx = inst->getCenterX();
	long cy = inst->getCenterY();
	long ox = it->getOffsetX();
	long oy = it->getOffsetY();
	return myPoint(cx + ox, cy + oy);
}
Пример #9
0
// Get the current number of channels.
jint Java_org_vinuxproject_sonic_Sonic_getNumChannelsNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Reading num channels");
    return sonicGetNumChannels(stream);
}
Пример #10
0
// Get the current chord pitch setting.
jboolean Java_org_vinuxproject_sonic_Sonic_getChordPitchNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Reading chord pitch");
    return sonicGetChordPitch(stream);
}
Пример #11
0
// Get the current volume.
jfloat Java_org_vinuxproject_sonic_Sonic_getVolumeNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Reading volume");
    return sonicGetVolume(stream);
}
Пример #12
0
// Process any samples still in a sonic buffer.
void Java_org_vinuxproject_sonic_Sonic_flushNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Flushing stream");
    sonicFlushStream(stream);
}
Пример #13
0
// Get the current sample rate.
jint Java_org_vinuxproject_sonic_Sonic_getSampleRateNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Reading sample rate");
    return sonicGetSampleRate(stream);
}
Пример #14
0
void Logging::log (int ignore, ...)
{
    Logging *inst = getInst ();
    va_list vl;

    va_start (vl, ignore);
    inst->logIt (ignore, vl);
    va_end (vl);
}
Пример #15
0
// Returns the number of bytes that can be read from the speed alteration
// object
jint Java_org_vinuxproject_sonic_Sonic_availableBytesNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Reading samples available = %d", sonicSamplesAvailable(stream)*sizeof(short)*sonicGetNumChannels(stream));

    return sonicSamplesAvailable(stream)*sizeof(short)*sonicGetNumChannels(stream);
}
Пример #16
0
// Set the number of channels.
void Java_org_vinuxproject_sonic_Sonic_setNumChannelsNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jint newNumChannels)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Set sample rate to %d", newNumChannels);
    sonicSetNumChannels(stream, newNumChannels);
}
Пример #17
0
// Change the speed.
void Java_org_vinuxproject_sonic_Sonic_setSpeedNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jfloat newSpeed)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Set speed to %f", newSpeed);
    sonicSetSpeed(stream, newSpeed);
}
Пример #18
0
// Change the volume.
void Java_org_vinuxproject_sonic_Sonic_setVolumeNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jfloat newVolume)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Set volume to %f", newVolume);
    sonicSetVolume(stream, newVolume);
}
Пример #19
0
// Set chord pitch mode on or off.  Default is off.
void Java_org_vinuxproject_sonic_Sonic_setChordPitchNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jboolean useChordPitch)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Set chord pitch to %d", useChordPitch);
    sonicSetChordPitch(stream, useChordPitch);
}
Пример #20
0
// Set pitch in sound alteration object
void Java_org_vinuxproject_sonic_Sonic_setPitchNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID,
    jfloat newPitch)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Set pitch to %f", newPitch);
    sonicSetPitch(stream, newPitch);
}
Пример #21
0
/* remplit le champ derniere instruction du bloc (_lastInst) */
void Basic_block::link_instructions(){

   int index=0;
   Line *current, *next;
   current=get_first_line_instruction();
   next=current->get_next();

   Instruction *i1 = getInst(current);

   i1->set_index(index);
   index++;
   Instruction *i2;
   
//Calcul des successeurs
   while(current != _end){
   
      while(!next->isInst()){
	 next=next->get_next();
	 if(next==_end){
	    if(next->isInst())
	       break;
	    else{
	       _lastInst = i1;
	       _nb_instr = index;
	       return;
	    }
	 }
      }
      
      i2 = getInst(next);
      i2->set_index(index);
      index++;
      i1->set_link_succ_pred(i2);
      
      i1=i2;
      current=next;
      next=next->get_next();
   }
   _lastInst = i1;
   _nb_instr = index;
}
Пример #22
0
// Teardown the C data structure.
void Java_org_vinuxproject_sonic_Sonic_closeNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicInst inst = getInst(sonicID);
    sonicStream stream = inst->stream;

    LOGV("Destroying stream");
    sonicDestroyStream(stream);
    free(inst->byteBuf);
    free(inst);
}
Пример #23
0
void SEScene::destroy(unsigned id) {
	SEGameObject *pInst = getInst(id);
#ifdef SE_DEBUG
	if (!pInst) {
		SE_LogManager.append(se_debug::LOGTYPE_ERROR,
			"Game instance can't be found, nothing was destroyed.");
		return;
	}
#endif
	if ((*pInst)[COM_CAMERA]) cameras.erase(static_cast<SEComCamera*>((*pInst)[COM_CAMERA]));
	if ((*pInst)[COM_COLLIDER]) colliders.erase(static_cast<SEComCollider*>((*pInst)[COM_COLLIDER]));
	if (pInst->getCompNum() > COM_NUM) {
		for (int i = COM_NUM; i < pInst->getCompNum(); ++i) {
			if ((*pInst)[i]->getType() == COM_LISTENER)
				listeners.erase(static_cast<SEComListener*>((*pInst)[i]));
		}
	}
	delete pInst;

	gameInsts.erase(idMaps[id]);
	idBase.push_back(id);
	idMaps.erase(id);
}
Пример #24
0
void DInst::killSilently()
{
  I(getPendEvent()==0);
  I(getResource()==0);

#ifdef SESC_BAAD
  if (fetch2Time == 0) {
    fetch1QSize--;
  }else if (renameTime == 0) {
    fetch2QSize--;
  }else if (issueTime == 0) {
    issueQSize--;
  }else if (schedTime == 0) {
    schedQSize--;
  }else if (exeTime == 0) {
    exeQSize--;
  }else{
    retireQSize--;
  }
#endif

  markIssued();
  markExecuted();
  if( getFetch() ) {
    getFetch()->unBlockFetch();
    IS(setFetch(0));
  }

  if (getInst()->isStore())
    LDSTBuffer::storeLocallyPerformed(this);
 
  while (hasPending()) {
    DInst *dstReady = getNextPending();

    if (!dstReady->isIssued()) {
      // Accross processor dependence
      if (dstReady->hasDepsAtRetire())
        dstReady->clearDepsAtRetire();
      
      I(!dstReady->hasDeps());
      continue;
    }
    if (dstReady->isExecuted()) {
      // The instruction got executed even though it has dependences. This is
      // because the instruction got silently killed (killSilently)
      if (!dstReady->hasDeps())
        dstReady->scrap();
      continue;
    }

    if (!dstReady->hasDeps()) {
      I(dstReady->isIssued());
      I(!dstReady->isExecuted());
      Resource *dstRes = dstReady->getResource();
      I(dstRes);
      dstRes->simTime(dstReady);
    }
  }

#ifdef TASKSCALAR
  notifyDataDepViolation(DataDepViolationAtRetire);

  if (lvid) { // maybe got killSilently
    lvid = 0;
    lvidVersion->decOutsReqs();
    lvidVersion->garbageCollect();
    IS(lvidVersion=0);
  }
  
  I(lvidVersion==0);
#endif

  I(!getFetch());

  if (hasDeps())
    return;
  
  I(nDeps == 0);   // No deps src

#if (defined TLS)
  I(!myEpoch);
#endif

  I(!getFetch());
#if (defined MIPS_EMUL)
  context->delDInst();
  context=0;
#endif
  dInstPool.in(this); 
}