?? bistpimseqonlinefull_1.java~
字號(hào):
{
MealyFSMNode currNode = stateEnterNodes[ sl ];
BitSet[] TP = ( BitSet[] ) shuffledTPS.get( currNode );
CircuitState currState = ( CircuitState ) circuitStates.get( currNode );
// 3.2 Under each fault
faultModel.reset();
while( faultModel.hasMoreElements() )
{
java.awt.Point currFault = ( java.awt.Point ) faultModel.nextElement();
if( used[ currFault.x ] ) // Skipping faults in unused elements.
{
//TI//longStory += "\nChecking transitions from state " + sl + " under fault " + currFault + " node is " + currNode;
Vector stateFaultKey = new Vector();
stateFaultKey.add( currNode );
stateFaultKey.add( currFault );
int[] eBehaviour = ( int[] ) EBehaviour.get( stateFaultKey );
for( int itpl = 0; itpl < eBehaviour.length; itpl++ )
{
switch( eBehaviour[ itpl ] )
{
case E_LOW_ERROR:
incorrectTransitions++; break;
case E_HIGH:
break;
case E_LOW_OK:
{
//TI//longStory += "\nInput Pattern " + itpl + " was E_LOW_OK";
// 1. Restore state & Set Fault
circuit.setState( currState );
circuit.setFault( currFault );
// 2. Clock in the input for which E was low to force state transition
int nrInputs = TP.length;
SampleData[] clockInWithCurrInput = new SampleData[ nrInputs ];
for( int il = 0; il < nrInputs; il++ )
{
clockInWithCurrInput[ il ] = new SampleData( inputSampleSeparation, 2 );
}
int currInputPattern = ESLib.getLine( TP, itpl );
ESLib.setLine( clockInWithCurrInput, 0, currInputPattern );
ESLib.setLine( clockInWithCurrInput, 1, currInputPattern + 1 ); // with clock high
SampleData[] transitionQ = circuit.run( clockInWithCurrInput ); // should now be at next state
circuit.removeFault( currFault );
//TI//longStory += "\nJust ran" + ESLib.sampleDatasToString( clockInWithCurrInput, temp );
if( !BISTLib.getE( transitionQ, eSize, nrEs, inputSampleSeparation, startAt ) )
{
// 3. Test to see if we have really moved to this new state
MealyFSMNode nextNode = currNode.nextStates[ currInputPattern / 2 ].dest;
BitSet[] TPNS = ( BitSet[] ) shuffledTPS.get( nextNode );
SampleData[] TPQNS = ( SampleData[] ) TPQS.get( nextNode );
SampleData[] nextTPS = ExperimentLib.generateInputFromTest( TPNS, 1, TPNS[ 0 ].length(), inputSampleSeparation );
int nrInputCombinations = nextTPS[ 0 ].length();
SampleData[] TPQNS2 = circuit.run( nextTPS );
int[] nextEBehaviour = new int[ nrInputCombinations ];
int correctDiagnoses = countDiagnoses( TPQNS, TPQNS2, nextEBehaviour );
if( correctDiagnoses < nrInputCombinations )
{
incorrectTransitions++;
//TI//longStory += "\nBad transition at state " + sl + " fault " + currFault + " ins " + currInputPattern;
//TI//shortStory += "\nBad transition at state " + sl + " fault " + currFault + " ins " + currInputPattern;
//TI//longStory += "\nQ vs Q2\n " + ESLib.sampleDatasToString( TPQNS, TPQNS2 );
}
} // end if E low
} // end case LOW_OK
} // end switch
} // end for input patterns of e behaviour
} // end if fault used
} // end while fault loop
} // end for state loop
f_b_t = 1d / ( incorrectTransitions / 50d + 1d );
} // end F_B_T if
}
ind.setProperty( 0, new Double( f_b ) );
ind.setProperty( 1, new Double( f_b_t ) );
houseWork( ind, f_e );
double[] rv = { f_e };
return rv;
}
protected int countDiagnoses( SampleData[] currStateQs, SampleData[] currStateFaultQs, int[] eBehaviour )
{
int rv = 0;
/*
int patternLength = currStateQs[ 0 ].length();
int patternBlocks = patternLength / inputSampleSeparation;
**/
int patternBlocks = eBehaviour.length;
for( int pl = 0; pl < patternBlocks; pl++ )
{
if( getE( currStateFaultQs, pl ) )
{
rv++; // Assume overdetecting OK
eBehaviour[ pl ] = E_HIGH;
}else
{
// Outputs should be the same
if( getEqual( currStateQs, currStateFaultQs, pl ) )
{
rv++;
eBehaviour[ pl ] = E_LOW_OK;
}else
{
eBehaviour[ pl ] = E_LOW_ERROR;
}
}
}
return rv;
}
protected boolean getEqual( SampleData[] currStateQs, SampleData[] currStateFaultQs, int blockNum )
{
int DQ = 0;
int idl = blockNum;
for( int odl = startAt; odl < inputSampleSeparation; odl++ )
{
boolean currLineWrong = false;
for( int ql = 0; ql < currStateQs.length - 1; ql++ )
{
if( currStateQs[ ql ].get( idl * inputSampleSeparation + odl )
!= currStateFaultQs[ ql ].get( idl * inputSampleSeparation + odl )
)
{
currLineWrong = true;
}
}
if( currLineWrong )
{
DQ++;
if( DQ == DQTol )
{
return false;
}
}
}
return true;
}
protected boolean getE( SampleData[] output, int blockNum )
{
SampleData E = output[ output.length - 1 ];
int conc = 0;
int idl = blockNum;
for( int odl = startAt; odl < inputSampleSeparation; odl++ )
{
if( E.get( idl * inputSampleSeparation + odl ) )
{
conc++;
if( conc == eSize )
{
return true;
}
}else
{
conc = 0;
}
}
return false;
}
/** Returns the value of E for this segment */
protected boolean getE( SampleData[] output )
{
SampleData E = output[ output.length - 1 ];
int outLen = E.length();
int inputCycles = outLen / inputSampleSeparation;
for( int idl = inputResetLength; idl < inputCycles; idl++ )
{
int conc = 0;
for( int odl = startAt; odl < inputSampleSeparation; odl++ )
{
if( E.get( idl * inputSampleSeparation + odl ) )
{
conc++;
if( conc == eSize )
{
return true;
}
}else
{
conc = 0;
}
}
}
return false;
}
public String toString()
{
String narrator = "BIST Sequential Online Full Test Interaction Model with:";
narrator += "\n Threshold = " + threshold;
narrator += "\n Error Line Start At = " + startAt;
narrator += "\n Error High Minimum Size = " + eSize;
narrator += "\n Input Reset Pattern Length = " + inputResetLength;
narrator += "\n Fault Model: " + faultModel;
narrator += "\n\nExperiment: " + experiment;
narrator += "\n\nDeployment: " + deployment;
narrator += "\n\nEvolver: " + evolver;
narrator += "\n";
return narrator;
}
// Snapshot so far does normal thing
protected boolean[] getUsed( int outs )
{
SimulatorLogicElement[] els = circuit.getElements();
boolean[] rv = new boolean[ els.length ];
for( int ol = 0; ol < outs; ol++ )
{
addConnectedGates( rv, els[ ol ], els );
}
return rv;
}
protected void addConnectedGates( boolean[] added, SimulatorLogicElement el, SimulatorLogicElement[] els )
{
int elinels = jaga.ESLib.indexOf( el, els );
if( elinels >= 0 && !added[ elinels ] )
{
added[ elinels ] = true;
SimulatorLogicElement[] ins = el.getInputs();
if( ins != null )
{
for( int il = 0; il < ins.length; il++ )
{
addConnectedGates( added, ins[ il ], els );
}
}
}
}
public Genotype getMaxFitness()
{
Genotype rv = super.getMaxFitness();
rv.setProperty( 0, new Double( 1 ) );
rv.setProperty( 1, new Double( 1 ) );
return rv;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -