?? evobist.java~
字號:
int nrAddCLBs = ( 1 << bitsPerVar ) - experiment.getNumOfInputs();
int lutSize = 1 << LUT_INPUTS;
int blockSize = lutSize + ( LUT_INPUTS + 1 ) * bitsPerAdd;
int qDefSize = ( experiment.getNumOfOutputs() + nrELines ) * bitsPerAdd;
int genotypeLength = qDefSize + nrAddCLBs * blockSize;
Genotype[] seeds = new Genotype[ POP_SIZE ];
seeds[ 0 ] = seed;
for( int pl = 0; pl < POP_SIZE; pl++ )
{ seeds[ pl ] = ( FullOrderGenotype ) seed.clone();
for( int bl = qDefSize + usedEls * blockSize; bl < seeds[ pl ].length(); bl++ )
if( Math.random() < 0.5 ) seeds[ pl ].set( bl );
}
int fixedAlignments = 0; int howManyBunches = 1;
//GeneticOperator m = new SAGAMutator( 1, genotypeLength / 50, 0, fixedAlignments * blockSize, -1 );
ExactGenotypeMutator m = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator spxo = new SinglePointXOver();
GeneticOperator bmin0 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize, fixedAlignments, qDefSize );
GeneticOperator bmin1 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + bitsPerAdd, fixedAlignments, qDefSize );
GeneticOperator bmin2 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + 2 * bitsPerAdd, fixedAlignments, qDefSize );
GeneticOperator bmin3 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + 3 * bitsPerAdd, fixedAlignments, qDefSize );
GeneticOperator bc = new BlockCopy ( blockSize, blockSize, 0, fixedAlignments, qDefSize );
GeneticOperator[] geneticOps ={ m, spxo, bmin0, bmin1, bmin2, bmin3, bc };
double[] opsProbs = { 0.3, 0.2, 0.1, 0.1 , 0.1 , 0.1 , 0.1 };
Selector selector = new RankSelector( );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, seeds );
PopulationLogReader.fullOrderGenotypes = true;
int nrEvals = 5; boolean overdetecting = true;
CircuitPainterObject painter = new CircuitPainterObject( new CircuitPainter(), new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + nrELines, bitsPerVar, LUT_INPUTS, new ConstantDelayModel( 0 ) ) );
BISTPIMSeqOnlineFull inIm = new BISTPIMSeqOnlineFull( evolver, deployment, circuit, experiment, INPUT_SAMPLE_SEP, faultModel, eSize, DQTol, painter, startAt, time2Reset );
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps, nrEvals, NoisyPIM.AVERAGE );
double maxSize = nrAddCLBs * 2;
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit, maxSize );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
painter.setEvoTask( monica ); monica.setName( dirName );
taskQ.add( monica ); taskQNames.add( dirName ); taskQDescr.add( descr );
taskQBestIndID.add( new Integer( bestIndID ) );
int effort = (int) ( avgTPLen * INPUT_SAMPLE_SEP * nrEvals * ( usedEls * 1.5 ) * ( usedEls * 1.5 * 2 ) / 1000000 );
taskQEffort.add( new Integer( effort ) );
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
ControlLib.writeWebGraphDaemon( dirName, logDir, logFileName, 3, false, new File(".").getCanonicalPath() + File.separator );
}
protected void addKISSL2BenchmarkLockedFull( String kissFileName, String sisOutputFileName, String resetStateName, String[][] inputs4ResetState, int[] permanentEdges, String dirName, String descr, int bestIndID, int avgTPLen ) throws IOException
{
int time2Reset = -1;
for( int pl = 0; pl < inputs4ResetState.length; pl++ )
{
time2Reset = Math.max( time2Reset, inputs4ResetState[ pl ].length );
}
final int INPUT_SAMPLE_SEP = 40; final int LUT_INPUTS = 2;
boolean generateClock = false; int cyclesPerSample = 1;
int nrELines = 1; boolean fpga = true; boolean voter = true;
FitnessFunction corrFF = new CorrelationFitnessFunction();
FitnessFunction tSetupFF = new SampleWindowFitnessFunction( corrFF, 20 );
KISSFSMExperiment inExp = new KISSFSMExperiment( new File( kissFileName ), resetStateName, inputs4ResetState, permanentEdges, generateClock, tSetupFF );
AddClockCSRIExperiment experiment = new AddClockCSRIExperiment( inExp, cyclesPerSample );
SisOutputReader sor = new SisOutputReader( new File( sisOutputFileName ), nrELines, LUT_INPUTS, fpga, voter );
FullOrderGenotype seed = new FullOrderGenotype ( sor.getGenotype() );
int bitsPerVar = sor.getBitsPerVar(); int usedEls = sor.getTotalEls();
int bitsPerAdd = bitsPerVar + 1;
final int POP_SIZE = 15; final int GENOTYPE_MUT = 1; final int NUM_OF_ELITES = 1;
int DUMP_POP_EVERY = 1000;
ElementDelayModel delayModel = new CoinDelayModel( );
CircuitMapping circuitMapping = new FaultyOptimizedMapping( new FPGALUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + nrELines, bitsPerVar, LUT_INPUTS, delayModel ) );
int DQTol = 5; int eSize = 14; int startAt = 25;
SimulatorFaultyCircuit circuit = new SimulatorFaultyCircuit( circuitMapping );
boolean alwaysResetBeforeRun = true;
SimulatorDeployment deployment = new SimulatorDeployment( circuit, alwaysResetBeforeRun );
SingleFaultModel faultModel = new SingleUsedFaultModel( circuit ); // Should take in whole circuit every time??
int nrAddCLBs = ( 1 << bitsPerVar ) - experiment.getNumOfInputs();
int lutSize = 1 << LUT_INPUTS;
int blockSize = lutSize + ( LUT_INPUTS + 1 ) * bitsPerAdd;
int qDefSize = ( experiment.getNumOfOutputs() + nrELines ) * bitsPerAdd;
int genotypeLength = qDefSize + nrAddCLBs * blockSize;
Genotype[] seeds = new Genotype[ POP_SIZE ];
seeds[ 0 ] = seed;
for( int pl = 0; pl < POP_SIZE; pl++ )
{ seeds[ pl ] = ( FullOrderGenotype ) seed.clone();
for( int bl = qDefSize + usedEls * blockSize; bl < seeds[ pl ].length(); bl++ )
if( Math.random() < 0.5 ) seeds[ pl ].set( bl );
}
int fixedAlignments = usedEls; int howManyBunches = 1;
//GeneticOperator m = new SAGAMutator( 1, genotypeLength / 50, 0, fixedAlignments * blockSize, -1 );
ExactGenotypeMutator m = new ExactGenotypeMutator( GENOTYPE_MUT );
m.setRange( qDefSize + fixedAlignments * blockSize, -1 );
GeneticOperator spxo = new SinglePointXOver();
GeneticOperator bmin0 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize, fixedAlignments, qDefSize );
GeneticOperator bmin1 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + bitsPerAdd, fixedAlignments, qDefSize );
//GeneticOperator bmin2 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + 2 * bitsPerAdd, fixedAlignments, qDefSize );
//GeneticOperator bmin3 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + 3 * bitsPerAdd, fixedAlignments, qDefSize );
GeneticOperator bc = new BlockCopy ( blockSize, blockSize, 0, fixedAlignments, qDefSize );
//GeneticOperator[] geneticOps ={ m, spxo, bmin0, bmin1, bmin2, bmin3, bc };
GeneticOperator[] geneticOps ={ m, spxo, bmin0, bmin1, bc };
double[] opsProbs = { 0.2, 0.2, 0.2, 0.2 , 0.2 };
//double[] opsProbs = { 0.2, 0.2, 0.1, 0.1 , 0.1 , 0.1 , 0.2 };
Selector selector = new RankSelector( );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, seeds );
PopulationLogReader.fullOrderGenotypes = true;
int nrEvals = 3; boolean overdetecting = true;
CircuitPainterObject painter = new CircuitPainterObject( new CircuitPainter(), new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + nrELines, bitsPerVar, LUT_INPUTS, new ConstantDelayModel( 0 ) ) );
BISTPIMSeqOnlineFull inIm = new BISTPIMSeqOnlineFull( evolver, deployment, circuit, experiment, INPUT_SAMPLE_SEP, faultModel, eSize, DQTol, painter, startAt, time2Reset );
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps, nrEvals, NoisyPIM.AVERAGE );
double maxSize = nrAddCLBs * 2;
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit, maxSize );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
painter.setEvoTask( monica ); monica.setName( dirName );
taskQ.add( monica ); taskQNames.add( dirName ); taskQDescr.add( descr );
taskQBestIndID.add( new Integer( bestIndID ) );
int effort = (int) ( avgTPLen * INPUT_SAMPLE_SEP * nrEvals * ( usedEls * 1.5 ) * ( usedEls * 1.5 * 2 ) / 1000000 );
taskQEffort.add( new Integer( effort ) );
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
ControlLib.writeWebGraphDaemon( dirName, logDir, logFileName, 3, false, new File(".").getCanonicalPath() + File.separator );
}
protected void addKISSBenchmarkLockedFull( String kissFileName, String sisOutputFileName, String resetStateName, String[][] inputs4ResetState, int[] permanentEdges, String dirName, String descr, int bestIndID, int avgTPLen ) throws IOException
{
int time2Reset = -1;
for( int pl = 0; pl < inputs4ResetState.length; pl++ )
{
time2Reset = Math.max( time2Reset, inputs4ResetState[ pl ].length );
}
final int INPUT_SAMPLE_SEP = 40; final int LUT_INPUTS = 2;
File kissFile = new File( kissFileName );
FitnessFunction corrFF = new CorrelationFitnessFunction();
FitnessFunction tSetupFF = new SampleWindowFitnessFunction( corrFF, 20 );
boolean generateClock = true; // ** ????????
KISSFSMExperiment experiment = new KISSFSMExperiment( kissFile, resetStateName, inputs4ResetState, permanentEdges, generateClock, tSetupFF );
int nrELines = 1; boolean fpga = false; boolean voter = true;
SisOutputReader sor = new SisOutputReader( new File( sisOutputFileName ), nrELines, LUT_INPUTS, fpga, voter );
FullOrderGenotype seed = new FullOrderGenotype ( sor.getGenotype() );
int bitsPerVar = sor.getBitsPerVar(); int usedEls = sor.getTotalEls();
SingleFaultModel faultModel = new SingleFullFaultModel( usedEls );
final int POP_SIZE = 15; final int GENOTYPE_MUT = 1; final int NUM_OF_ELITES = 0;
int DUMP_POP_EVERY = 25;
ElementDelayModel delayModel = new CoinDelayModel( );
CircuitMapping circuitMapping = new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + nrELines, bitsPerVar, LUT_INPUTS, delayModel );
int DQTol = 3;
int eSize = 19; int ignoreAtStart = 20;
SimulatorFaultyCircuit circuit = new SimulatorFaultyCircuit( circuitMapping );
SimulatorDeployment deployment = new SimulatorDeployment( circuit );
int nrAddUnits = ( 1 << bitsPerVar ) - experiment.getNumOfInputs();
int lutSize = 1 << LUT_INPUTS; int blockSize = lutSize + LUT_INPUTS * bitsPerVar;
int genotypeLength = nrAddUnits * blockSize;
Genotype[] seeds = new Genotype[ POP_SIZE ];
seeds[ 0 ] = seed;
for( int pl = 0; pl < POP_SIZE; pl++ )
{
seeds[ pl ] = ( FullOrderGenotype ) seed.clone();
for( int bl = usedEls * blockSize; bl < seeds[ pl ].length(); bl++ )
{
if( Math.random() < 0.5 )
{
seeds[ pl ].set( bl );
}
}
}
int fixedAlignments = usedEls;
int howManyBunches = 1;
//GeneticOperator m = new SAGAMutator( 1, genotypeLength / 50, 0, fixedAlignments * blockSize, -1 );
ExactGenotypeMutator m = new ExactGenotypeMutator( 2 );
m.setRange( fixedAlignments * blockSize, -1 );
GeneticOperator spxo = new SinglePointXOver();
GeneticOperator bmin0 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize, fixedAlignments );
GeneticOperator bmin1 = new BunchMutator( bitsPerVar, howManyBunches, blockSize, lutSize + bitsPerVar, fixedAlignments );
GeneticOperator bc = new BlockCopy ( blockSize, blockSize, 0, fixedAlignments );
GeneticOperator[] geneticOps = { m, spxo, bmin0, bmin1, bc };
double[] opsProbs = { 0.2, 0.2, 0.2, 0.2, 0.2 };
Selector selector = new RankSelector( );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, seeds );
PopulationLogReader.fullOrderGenotypes = true;
int nrEvals = 1; boolean overdetecting = true;
CircuitPainterObject painter = new CircuitPainterObject( new CircuitPainter(), new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + nrELines, bitsPerVar, LUT_INPUTS, new ConstantDelayModel( 0 ) ) );
BISTPIMSeqOnlineFull inIm = new BISTPIMSeqOnlineFull( evolver, deployment, circuit, experiment, INPUT_SAMPLE_SEP, faultModel, eSize, DQTol, painter, ignoreAtStart, time2Reset );
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps, nrEvals, NoisyPIM.MINIMUM );
double maxSize = nrAddUnits;
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit, maxSize );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
painter.setEvoTask( monica ); monica.setName( dirName );
taskQ.add( monica ); taskQNames.add( dirName ); taskQDescr.add( descr );
taskQBestIndID.add( new Integer( bestIndID ) );
int effort = (int) ( avgTPLen * INPUT_SAMPLE_SEP * nrEvals * ( usedEls * 1.5 ) * ( usedEls * 1.5 * 2 ) / 1000000 );
taskQEffort.add( new Integer( effort ) );
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
ControlLib.writeWebGraphDaemon( dirName, logDir, logFileName, 3, false, new File(".").getCanonicalPath() + File.separator );
}
protected void addC17() throws IOException
{
String blifFN = "/home/mmg20/eh/benchmarks/C17.blif";
String sisQFN = "/home/mmg20/eh/benchmarks/C17.sout";
String dirName = "C17L";
String descr = "Adding Built-In Self-Test to Conventionally Designed Benchmark Circuit Without Altering Original Design: C17 using 6 gates";
int bestHD = 297;
addCombBLIFBenchmark( blifFN, sisQFN, dirName, descr, bestHD );
}
protected void addB1() throws IOException
{
String blifFN = "/home/mmg20/eh/benchmarks/b1.blif";
String sisQFN = "/home/mmg20/eh/benchmarks/b1.sout";
String dirName = "B1LX";
String descr = "Locked Benchmark: B1 using 6 gates";
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -