Truth Table Implementation

Truth Table Implementation

 

The Truth Table implementation in code is relatively straight-forward from the table itself. The basic code structure might be seen in the example below. For a Truth Table implementing function F with C1 and C2 input conditions:

 

 

The generated code would be:

void F()
{
if(DI1== 1){
if(DI2== 1){
A1;
} else {
if(DI2== 2){
A2;
};
};
} else {
if(DI1 == 2 && DI2== 3){
A3;
}
 
 
Note: If the Truth Table is being factorized, as in this example, so is the generated code. This results in compact and fast code. It is recommended to factorize the table at the end of the development stage to make modifications easy, while not paying the cost on production.