9.1 Introduction The instruction set of the central processor unit (CPU12) is the first instruction set to specifically address the needs of fuzzy logic. This section describes the use of fuzzy logic in control systems, discusses the CPU12 fuzzy logic instructions, and provides examples of fuzzy logic programs. The CPU12 includes four instructions that perform specific fuzzy logic tasks. In addition, several other instructions are especially useful in fuzzy logic programs. The overall C-friendliness of the instruction set also aids development of efficient fuzzy logic programs. This section explains the basic fuzzy logic algorithm for which the four fuzzy logic instructions are intended. Each of the fuzzy logic instructions are then explained in detail. Finally, other custom fuzzy logic algorithms are discussed, with emphasis on use of other CPU12 instructions. The four fuzzy logic instructions are: • MEM (determine grade of membership), which evaluates trapezoidal membership functions • REV (fuzzy logic rule evaluation) and REVW (fuzzy logic rule evaluation weighted), which perform unweighted or weighted MIN-MAX rule evaluation • WAV (weighted average), which performs weighted average defuzzification on singleton output membership functions. Other instructions that are useful for custom fuzzy logic programs include: • MINA (place smaller of two unsigned 8-bit values in accumulator A) • EMIND (place smaller of two unsigned 16-bit values in accumulator D) • MAXM (place larger of two unsigned 8-bit values in memory) • EMAXM (place larger of two unsigned 16-bit values in memory) • TBL (table lookup and interpolate) • ETBL (extended table lookup and interpolate) • EMACS (extended multiply and accumulate signed 16-bit by 16-bit to 32-bit) For higher resolution fuzzy programs, the fast extended precision math instructions in the CPU12 are also beneficial. Flexible indexed addressing modes help simplify access to fuzzy logic data structures stored as lists or tabular data structures in memory. The actual logic additions required to implement fuzzy logic support in the CPU12 are quite small, so there is no appreciable increase in cost for the typical user. A fuzzy inference kernel for the CPU12 requires one-fifth as much code space and executes almost 50 times faster than a comparable kernel implemented on a typical midrange microcontroller.