8.3 Function Numbers


8.3 Function Numbers

Beyond two input variables, there are too many functions to provide a specific name for each. Therefore, even when we are referring to functions with two input variables , we will refer to the function's number rather than the function's name. For example, F 8 denotes the logical AND of A and B for a two-input function and F 14 denotes the logical OR operation. Of course, for functions with more than two input variables, the question is, 'How do we determine a function's number?' For example, what is the corresponding function number for the function F = AB + C ? Computing the answer is easily done by looking at the truth table for the function. If we treat the values for A, B, and C as bits in a binary number with C being the HO bit and A being the LO bit, they produce the binary strings that correspond to numbers in the range zero through seven. Associated with each of these binary strings is the function result, either zero or one. If we construct a binary number by placing the function result of each combination of the A , B , and C input values into the bit position specified by the binary string of the A, B, and C bits, the resulting binary number will be the corresponding function number. If this doesn't make sense, an example will help clear it up. Consider the truth table for F = AB + C (see Table 8-5).

Table 8-5: Truth table for F = AB + C

C

B

A

F = AB + C

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

Note how the input variables C, B, and A combine to form binary number sequences in the range %000..%111 (0..7). If we use these values to denote bit numbers in an 8-bit value (CBA = %111 specifies bit seven, CBA = %110 specifies bit six, and so on), we can determine the function number by placing at each of these bit positions the result of F = AB + C, for the corresponding combination of C , B , and A values:

 CBA:        7 6 5 4 3 2 1 0  F = AB + C: 1 1 1 1 1 0 0 0 

Now, if we treat this bit string as a binary number, it produces the function number $F8 or 248. We will usually denote function numbers in decimal. This also provides insight into why there are different functions given n input variables: if you have n input variables, there are 2 n different variable value combinations, and thus 2 n bits in the function's binary number. If you have m bits, there are 2 m different possible arrangements of those bits. Therefore, for n input variables there are m = 2 n possible bits and 2 m or possible functions.




Write Great Code. Understanding the Machine, Vol. 1
The Art of Assembly Language
ISBN: 1593270038
EAN: 2147483647
Year: 2003
Pages: 144
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net