
Using Intermediate Expressions
You can use intermediate (constant) expressions in the declarations section to
reduce the number of output pins required to implement multi-level functions.
Intermediate expressions can be useful when a module has repeated expressions.
In general, intermediate expressions
decrease the number of output pins required, but
increase the amount of logic required per output
A constant expression is interpreted by the ABEL compiler as a string of
characters, not as a function to be implemented. For example, for the following
sets of Declarations and Equations
Declarations
TMP1 = [A3..A0] == [B3..B0];
TMP2 = [A7..A4] == [B7..B4];
Equations
F = TMP1 & TMP2;
the compiler directly substitutes the declarations into the equations,
creating
F = (A7 !$ B7) & (A6 !$ B6) & (A5 !$ B5)
& (A4 !$ B4) & (A3 !$ B3) & (A2 !$ B2)
& (A1 !$ B1) & (A0 !$ B0);
In contrast, if you move the constant declarations into the equations section,
in the following manner:
Declarations
TMP1,TMP2 pin 18,19
Equations
TMP1 = [A3..A0] == [B3..B0];
TMP2 = [A7..A4] == [B7..B4];
F = TMP1 & TMP2;
the compiler implements the equations as three discrete product terms. This
will produce the following result:
TMP1 =(A3 !$ B3) & (A2 !$ B2) & (A1 !$ B1) & (A0 !$ B0);
TMP2 =(A7 !$ B7) & (A6 !$ B6) & (A5 !$ B5) & (A4 !$ B4);
F = TMP1 & TMP2;
The first example (using intermediate expressions) requires one output with 16
product terms. The second example (using equations) requires three outputs
with less than 8 product terms per output. In some cases, the number of product
terms required for both methods can be reduced during optimization.
Note: An alternate method for specifying multi-level circuits such as this is to
use the @CARRY directive.
See Also
Declarations
Equations
Special Constants