📄 evokingkongbist_1.java~
字号:
GeneticOperator bmin1 = new BunchMutator( BITS_PER_VARIABLE, howManyBunches, blockSize, lutSize + BITS_PER_VARIABLE, fixedAlignments );
GeneticOperator bc = new BlockCopy ( blockSize, blockSize, fixedAlignments );
GeneticOperator[] geneticOps = { m, spxo, bmin0, bmin1, bc };
double[] opsProbs = { 0.3, 0.1, 0.2, 0.2, 0.2 };
Selector selector = new RankSelector( );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, SEEDS );
//InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
PopulationLogReader.fullOrderGenotypes = true;
int eSize = 15;
int nrEvals = 20;
boolean overdetecting = true;
BISTPIM inIm = new BISTPIM( evolver, deployment, circuit, experiment, faultModel, eSize, overdetecting );
inIm.sequentialCircuit = false;
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps, nrEvals );
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
String dirName = "2MultLockedBIST";
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
taskQDescr.add( "Adding Built-In Self-Test to Fixed Hand Designed Two bit Multiplier" );
taskQBestIndID.add( new Integer( 14 ) ); //130 under win
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
}
protected static void addBeecount() throws IOException
{
String[] resetIns = { "001","011","101","111" }; // for beecount
int[] permEdges = { 7,8,12,16,20,24,28,32 }; // for beecount
int bestID = 8;
int rstIt =1;
addKISSBenchmark
(
"/home/mmg20/eh/benchmarks/beecount.kiss2",
"/home/mmg20/eh/benchmarks/beecount.sout",
"st0", resetIns, permEdges, "Beecount",
"Adding Built-In Self-Test to Conventionally Designed Benchmark Circuit: BEECOUNT using 33 gates",
bestID, rstIt
);
}
protected static void addKISSBenchmark( String kissFileName, String sisOutputFileName, String resetStateName, String[] inputs4ResetState, int[] permanentEdges, String dirName, String descr, int bestIndID, int resetIter ) throws IOException
{
final double T_SETUP = 0.45;
final int INPUT_SAMPLE_SEP = 30;
// D - Circuit Structure Properties
final int LUT_INPUTS = 2;
// B - BENCHMARK STUFF
File kissFile = new File( kissFileName );
KISSFSMExperiment experiment = new KISSFSMExperiment( T_SETUP, kissFile, resetStateName, inputs4ResetState, permanentEdges, resetIter );
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 );
// A - Genetic Algorithms Properties
// Standard
final int POP_SIZE = 22;
final int GENOTYPE_MUT = 1;
final int NUM_OF_ELITES = 2;
// M - Log Properties
int DUMP_POP_EVERY = 10;
// D - DEPLOYMENT set up
ElementDelayModel delayModel = new CoinDelayModel( );
CircuitMapping circuitMapping = new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + nrELines, bitsPerVar, LUT_INPUTS, delayModel );
int DQTol = 20;
int eSize = 15;
SimulatorFaultyCircuitOpt circuit = new SimulatorFaultyCircuitOpt( circuitMapping, DQTol, eSize );
SimulatorDeployment deployment = new SimulatorDeployment( circuit );
// A - Genetic Operators Set up
int nrAddUnits = ( 1 << bitsPerVar ) - experiment.getNumOfInputs();
int genotypeLength = nrAddUnits * ( ( 1 << LUT_INPUTS ) + LUT_INPUTS * bitsPerVar );
int lutSize = 1 << LUT_INPUTS;
int blockSize = lutSize + LUT_INPUTS * bitsPerVar;
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, 10 );
ExactGenotypeMutator m = new ExactGenotypeMutator( 5 );
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, fixedAlignments );
GeneticOperator[] geneticOps = { m, spxo, bmin0, bmin1, bc };
double[] opsProbs = { 0.3, 0.1, 0.2, 0.2, 0.2 };
Selector selector = new RankSelector( );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, seeds );
//InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
PopulationLogReader.fullOrderGenotypes = true;
int nrEvals = 25;
boolean overdetecting = true;
BISTPIMSeqOnline inIm = new BISTPIMSeqOnline( evolver, deployment, circuit, experiment, INPUT_SAMPLE_SEP, faultModel, eSize );
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps, nrEvals );
double maxSize = nrAddUnits;
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit, maxSize );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
taskQDescr.add( descr );
taskQBestIndID.add( new Integer( bestIndID ) ); //130 under win
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
}
protected static void addDecod() throws IOException
{
String blifFN = "/home/mmg20/eh/benchmarks/decod.blif";
String sisQFN = "/home/mmg20/eh/benchmarks/decod.sout";
String dirName = "Decod";
String descr = "Adding Built-In Self-Test to Conventionally Designed Benchmark Circuit: DECOD using 50 gates";
int bestHD = 277;
addCombBLIFBenchmark( blifFN, sisQFN, dirName, descr, bestHD );
}
protected static void addC17() throws IOException
{
String blifFN = "/home/mmg20/eh/benchmarks/C17.blif";
String sisQFN = "/home/mmg20/eh/benchmarks/C17.sout";
String dirName = "C17";
String descr = "Adding Built-In Self-Test to Conventionally Designed Benchmark Circuit: C17 using 6 gates";
int bestHD = 297;
addCombBLIFBenchmark( blifFN, sisQFN, dirName, descr, bestHD );
}
protected static void addCombBLIFBenchmark( String blifFileName, String sisOutputFileName, String dirName, String descr, int bestIndID ) throws IOException
{
final double T_SETUP = 0.45;
final int INPUT_SAMPLE_SEP = 50;
// D - Circuit Structure Properties
final int LUT_INPUTS = 2;
// B - BENCHMARK STUFF
CombinationalBLIFExperiment experiment = new CombinationalBLIFExperiment( blifFileName, T_SETUP );
final int E_LINES = 1;
final boolean FPGA = false;
final boolean VOTER = true;
SisOutputReader sor = new SisOutputReader( new File( sisOutputFileName ), E_LINES, LUT_INPUTS, FPGA, VOTER );
FullOrderGenotype seed = new FullOrderGenotype ( sor.getGenotype() );
int bitsPerVar = sor.getBitsPerVar();
int usedEls = sor.getTotalEls();
SingleFaultModel faultModel = new SingleFullFaultModel( usedEls );
// A - Genetic Algorithms Properties
// Standard
final int POP_SIZE = 32;
final int GENOTYPE_MUT = 1;
final int NUM_OF_ELITES = 2;
// M - Log Properties
int DUMP_POP_EVERY = 50;
// D - DEPLOYMENT set up
//ElementDelayModel delayModel = new CoinDelayModel( );
ElementDelayModel delayModel = new GaussianDelayModel( 0.3, 0.3 );
CircuitMapping circuitMapping = new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + E_LINES, bitsPerVar, LUT_INPUTS, delayModel );
int DQTol = 20;
int eSize = 25;
SimulatorFaultyCircuit circuit = new SimulatorFaultyCircuit( circuitMapping );
SimulatorDeployment deployment = new SimulatorDeployment( circuit );
// A - Genetic Operators Set up
int nrAddUnits = ( 1 << bitsPerVar ) - experiment.getNumOfInputs();
int genotypeLength = nrAddUnits * ( ( 1 << LUT_INPUTS ) + LUT_INPUTS * bitsPerVar );
int lutSize = 1 << LUT_INPUTS;
int blockSize = lutSize + LUT_INPUTS * bitsPerVar;
Genotype[] seeds = new Genotype[ POP_SIZE ];
//seeds[ 0 ] = seed;
System.out.println(seeds[ 0 ]);
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 );
}
}
System.out.println(seeds[ pl ]);
}
int fixedAlignments = usedEls;
int howManyBunches = 1;
//GeneticOperator m = new SAGAMutator( 1, 10 );
ExactGenotypeMutator m = new ExactGenotypeMutator( ( int ) ( genotypeLength / 500 ) + 1 );
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, fixedAlignments );
GeneticOperator[] geneticOps = { m, spxo, bmin0, bmin1, bc };
double[] opsProbs = { 0.3, 0.1, 0.2, 0.2, 0.2 };
Selector selector = new RankSelector( );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, seeds );
//InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
PopulationLogReader.fullOrderGenotypes = true;
int nrEvals = 10;
boolean overdetecting = true;
BISTPIM inIm = new BISTPIM( evolver, deployment, circuit, experiment, faultModel, eSize, overdetecting, INPUT_SAMPLE_SEP );
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps, nrEvals );
double maxSize = nrAddUnits;
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit, maxSize );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
taskQDescr.add( descr );
taskQBestIndID.add( new Integer( bestIndID ) );
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -