Introduction to CAFE Yu Hen Hu & C. R. Kime Revised October 9, 2001
Introduction CAFE (Connection Arrays From Equations) is a Boolean function simplification program that can simultaneously simplify a set of Boolean functions sharing the same set of Boolean variables. To use CAFE, you create an input file which consists of –Function specifications: A list of functions to be minimized. Can be Boolean equations, a truth table, minterms, maxterms, or a tabular form –Process specification: specifies what kind of output you want
CAFE Syntax A sample CAFE program: Full Adder g=a*b, cout=g+p*cin. c s cout. Variables: case sensitive, but commands are case in- sensitive. Boolean operators: -, ~, / not *, & AND $, ~& XOR # A*~B !, ~| NOR +, | OR () punctuation, end of equation. end of last equation or other specification
Function Specifications : var_out = Boolean_expr = Boolean_expr. –If multiple outputs separated by, –Optional: dummy = all input variables ANDed together - used to order variables. : –Input var list. E.g. 3 a b cin. –var_out = minterm #s. : –Same as minterm : 3 a b c. x = 1x1 x10 = x00. Everywhere else, x = 0 : 4 a b c d. Inputs 3 w x y. Outputs 0 0 x – 0 x 1 x Note: x or X or - in inputs, means variable missing; in outputs, means don’t care. Terms for x = 1 Terms for x = don’t care Expr for var_out = 1 Expr for var_out = don’t care
Process Specifications and Commands Process specifications tells what format of the output should be. C: connection array E: equations T: truth table Advanced specifications: – K, L, R: not covered or used here. Terminal command for running CAFE: cafe [option] infile outfile Options: -e Suppress echo of input equations with results -f Fast connection arrays (the cheap solution of questionable quality) -r Repeat reduction -x Extraction algorithm (the systematic procedure we studied; may run long time!)
Example 1: Truth Table to Equations Input file: optran as at left 5 op2 op1 op0 sign corr.Command: cafe –x optran optran.out 2 sub comp_a X X X X X X X X 1 X 0 X X X 1 X X 0 X X 1 X X X 0 X X. e sub comp_a. q
Example 1: Truth Table to Equations CONTINUED: Connection Arrays from Equations Feb :00:09 Page 1 File: op_tran Run Options: x 1: 2: 5 op2 op1 op0 sign corr. 3: 2 sub comp_a. 4: : : X : X : X X X X : : : X X 1 X 0 X X 12: X 1 X X 0 X X 13: 1 X X X 0 X X 14: X 0 X : e sub comp_a. sub = -sign*-corr + -op0*-corr comp_a = corr + -op0*-corr seconds
Example 2: Minterms to Equations Connection Arrays from Equations Sep :08:59 Page 1 File: adder1 Run Options: 1: adder1 2: 3 a b cin. 3: s = , 4: co = : 6: e s co. s = -a*-b*cin + -a*b*-cin + a*-b*-cin + a*b*cin co = b*cin + a*cin + a*b
Example 3: Minterms to Truth Table 1: adder1 2: 3 a b cin. 3: s = , 4: co = : 6: t s co. 3 Input Variables 2 Output Variables 8 Cube Truth Table abc sc i o n Connection Arrays from Equations Sep :39:37 Page 1 File: adder1 Run Options: