The present invention relates to electronic devices that perform mathematical computations, and in particular, to an electronic circuitry for computing an N-th root and a reciprocal of a number.
There are many computing machines and systems known in the prior art. Many of these systems can perform one or more arithmetic functions. These functions are the usual functions such as addition, subtraction, multiplication and/or division. However, an N-th root extractor, (for example, a square root extractor) and a calculator of the reciprocal of a number are usually not implemented in hardware. Instead, they are implemented in either firmware or software which has a significantly lower performance than an implementation in hardware.
A circuitry for computing the N-th root of a number may be needed in various applications. For instance, the square root of a number is used in an exponentially weighted root mean square (ERMS) detector implemented in the form of a root extracting circuit. The ERMS detector determines the energy of an electrical signal by carrying out the steps of: (i) squaring the signal, (ii) convolving the squared signal with an exponential filter, and (iii) extracting the square root of the integrated signal. These steps imply that if the input signal is s(u), then the output signal U(t) from the ERMS detector representing the energy of the input signal as function of time t is reflected by the following equation:
where τ is a weighting constant.
Referring now to
A circuitry for computing a reciprocal of a number may be used, for example, for divisional operations. In particular, the division of one number by another
can be carried out by first inverting the denominator B and then multiplying the reciprocal 1/B of the denominator by the numerator A.
Various methods and apparatuses for the purpose of determining a square root and/or a reciprocal value of a number represented by a signal (specifically a digital signal) are known in the art. These techniques include the calculations utilizing lookup tables (see, for example, U.S. Pat. Nos. 4,694,417, and 6,260,054), Newton iteration (see, for example, U.S. Pat. Nos. 5,206,823, 5,274,580 and 5,220,524), polynomial approximation (see, for example, U.S. Pat. Nos. 3,648,038; 5,235,535 and 5,798,955) and circuits that iterate recursive equations (see, for example, U.S. Pat. Nos. 4,757,467 and 6,108,682). However, the prior art square root extractors as well as the conventional computing circuits for inverting numbers are wither slow or expensive, or produce output numbers that approximate the square root and reciprocal of a number with relatively low accuracy. Additionally, these techniques usually require an extensive use of memory or impose restrictions on the input values.
For example, the use of lookup tables requires that the root values are placed in a memory, e.g., a read only memory (ROM). The input signal is applied as an address code-word to the memory. Each location contains the square root value corresponding to the input number. Thus, a lookup table receives a certain signal value X and outputs the value √{square root over (X)} by extracting it from the memory. Although this approach is relatively fast and reliable, it requires large amounts of memory in order to store the wide range of possible square root results.
Another conventional technique for determining the N-th roots, in particular, the square roots of a number represented by an electric signal is an iterative technique referred to as the Newton method. For example, the technique utilizing the Newton method for determining the square roots may repeat execution of the following equation:
wherein Y(n+1) is the current estimate of the square root of the value S and Y(n) is the previous estimate of the square root. This equation is iterated until the quantity Y(n)−S/Y(n) converges to a sufficiently small value, i.e., until Y(n) approximately equals Y(n+1). The number of iterations required in order to reach a certain level of precision varies and thus, so does the duration of process. Processing Eq. (2) requires the division of the value S by successive estimates Y(n), i.e., determining the reciprocal. Moreover, conventional iterative routines tend to converge slowly, making them unsuitable for systems that require rapid root extractions.
Another approach that also iterates recursive equations for calculating the square root value is disclosed in U.S. Pat. No. 4,757,467. The electronic circuit described in U.S. Pat. No. 4,757,467 performs iterations of the following equation:
wherein Y(n+1) is the current estimate of the square root of the digital sample Sin and Y(n) is the previous estimate. However, iterating this equation provides accurate results only for a limited range of the input samples. In particular, the iteration of this equation can converge to the square root values of the sample Sin, in relatively few iterations, only for sample values in the range of 0<Sin<2. For larger values of Sin equation (3) converges more slowly or diverges. This drawback can be overcome by multiplying the quantities (Sin−Y(n))2 by the factor 2−(INT(log
Various other methods are known in the art for determining the mean square root and/or reciprocal values that utilize a polynomial approximation such as the Chebyshev expansion, Taylor expansion and others, which are ordinarily used for obtaining values of elementary functions. However, using such expansion techniques require a fairly long arithmetic operational time.
Despite the extensive prior art in the area of electronic devices for computing an N-th root and a reciprocal of a number, there is still a need in the art for, and it would be useful to have an electronic circuitry that determines the N-th root (where N may be any natural number equal to or larger than 2, i.e., N≧2) and/or a reciprocal of any real value in a relatively fast manner, and without employing a large amount of memory.
It would be advantageous if the electronic circuitry would perform the calculations without requiring any assumption on the input signal provided. It would be further advantageous if no such assumptions had to be made on any of the circuitry's parameters.
The present invention satisfies the aforementioned need by providing a novel calculating circuit for generating an output signal representing an output number approximating an N-th root and/or a reciprocal of an input number represented by an input signal. The calculating circuit includes a subtractor circuit responsive to a first signal and a second signal, and configured for generating an error signal representing difference between the first and second signals.
According to one embodiment of the invention, the first signal is the input signal.
According to another embodiment of the invention, the first signal is a reference signal represented by a constant value that is equal to 1.
According to the invention, the second signal is a feedback signal, the origin and generation of which will be explained below.
The calculating circuit also includes an integrator circuit responsive to the error signal and configured for generating an output signal representing the output number. Furthermore, the calculating circuit includes a multiplier circuit responsive to the output signal and configured for generating the feedback signal. The computation is performed by using dynamic iterative calculations that are performed by using a feedback loop.
According to one embodiment of the invention, the feedback signal represents the output signal raised to the power N.
According to another embodiment of the invention, the feedback signal represents a product of the output signal and the input signal.
The integrator circuit is a component that performs an accumulation (i.e., integration) of the error signals provided by the subtractor circuit. In each iteration, the integrator circuit multiplies the error signal by a gain factor K and adds the multiplied signal to the immediately previous calculated signal. The gain factor is set to optimize between a number of iterations necessary for convergence and a number of iterations necessary to maintain stability of the feedback signal. According to one embodiment of the invention, an appropriate value of K is chosen to be a function of the input signal level.
The present invention also satisfies the aforementioned need by providing a method for generating an output signal representing an output number approximating an N-th root or a reciprocal of an input number represented by an input signal. The method includes the iterative steps: generating an error signal representing a difference between a first signal and a second signal; integrating the error signal for obtaining the output signal; generating a feedback signal. These steps are repeated the required number of times to obtain the N-th root or said reciprocal with a required accuracy.
The step of integrating the error signal includes multiplying the error signal by a gain factor K, and computing the output signal representing said output number by adding the multiplied signal to the immediately previous calculated signal.
Thus, in accordance with one broad aspect of the invention, there is provided a calculating circuit for generating an output signal representing an output number approximating an N-th root or a reciprocal of an input number represented by an input signal, the calculating circuit comprising:
a subtractor circuit responsive to a first signal and a feedback signal and configured for generating an error signal representing a difference between said first signal and said feedback signal;
an integrator circuit responsive to said error signal and configured for computing said output signal;
a multiplier circuit responsive to said output signal and configured for generating a feedback signal.
According to one embodiment of the present invention, the first signal is the input signal.
According to another embodiment of the present invention, first signal is a reference signal represented by a constant value equal to 1.
In accordance with another broad aspect of the invention, there is provided a method for a calculating circuit for generating an output signal representing an output number approximating an N-th root of an input number represented by an input signal, the calculating circuit comprising:
a subtractor circuit responsive to said input signal and configured for generating an error signal representing a difference between said input signal and a feedback signal representing the output signal raised to the power N;
an integrator circuit responsive to said error signal and configured for computing said output signal; and
a multiplier circuit responsive to said output signal and configured for generating the feedback signal.
In accordance with yet another broad aspect of the invention, there is provided a calculating circuit for generating an output signal representing an output number approximating a reciprocal of an input number represented by an input signal, the calculating circuit comprising:
a subtractor circuit responsive to said input signal for generating an error signal representing a difference between a reference signal and a feedback signal representing a product of an output signal and said input signal;
an integrator circuit responsive to said error signal for generating said output signal; and
a multiplier circuit responsive to said output signal and to said input signal for generating said feedback signal.
In accordance with still another broad aspect of the invention, there is provided a method for generating an output signal Zout(j) representing an output number approximating an N-th root or a reciprocal of an input number represented by an input signal Zin, the method comprising the iterative steps:
In accordance with further broad aspect of the invention, there is provided a method for generating an output signal Zout(j) representing an output number approximating an N-th root of an input number represented by an input signal Zin, the method comprising the iterative steps:
In accordance with yet further broad aspect of the invention, there is provided a method for generating an output signal Zout(j) representing an output number approximating a reciprocal of an input number represented by an input signal Zin, the method comprising the iterative steps:
According to one embodiment of the present invention, the step of integrating said error signal E(j) includes:
There has thus been outlined, rather broadly, the more important features of the invention in order that the detailed description thereof that follows hereinafter may be better understood. Additional details and advantages of the invention will be set forth in the detailed description, and in part will be appreciated from the description, or may be learned by practice of the invention.
In order to understand the invention and to see how it may be carried out in practice, a preferred embodiment will now be described, by way of non-limiting example only, with reference to the accompanying drawings, in which:
The principles and operation of the calculating circuit according to the present invention may be better understood with reference to the drawings and the accompanying description, it being understood that these drawings and examples in the description are given for illustrative purposes only and are not meant to be limiting.
Referring to
The calculating circuit 200 includes a subtractor circuit 210 responsive to the input signal Zin and a feedback signal Zfb, and configured for generating an error signal Es. The error signal Es represents the difference between the input signal Zin and the feedback signal Zfb. The calculating circuit 200 also includes an integrator circuit 220 responsive to the error signal Es and configured for generating the output signal Zout. Furthermore, the electronic circuit 200 includes a multiplier circuit 230 responsive to the output signal Zout and configured for generating the feedback signal.
It should be appreciated that the calculating circuit 200 is a calculator that is capable of performing either digital or analog operations. According to the invention, the integrator circuit 220, the subtractor circuit 210 and the multiplier circuit 230 may be implemented as a module using an analog circuit, a digital circuit, or as part of a processor operation. For example, the subtractor circuit 210 may be implemented as a differential amplifier, a digital subtractor, or as part of a processor operation. For the purpose of this invention, a processor may be a microprocessor, microcontroller, digital signal processor (DSP) or any other electronic circuit configured for performing automatically a sequence of predefined instructions.
According to one embodiment of the invention, the integrator circuit 220 is a component that performs an integration of the error signals provided by the subtractor circuit 210. In each iteration, the integrator circuit 220 multiplies the error signal by a gain factor K and adds the multiplied signal to the immediately previous calculated signal. In other words, integrator circuit 220 implements the following recursive equation:
y(j)=y(j−1)+K·E(j), (4)
wherein “j” is the index of the current iteration, y(j) and y(j−1) are the current and previous estimates of the output signal, respectively, and “E(j)” is the error signal provided by the subtractor circuit 210.
The multiplier circuit 230 is a component that can multiply any one signal M1 by any another signal M2. According to one embodiment of the invention, the signals M1 and M2 are both equal to Zout. In other words, the multiplier circuit 230 performs the operation of calculating the square power of the output signal, to wit:
Zfb=Zout2. (5)
As can be appreciated by a person versed in the art that the process of determining the square root of a number by using calculating circuit 200 is based on repetition of the calculation. The calculator circuit 200 utilizes a feedback mechanism where the subtractor circuit 210 receives a feedback from the output signal.
The following process is performed in each iteration. The subtractor circuit 210 receives the input signal Zin that remains constant during the computing process. For example, it can be a direct current (DC) signal or a sample of an alternating signal. The subtractor circuit 210 subtracts the feedback signal Zfb provided by the multiplier circuit 230 from Zin. The operation (Zin−Zfb) results in the error signal Es which defines the difference between the input signal Zin and the calculated feedback signal Zfb.
The integrator circuit 220 generates a new output signal, by summing the previously calculated output signal and the current error signal multiplied by the gain factor K, i.e., calculating Zout(j)=Zout(j−1)+K·Es(j). The multiplier circuit 230 computes the square value of the signal Zout, and generates the feedback signal Zfb.
According to one embodiment of the present invention, at the first iteration, Zfb is equal to zero, therefore Es(0) is equal to Zin and Zout may be far from the desired value. Based on the characteristics of feedback systems, in each iteration the value of Es decreases and Zout converges to the desired value approximating the square root of the number represented by the input signal Zin.
Alternatively, the calculating circuit 200 may be implemented as a DSP programmed to execute the iterative process described above, namely accomplishing the following steps:
It should be noted that the rate of the convergence depends on the selection of the gain factor K, which must be within a range that allows for such convergence to occur. An erroneous selection of the value of K may result in the inability of the calculating circuit 200 to converge. The gain factor is determined as an optimization between a number of iterations necessary to complete the calculation and a number of iterations necessary to maintain stability of the feedback signal.
According to one embodiment of the present invention, an appropriate value of K is chosen to be a function of the input signal level. For example, the value of K can approximately be equal to 2/Zin. Moreover, any value of K below the value of 2/Zin will ensure that convergence will occur.
According to one embodiment of the invention, the calculating circuit 200 can detect a divagation of the values of Zout and Es from the desired values during the calculations. For example, the divagation of Zout from the desired value can occur when Zout is larger than Zin or if the absolute value of Es(j) equals to Es(j+1). In such a case the calculating circuit 200 can reduce the value of K in order to ensure convergence of the method. However, the divagation of Zout from the desired value will not occur if Es has reached a zero value.
Reference is now made to Table 1 where a detailed example of calculation of the square root of an input number equivalent to the value of 4 is shown.
For this example the gain factor K is set to be 0.2. In Table 1 only the first nine iterations are shown. It can be noted that the iteration process may be stopped when the error signal Es is equal to zero (for this example, j=9), or at a predetermined level close to zero.
More specifically, at the 1-st iteration, Es is equal to 4, and Zout is equal to 0.8, which is far-off from the square root value of 2. It can be appreciated that as long as the calculating circuit 200 performs more iterations, the value of Es decreases and the value of Zout converges to the desired value. When the error value reaches zero, the Zout signal is equal to the correct value and the process ends. It should be noted that when the error signal reaches zero, the value of the output signal Zout does not change.
It should be appreciated that as an example of the application, the calculating circuit 200 can be used as a square root extractor (130 in
It should be noted that the input signal may change over each sampling time period Ts. Therefore, calculating circuit 200 has to converge to the desired value of √{square root over (Z(t))} in the time frame of Ts. In order to ensure this convergence, each iteration has to be executed in a time interval that is significantly shorter than the time period Ts. For example, a utilization of the method described above allows making this time interval to be equal to Ts/100. Furthermore, as described above, the gain factor K used by the integrating circuit 220 must be adjusted, in accordance with the characteristic value of Ts of the ERMS detector. Preferably, the gain factor should be equal to 1/2Tsy0. in order to reach convergence within the time interval Ts, where yo is approximately equal to the square-root value of Zin.
Referring to
In particular, a subtractor circuit 410 is responsive to the input signal Zin and a feedback signal Zfb, and configured for generating an error signal Es representing a difference between the input signal Zin and the feedback signal Zfb. According to this embodiment of the invention, the subtractor circuit 410 may be implemented as a differential amplifier, a digital subtractor, or as part of a processor operation.
According to this embodiment of the invention, the integrator circuit 420 is a component that performs an integration of the error signals provided by the subtractor circuit 410. In each iteration, the integrator circuit 420 multiplies the error signal Es by a gain factor K and adds the multiplied signal to the immediately previous calculated signal. In other words, integrator circuit 420 implements the following recursive equation:
y(j)=y(j−1)+K·E(j), (6)
wherein “j” is the index of the current iteration, y(j) and y(j−1) are the current and previous estimates of the output signal, respectively, and “E(j)” is the error signal provided by the subtractor circuit 410.
The multiplier circuit 430 is a component that can multiply N signals M1 through MN by each other. According to this embodiment of the invention, the signals M1 through MN are all equal to Zout. In other words, the multiplier circuit 430 performs the operation of calculating the output signal Zout raised to the power N, to wit:
Zfb=ZoutN. (7)
According to the invention, the multiplier circuit 430 may be implemented on the basis of an analog circuit, a digital circuit, or as part of a processor operation. For the purpose of this invention, a processor may be a microprocessor, microcontroller, digital signal processor (DSP) or any other electronic circuit configured for performing automatically a sequence of predefined instructions.
Reference is now made to Table 2 where a detailed example of calculation of the cubic root of an input number equivalent to the value of 27 is shown.
For this example, the gain factor K is to be 0.05. As can be seen, the calculating circuit 400 achieves the exact result of the cubic root of 27 after nine iterations.
Table 3 shows a detailed example of calculation of the 5-th root of an input umber equivalent to the value of 32.
For this example, the gain factor K is to be 0.01. As can be seen, the calculating circuit 400 achieves the exact result of the 5-th root of 32 after eleven iterations.
It should be noted that the different values of the gain factor K are used in each case in the shown examples. The rate of the convergence depends on the selection of the gain factor K, which must be within a range that allows for such convergence to occur. The gain factor K is set to optimize between a number of iterations necessary for convergence and a number of iterations necessary to maintain stability the feedback signal. According to the invention, the calculating circuit 400 may adaptively assign the gain factor K to the appropriate value so that Zout would converge to a desired value.
According to one embodiment of the invention, an appropriate value of K is chosen to be a function of the input signal level. For instance, the value of K can approximately be equal to 2/Zin. Moreover, any value of K below the value of 2/Zin will ensure that convergence will occur.
According to another embodiment of the invention, an appropriate value of K o be a function of the value of N. For instance, the value of K can be proportional to N.
Referring to
The calculating circuit 600 includes a subtractor circuit 610 responsive to a reference signal Rs and a feedback signal Zfb, and configured for generating an error signal Es. The error signal Es represents a difference between the reference signal Rs and feedback signal Zfb. The calculating circuit 600 also includes an integrator circuit 620 responsive to the error signal Es and configured to perform an integration of the error signals provided by subtractor circuit 610 in the manner described above with respect to the subtractor circuit (210 in
It should be appreciated that the calculating circuit 600 is a calculator that is capable of performing either digital or analog operations. The integrator circuit 620, the subtractor circuit 610 and the multiplier circuit 630 may be implemented as a module using an analog circuit, a digital circuit, or as pail of a processor operation. For example, the subtractor circuit 610 may be implemented as a differential amplifier, a digital subtractor, or as part of a processor operation. For the purpose of this invention, a processor may be a microprocessor, micro-controller, digital signal processor (DSP) or any other electronic circuit configured for performing automatically a sequence of predefined instructions.
The process for computing a reciprocal of a number is similar to that for computing an N-th root value of a number. The following process is performed in each iteration. The subtractor circuit 610 receives the reference signal Rs and the feedback signal Zfb and generates an error signal Es that represents a difference between the reference signal Rs and feedback signal Zfb. According to this embodiment of the present invention the reference signal Rs is constant and equal to one.
The integrator circuit 620 generates a new output signal, by summing the previously calculated output signal and the current error signal multiplied by the gain factor K, i.e., calculating Zout(j)=Zout(j−1)+K·Es(j). The multiplier circuit 630 generates the feedback signal representing a product of the input signal Zin and the output signal Zout.
It can be appreciated that the output signal Zout provided by integrator circuit 620 approximates the value of 1/Zin. Hence, the multiplication between Zout and Zin results in a signal Zfb which is approximately equal to one. According to this embodiment of the invention, at the first iteration, Zout is equal to one and Zfb is equal to zero. In each iteration, the value of the value of Es decreases and Zout converges to the desired value approximating the reciprocal of the number represented by the input signal Zin.
The rate of the convergence depends on the selection of the factor K, which must be within a range that allows for such convergence to occur. An erroneous selection of the value of K may result in the inability of the calculating circuit 600 to converge. For example, in order to achieve the convergence of the iteration process, the gain factor can be limited to values between 0 and ½. The iteration process can operate until the error signal Es is equal to zero or below a defined threshold.
Reference is now made to Table 4 where a detailed example of calculation in each iteration of the reciprocal of an input number equivalent to the value of 2 is shown. The gain factor K in this case is set to 0.3.
In this example the first ten iterations are shown. The iteration process is stopped when the error signal Es is equal to zero. At the first iteration Es is equal to 1 and Zout is equal to 0.3, which is far from the inverse value of 0.5. It can be seen that as long as the calculating circuit 600 performs more iterations, the value of Es is decreased and Zout converges to the desired value. When the error value reaches zero, the Zout signal is equal to the correct value (i.e., 0.5), and the process stops. It should be noted that when the error signal reaches zero the value of the output signal Zout does not change.
As such, those skilled in the aft to which the present invention pertains, can appreciate that while the present invention has been described in terms of preferred embodiments, the concept upon which this disclosure is based may readily be utilized as a basis for the designing of other structures, systems and processes for carrying out the several purposes of the present invention.
It is apparent that although implementations of the calculating circuit for calculating an N-th root or a reciprocal of a numerical value have been described above, it should be appreciated that such implementations may be used for calculating not only simple numerical values, but also any functions represented by an input signal Zin having well-defined inverse functions.
Also, it is to be understood that the phraseology and terminology employed herein are for the purpose of description and should not be regarded as limiting.
In the method claims that follow, alphabetic characters used to designate claim steps are provided for convenience only and do not imply any particular order of performing the steps.
It is important, therefore, that the scope of the invention is not construed as being limited by the illustrative embodiments set forth herein. Other variations are possible within the scope of the present invention as defined in the appended claims and their equivalents.
Number | Name | Date | Kind |
---|---|---|---|
3648038 | Sierra | Mar 1972 | A |
4694417 | Cantwell | Sep 1987 | A |
4757467 | Dieterich et al. | Jul 1988 | A |
5206823 | Hesson | Apr 1993 | A |
5220524 | Hesson | Jun 1993 | A |
5235535 | Nakayama | Aug 1993 | A |
5274580 | Keryvel et al. | Dec 1993 | A |
5798955 | Matsubara | Aug 1998 | A |
6108682 | Matheny | Aug 2000 | A |
6260054 | Rosman et al. | Jul 2001 | B1 |
6769006 | Krouglov et al. | Jul 2004 | B1 |
20030028574 | Takagi | Feb 2003 | A1 |
Number | Date | Country | |
---|---|---|---|
20040003015 A1 | Jan 2004 | US |