Information
-
Patent Grant
-
4482975
-
Patent Number
4,482,975
-
Date Filed
Monday, March 29, 198242 years ago
-
Date Issued
Tuesday, November 13, 198440 years ago
-
Inventors
-
Original Assignees
-
Examiners
- Smith; Jerry
- Fleming; Michael R.
Agents
-
CPC
-
US Classifications
Field of Search
US
- 364 607
- 364 608
- 364 715
- 364 718
- 364 729
- 364 735
- 364 765
-
International Classifications
-
Abstract
Apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal. The mathematical function is approximated by a plurality of linear least-mean-square line segments each of which includes a central point, R, and a slope, S, with the desired point being defined by the equation F(X) approximates R+S.DELTA.X, where .DELTA.X is the X distance between the central point R and the desired point. R, S and .DELTA.X are precalculated and stored in PROM lookup tables and combined as stated in the above equation.
Description
BACKGROUND OF THE INVENTION
In the past, one method of providing a division type circuit is to generate a binary reciprocal of an input, X, and multiply the reciprocal by another input, Y, to produce a quotient Y/X. The uniqueness of this method lies in the manner of generating the reciprocal of X. It is known in the prior art, see for example U.S. Pat. No. 3,828,175, entitled "Method and Apparatus for Division Employing Table-Lookup and Functional Iteration", issued Aug. 6, 1974, that a table-lookup can be utilized which has stored therein all of the possible values of 1/X for the entire range of X to be utilized. The major problem with this type of apparatus is the size of lookup table (or amount of storage) that must be provided. For example, if the system uses a relatively standard 16 bit word as the X input and the range of interest is from 16,384 to 32,767, the system must be capable of storing 16,384 16 bit words or 262,144 bits of storage must be provied.
It will of course be undertood that it is desirable to have the capability of generating other types of functions (besides 1/X) and that these other generated functions might be utilized in mathematical operations in a fashion similar to the use of the reciprocal function discussed above. In the generation of the curve of a function in the X-Y plane, approximations such as the Taylor series expansion are known but these approximations, in general, incorporate such a large error that they are not acceptable for most of the present day mathematical operations.
SUMMARY OF THE INVENTION
The present invention pertains to a method and apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal, said apparatus including position storage means, having stored therein a plurality of precalculated points, R.sub.i, each lying on a different linear least-mean-square segment approximating a different section of the mathematical function, slope storage means having stored therein a slope S.sub.i, for each of the line segments, means for determining the distance, .DELTA.X, along the X axis between the point R.sub.i and the point defined by the input digital signal, multiplication means connected to supply the product S.sub.i .DELTA.X, and summing means providing the output signal, the sum R.sub.i +S.sub.i .DELTA.X, which is an approximation of the value of the mathematical function at the point defined by the input digital signal.
It is an object of the present invention to provide new and improved apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal.
It is a further object of the present invention to provide apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal with the use of linear least-mean-square line segments approximating different sections of the mathematical function.
It is a further object of the present invention to provide apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal within .+-.1 bit error or less, and which greatly reduced the amount of storage and apparatus required.
These and other objects of this invention will become apparent to those skilled in the art upon consideration of the accompanying specification, claims and drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
Referring to the drawings:
FIG. 1 is a graphical representation of a typical mathematical function which it may be desired to approximate;
FIG. 2 is an enlarged portion of the curve illustrated in FIG. 1; and
FIG. 3 is a simplified block diagram of apparatus for generating an output digital signal embodying the present invention.
DESCRIPTION OF THE PREFERRED EMBODIMENT
The present invention pertains to a method and apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal. While a variety of digital signals may be available now or in the future, the well known binary signals will be utilized to explain the operation of the present invention for simplicity and ease of understanding. Further, it should be understood that any of a great variety of predetermined mathematical functions might be approximated as will be immediately apparent to anyone skilled in the art, but the function 1/X is used herein as an aid in explaining the invention and because the function 1/X is relatively difficult to obtain and is extremely useful in a variety of operations. Further, while the mathematical function is described, throughout the specification and claims, as lying in the X-Y plane, it will be understood by those skilled in the art that this is simply a mathematical term utilized to more clearly describe and illustrate the function and its operation and this term should not be construed to limit the invention in any way.
Referring specifically to FIG. 1, a graphic representation of the mathematical function 1/X is illustrated lying in the X-Y plane. It is of course understood that the function is the reciprocal of X so that if the Y axis value of any point on the curve of the function defined by a specific X is multiplied by a predetermined number, the predetermined number is in essence divided by the specific X. For any digital system in which the function illustrated in FIG. 1 is being utilized there is a minimum and maximum bound on the values of X which are represented in FIG. 1 as X.sub.min and X.sub.max, respectively. To approximate the function illustrated in FIG. 1, the portion of the curve between X.sub.min and X.sub.max is divided into N sections with the number N depending upon the equipment being utilized and the accuracy required in the approximations.
As a typical example, if 16 bit binary words are being used to define the various points on the X axis (with the 2 most significant digits indicating the polarity and always being a 01 for this example) X.sub.min might typically be 16384, which is represented by all 14 of the remaining digits being 0, and X.sub.max might typically be 32,767, with all 14 of the remaining digits being 1's. Thus, the portion of the function lying between X.sub.min and X.sub.max is represented by the 16,384 numbers lying therebetween. If that portion of the function is divided into 256 sections, each section will be represented by 64 different numbers or binary words. For reasons which will become apparent presently, in this particular embodiment the 64 different words defining 64 different points on a particular section are completely defined by the 8 least significant bits in the 16 bit binary word representing X. Further, the particular section is described by the next 6 bits of the binary word. Thus, by drawing the subdivision lines at the natural binary number crossover points any desired point can be addressed directly from the input 16 bit word.
Once the function is divided into N sections, a straight line approximation is developed for each section. It will of course be understood that any continuous curve can be approximated by a series of short line segments and, as the number of total segments over the curve increases, the segmented approximation approaches the desired function in the limit. Referring specifically to FIG. 2, the ith section of FIG. 1 is enlarged and the ith straight line segment approximating the ith section of the function is illustrated.
Since each segment is linear, each can be defined by a slope (S.sub.i) and y-intercept (Y.sub.i), where the ith subscript defines the ith segment on the curve. The equation that defines the ith linear segment of the reciprocal approximation may be written as
a/X.perspectiveto.Y.sub.i +S.sub.i X (2)
The ith set of constants of Y.sub.i an S.sub.i is selected with respect to magnitude of X. If the y-axis is moved for each segment to correspond to a point X.sub.0i, the midpoint of each segment, its equation becomes
1/X.perspectiveto.R.sub.i +S.sub.i (X-X.sub.0i) .perspectiveto.R.sub.i +S.sub.i .DELTA.X (3)
where
R.sub.i =Y.sub.i +S.sub.i X.sub.0i (4)
and .DELTA.X=(X-X.sub.0i). If the entire range of the function is broken into n segments, there exists n different equations which, when considered together, completely define the reciprocal function. Each equation is made unique from the others by the values stored for the constants R.sub.i and S.sub.i. The equations of the n segments may be written as ##EQU1## The values of the constants R.sub.i and S.sub.i are calculated for each segment to ensure the best linear approximation of the segmented reciprocal curve by using the following least-mean-squares line fitting equations. ##EQU2## where n is the number of discrete points on the curve. The equation of the best line is then given by
Y=Y+M(X-X) =(Y-MX)+MX (9)
Translating the axis to X.sub.o, a point near the center of a segment, gives
Y=(Y-MX)+M(X-X.sub.0)+MX.sub.0 =(Y-MX+MX.sub.0)+M(X-X.sub.0) (10)
=R.sub.i +S.sub.i .DELTA.X (11)
where,
S.sub.i =M
R.sub.i =Y-MX+MX.sub.0 =Y-M(X-X.sub.0) (12)
.DELTA.X=X-X.sub.0
Equation (9) is the familiar slope-intercept form for the equation of a line and is analogous to equation (2). Equations (11) and (12) are similar to equations (3) and (4), respectively, and define the best linear fit of the reciprocal curve over a specified segment. FIG. 2 shows one segment with endpoints X.sub.1 and X.sub.2 with a superimposed plot of the scaled reciprocal curve, K/X.
Equations (6), (7), and (8) are used to linearize a discrete set of points. The reciprocal curve K/X is defined for an infinite number of points between X.sub.1 and X.sub.2. As such, it is advantageous to develop the least-mean-squares linear fit based on the continuous curve rather than on a finite set of points.
Equations corresponding to the discrete relations (6), 7), and (8) are developed here for the continuous case, by taking n to the limit in each case.
From equation (6), and using the identity n.DELTA.X=X.sub.2 -X.sub.1 ##EQU3## Likewise, from equation (7) ##EQU4## Rewriting equation (8), ##EQU5## In the limit, the first term of the numerator becomes ##EQU6## Similarly, the first term in the denominator becomes ##EQU7## Substituting (13), (14), (16), and (17) into (15) gives ##EQU8##
Gathering all equations together for clarity and convenience gives the least-mean-squares line segment constants in terms of the segment endpoints X.sub.1 and X.sub.2. ##EQU9##
Referring specifically to FIG. 3, a block diagram of the hardware that will achieve the n segment approximation is illustrated. The hardware includes 2 low density PROM lookup tables 10 and 11 for storage of the segmentation constants R.sub.i and S.sub.i, respectively. The address inputs for each of the PROMs 10 and 11 are connected to an input terminal 15 adapted to have the 16 bit input word representative of X supplied thereto. The 2 most significant bits of the 16 bit word provide an indication of the polarity. The next six most significant bits of the input word X are used to address the initial position (R.sub.i) PROM lookup table 10 as well as the slope (S.sub.i) PROM lookup table 11. The 8 least significant bits of X are used to generate the offset .DELTA.X. In this embodiment the various possible values for .DELTA.X are stored in a PROM lookup table 17 and the 8 least significant bits are applied to the address input from the input terminal 15. It will of course be apparent that the .DELTA.X's for each of the N line segments are the same and, therefore, only 64 8 bit words need be stored in the table 17. In the present embodiment the point R.sub.i is located at approximately the center of the ith line segment to reduce the errors between the actual function and the approximation. However, if the point R.sub.i were located at the end, X.sub.i, of the line segment the 8 least significant bits of the input X would be .DELTA.X and no further apparatus would be required. In this situation the input termainl 15 would be connected directly to a first input of a multiplier 20 instead of being connected through the PROM lookup table 17 as in the present embodiment. Various forms of dedicated logic might also be utilized to convert the 8 least significant bits of the input X to the .DELTA.X value.
In addition to the output from the lookup table 17 being connected to a first input of the multiplier 20, the output from the lookup table 11 is connected to a second input so that the two are multiplied together to provide an output, S.sub.i .DELTA.X. This output from the multiplier 20 is supplied to a first input of a summing circuit 25, a second input of which is connected to the output of the lookup table 10. Thus, the output of the summing circuit 25 is equal to R.sub.i +S.sub.i .DELTA.X. This value will be recognized as the Y value of the ith line segment at the point defined by the input X. The multiply and add functions are achieved by using high speed multiplier and adder integrated circuits which are commercially available.
Using the above described equations, the end values for R.sub.i and S.sub.i are precalculated and stored in the lookup tables 10 and 11. Also, if a lookup table is used for the value .DELTA.X these values are determined and stored in the lookup table 17. It should be noted that the lookup table used to store the 16,384 16 bit words in the prior art required a storage capacity of 262,144 bits. Whereas in the present embodiment the words defining the initial position, R.sub.i, are 20 bit words and the words defining the slope, S.sub.i, are 12 bit words. Thus, since the function is divided into 256 sections and each section requires a slope and an initial position, 32 bits are required for each section or a total of 8192 bits storage is required. Thus, the amount of storage and apparatus required in the present device are greatly reduced over the prior art apparatus. Further, because the least-mean-squares line segments are utilized to approximate each section of the predetermined mathematical function, the errors in the system are greatly reduced. For example, in the system as described, i.e., using 16 bits words to describe X and dividing the function into 256 sections, the answer is better than plus or minus a bit error.
While we have shown and described a specific embodiment of this invention, further modifications and improvements will occur to those skilled in the art. We desire it to be understood, therefore, that this invention is not limited to the particular form shown and we intend in the appended claims to cover all modifications which do not depart from the spirit and scope of this invention.
Claims
- 1. Apparatus for generating an output digital signal that approximates the value of a predetermined mathematical function lying in the X-Y plane at a point defined by an input digital signal comprising:
- position storage means having stored therein a plurality of precalculated points, R.sub.i, each lying on a different linear least-means-squares line segment approximating a different section of the mathematical function, said position stroage means having an input connected to receive at least a portion of the input digital signal, and an output, for providing an output signal at the output thereof representative of an appropriate one of the stored precalculated points in response to the input of at least the portion of the input digital signal;
- slope storage means having stored therein the plurality of precalculated slopes, S.sub.i, each defining the slope of a different one of the line segments, said slope storage means having an input connected to receive at least a portion of the input digital signal, and an output, for providing an output signal at the output thereof representative of an appropriate one of the stored slopes in response to the input of at least the portion of the input digital signal;
- means having an input connected to receive at least a portion of the input digital signal and an output, for determining the distance, .DELTA.X, along the X axis, from the point R.sub.i to the point defined by the input digital signal and providing at the output thereof an output signal representative of .DELTA.X;
- multiplication means connected to the outputs of said slope storage means and said distance determining mean for providing on an output thereof an output signal which is the product, S.sub.i .DELTA.X, of the applied output signals, and
- summing means connected to the outputs of said position storage means and said multiplication means for providing on an output thereof an output signal which is the sum, R.sub.i +S.sub.i .DELTA.X, of the output signal applied thereto and which is an approximation of the value of the mathematical function at the point defined by the input digital signal.
- 2. Apparatus as claimed in claim 1 wherein the position storage means and the slope storage means include lookup table PROM's.
- 3. Apparatus as claimed in claim 1 wherein the distance determining means includes a lookup table PROM.
- 4. Apparatus as claimed in claim 1 wherein the predetermined mathematical function is 1/X and the output digital signal is a reciprocal of the input digital signal.
- 5. Apparatus as claimed in claim 1 wherein the precalculated points, R.sub.i, are each approximately centrally located on the associated line segment.
- 6. Apparatus as claimed in claim 1 wherein the predetermined mathematical function is 1/X, the input digital signal includes at least a fourteen bit binary word having minimum and maximum boundaries of 16384 and 32767, respectively, with the mathematical function, between the boundaries, being approximated by 256 line segments, the position of the point defined by the input digital signal along any specific line segment being defined by the eight least significant bits of the input word and the six most significant bits defining the specific line segment.
US Referenced Citations (6)