?? mancaraddfunction.java
字號:
package jaga.pj.circuits.experiment;
import jaga.SampleData;
import jaga.experiment.ExperimentLib;
/** Some function is an arbitrary boolean function of 3 inputs (A,B,C,D)
* where Q = ~( ~( A ^ B ) ^ C ) & D
*
* (btw this is output of manchester carry adder with enable D)
* @author unknown
* @version
*/
public class ManCarAddFunction implements BooleanFunction {
/** Creates new SomeFunction */
public ManCarAddFunction() {
}
/** returns the result of this function given the inputs in the array
* @param inputs what values the inputs to the function have
*/
public boolean getResult(boolean[] inputs) {
return !( !( inputs[0]^inputs[1] ) ^ inputs[2] ) && inputs[3];
}
/** returns the amount of inputs needed to compute this function
*/
public int getNumOfInputs() {
return 4;
}
/** returns a set of BitSets providing a good set of input samples
* to test this function
*/
public SampleData[] getTestData() {
SampleData[] complete = ExperimentLib.generateCompleteTest( getNumOfInputs() );
// copy the last 8 of the at end inverted
int completeLength = complete[ 0 ].length();
for( int il = 0 ; il < 4; il++ )
{
complete[ il ].setLength( completeLength + 8 );
for( int idl = 0; idl < 8; idl++ )
{
complete[ il ].setTo( completeLength + idl , complete[ il ].get( completeLength - idl ) );
}
}
return complete;
}
public void setRandomSeed(long seed) {
jaga.experiment.ExperimentLib.setRandomSeed( seed );
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -