WHEN-THEN-ELSE IN ABEL


Yet another way of specifying logic functions is to use programming language constructs such as WHEN-THEN-ELSE. If we want to use this construct instead of the Boolean expressions stated earlier we would replace the EQUATIONS section by :

EQUATIONS

Now, if we compile the equations as we did for the truth table method we'll see that minimized equations are not exactly same as before. The reason is that, in the truth table method we used don't cares .X. whereas here we are asking for the output to be [0,0,0,1] for all cases besides 2, 4, 6, 9, 11. Hence, the compiled equations look like:

Equations:
d28 = ( !leap & !m1 & m2 & !m4 & !m8); 
d29 = ( leap & !m1 & m2 & !m4 & !m8);
d30 = ( !m1 & m4 & !m8 # m1 & !m4 & m8);
d31 = ( !m2 & !m4 & !m8 # m4 & m8 # m1 & !m8 # !m1 & m8);

In the above compiled equations, note that although the equations for d28, d29, and d30 are the same, the equation for d31 is quite different. In fact it includes 0,13,14, and 15. In order to get the same equations as before we need to specify that we don't care what the values are for 0, 13, 14 and 15. We can do that as follows:

EQUATIONS
WHEN (month == 2) THEN {          "if its February 
ELSE { 

The compiled equations now obtained should be the same as we are providing the same information.