CN105302520B - Reciprocal operation solving method and reciprocal operation solving system - Google Patents

Reciprocal operation solving method and reciprocal operation solving system Download PDF

Info

Publication number
CN105302520B
CN105302520B CN201510672908.1A CN201510672908A CN105302520B CN 105302520 B CN105302520 B CN 105302520B CN 201510672908 A CN201510672908 A CN 201510672908A CN 105302520 B CN105302520 B CN 105302520B
Authority
CN
China
Prior art keywords
circuit
preset condition
function
reciprocal
meeting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510672908.1A
Other languages
Chinese (zh)
Other versions
CN105302520A (en
Inventor
张书迁
张振东
苗俊涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Angrui Microelectronics Technology Co ltd
Original Assignee
Beijing Huntersun Electronic Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Huntersun Electronic Co ltd filed Critical Beijing Huntersun Electronic Co ltd
Priority to CN201510672908.1A priority Critical patent/CN105302520B/en
Publication of CN105302520A publication Critical patent/CN105302520A/en
Application granted granted Critical
Publication of CN105302520B publication Critical patent/CN105302520B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

The application provides a reciprocal operation solving method and a reciprocal operation solving system, wherein the reciprocal operation solving method comprises the following steps: decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition by a separation circuit; approximating, by an inverse approximation circuit, an inverse of the fractional part with a piecewise function that meets a second preset condition; and utilizing a multiplication circuit to multiply the piecewise function and the exponential part to calculate an approximate value of the function to be solved. The solving method converts reciprocal operation in the digital circuit into simple multiplication operation, avoids the use of a division circuit in the digital circuit and reduces the circuit cost.

Description

Reciprocal operation solving method and system
Technical Field
The present application relates to the field of digital circuit technologies, and in particular, to a reciprocal operation solution method and system.
Background
Digital circuits are circuits that use digital signals to perform arithmetic and logical operations on digital quantities. The reciprocal operation is an operation frequently encountered in digital circuits, and belongs to division operation.
In the implementation of a digital circuit, a general division operation occupies a very large amount of hardware resources, and thus, the division operation circuit is also an operation unit that needs to be avoided as much as possible in the implementation of the digital circuit. However, in some applications where the use of reciprocal operations is unavoidable, we often do not need to obtain a very precise value, but only an approximation thereof. For example, in an AGC (automatic Gain Control) circuit of a digital circuit, it is not necessary to obtain a very precise Gain, and the final Gain G = Vref/Vest is: the reference level amplitude is divided by the actual detected estimated level amplitude, and if one divider circuit is used, the area cost of the divider circuit alone may be greater than the entire automatic gain control logic, thus increasing circuit cost.
Disclosure of Invention
In view of this, the present application provides a reciprocal operation solving method and system, so as to overcome the problems of large hardware resource occupation and high circuit cost of division operation in the prior art.
In order to achieve the above object, the present application provides the following technical solutions:
a method of solving reciprocal operations, comprising:
decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition by a separation circuit;
approximating, by an inverse approximation circuit, an inverse of the fractional part with a piecewise function that meets a second preset condition;
and multiplying the piecewise function and the exponential part by utilizing a multiplication circuit to calculate an approximate value of the function to be solved.
Preferably, the decomposing, by the separation circuit, the denominator in the function to be solved into an exponential part and a fractional part meeting a first preset condition includes:
moving the decimal point of the binary data corresponding to the denominator to the left or to the right until the moved data meets the first preset condition, and recording the data as a decimal part;
the number of bits of the decimal point movement is noted to obtain the exponent portion.
Preferably, the first preset condition is not less than 0.5 and less than 1, or equal to 0.
Preferably, the approximating, by an inverse approximation circuit, the inverse of the fractional part by a piecewise function meeting a second preset condition includes:
and according to a linear approximation principle, approximately representing the reciprocal of the fractional part by using a piecewise function meeting a second preset condition.
A system for solving reciprocal operations, comprising: a separation circuit, a reciprocal approximation circuit, and a multiplication circuit, wherein,
the separation circuit is used for decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition;
the reciprocal approximation circuit is used for approximating the reciprocal of the decimal part by a piecewise function meeting a second preset condition;
the multiplication circuit is used for utilizing the piecewise function to multiply with the exponential part to calculate the approximate value of the function to be solved.
Preferably, the separation circuit includes: a mobile module and a recording module, wherein,
the moving module is used for moving the decimal point of the binary data corresponding to the denominator to the left or to the right until the moved data meet the first preset condition;
and the recording module is used for recording the moved data meeting the first preset condition as a decimal part and recording the number of bits moved by the decimal point to obtain an exponential part.
Preferably, the first preset condition is not less than 0.5 and less than 1, or equal to 0.
Preferably, the reciprocal approximation circuit is specifically configured to approximate the reciprocal of the fractional part by using a piecewise function meeting a second preset condition according to a linear approximation principle.
According to the technical scheme, the application provides a reciprocal operation solving method and a reciprocal operation solving system, wherein the solving method comprises the following steps: decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition by a separation circuit; approximating, by an inverse approximation circuit, an inverse of the fractional part with a piecewise function that meets a second preset condition; and utilizing a multiplication circuit to multiply the piecewise function and the exponential part to calculate an approximate value of the function to be solved. The solving method converts reciprocal operation in the digital circuit into simple multiplication operation, avoids the use of a division circuit in the digital circuit, and reduces the circuit cost.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart of a method for solving reciprocal operations according to an embodiment of the present application;
FIG. 2 is a data storage format of an 8-bit integer 28 according to an embodiment of the present disclosure;
FIG. 3 is a graph showing the comparison between the 1/f accurate value and the approximate value provided in the first embodiment of the present application;
FIG. 4 is a diagram illustrating an error evaluation between the 1/f accurate value and the approximate value provided in the first embodiment of the present application;
fig. 5 is a schematic structural diagram of a system for solving reciprocal operations according to a second embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the problems of large hardware resource occupation and high circuit cost of division operation in the prior art, the application provides a reciprocal operation solving method and a reciprocal operation solving system, and the specific scheme is as follows:
example one
A solution method for reciprocal operation is provided in an embodiment of the present application, as shown in fig. 1, fig. 1 is a flowchart of the solution method for reciprocal operation provided in the embodiment of the present application. The method comprises the following steps:
s101: decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition by a separation circuit;
in this application, the splitting circuit decomposing the denominator in the function to be solved into an exponential part and a fractional part meeting a first preset condition may include:
moving the decimal point of the binary data corresponding to the denominator to the left or to the right until the moved data meets a first preset condition, and recording the data as a decimal part;
the number of bits of the decimal point shift is noted to obtain the exponent portion.
In the present application, the first preset condition is not less than 0.5 and less than 1, or equal to 0.
Specifically, the denominator value of the reciprocal is first decomposed into a fractional part f and an exponential part n:
Value=f×2 n (1)
wherein f is more than or equal to 0.5 and less than 1 or f =0;
it should be noted that the reciprocal operation can be expressed as a function f (x) =1/x, i.e., the reciprocal of the denominator x (the variable value is the denominator x here). The denominator is broken down into a fractional part and an exponential part by a circuit.
Since data is stored in binary in the circuit, it is reasonable to decompose the value into a fractional part and an exponential part, and since any one data exists in binary form in the digital circuit, it is also very natural to decompose this data into two pieces, represented as an integer part and a fractional part, respectively. The exponent part n is easy to determine, just by how many bits the decimal point needs to be moved to the left or right, and the fraction part still uses the original data structure, but the position of the decimal point is changed.
Specifically, taking an 8-bit integer 28 as an example, as shown in fig. 2, fig. 2 is a data storage format of the 8-bit integer 28 according to an embodiment of the present application. Among the binary numbers, MSB (Most Significant Bit) is the highest weighted Bit, similar to the leftmost digit in a decimal number. Typically, the MSB is located at the leftmost side of the binary number, and the LSB (Least Significant Bit) is located at the rightmost side of the binary number. If MSB =1, the data is a negative value, and if MSB =0, the data is a non-negative value.
To get a qualified fraction, the fraction point needs to be shifted 5 bits to the left, so n =5; the decimal point has moved to the left of the largest non-zero bit, resulting in a fractional part of 0.875, so the value can be decomposed to 0.875 × 2 5
The reciprocal value 1/value =2 of the value -5 X (1/0.875). The power of 2 can be completed by simple shift operation, so that the reciprocal of a number value is mainly the reciprocal of a fraction part after decomposition of reciprocal denominator, that is, the reciprocal of any number can be solved as the reciprocal of a number between 0.5 and 1. This can be approximated by a simple piecewise function, where accuracy allows, thereby greatly simplifying the implementation of the circuit.
S102: the reciprocal of the fractional part is approximately expressed by a reciprocal approximation circuit by utilizing a piecewise function which meets a second preset condition;
in the application, the reciprocal approximation circuit approximates the reciprocal of the fractional part by using a piecewise function meeting a second preset condition according to a linear approximation principle.
In the present application, to simplify the implementation of the circuit, the approximation is done by a simple piecewise function, where accuracy allows.
The function is: y is 1 =1/f,0.50≤f<1
A piecewise function may be used:
to approximate, wherein, y 2 Is a function y 1 The piecewise approximation function of. x is a number between 0.50 and 1, a, b, c, d are constants selected by the piecewise function;
specifically, the selection criteria of the constants are the following two:
the piecewise function obtained by using the set of constants can be better approximated as the function y 1
The set of constants is to be as simple as possible in circuit implementation if condition 1) is satisfied.
For example, we choose x =0.75, a = -2.5, b = -3.25, c = -1.5, d = -2.5 to approximate a value of 1/f. Fig. 3 is a graph showing a comparison relationship between an accurate value and an approximate value of 1/f provided in an embodiment of the present application, where two curves respectively show the accurate value and the approximate value of 1/f, a solid line is the accurate value of 1/f in an interval of [0.5,1.0 ], and a dotted line is the approximate value obtained by approximation using a two-stage linear function. FIG. 4 shows that the error between the 1/f exact value and the approximate value provided in the first embodiment of the present application has been converted to a dB value, and it can be seen that the error between the reciprocal and the true value obtained by the piecewise approximation method is within 0.5 dB (within 6%), which is sufficient for many applications that do not require exact values.
S103: and multiplying the piecewise function and the exponential part by using a multiplication circuit to calculate an approximate value of the function to be solved.
The inverse of the data value, i.e. the function to be solved:
multiplication operation is common in circuit design, and all places needing division operation can be converted into multiplication operation and reciprocal operation to be completed.
It should be noted that, in the present application, two segments of the approximation function in the reciprocal approximation calculation may be selected, but not limited to two-segment function approximation; the approximation function in the reciprocal approximation calculation can be a linear function or other functions; the coefficients a, b, c and d of the first-order approximation function selected in the reciprocal approximation calculation can be selected from the values in the present example, but are not limited to the values in the present example, and for different applications, constant values meeting the application precision requirement are selected, and once the constant values are selected, the values are determined; the circuit simplification method in the application is suitable for all rational numbers and is not limited to integers; the present application may be used, but is not limited to, in digital circuits, as well as in software programs.
Example two
On the basis of the first embodiment, the second embodiment of the present application provides a reciprocal solution system, as shown in fig. 5, fig. 5 is a schematic structural diagram of the reciprocal solution system provided in the second embodiment of the present application, and the system includes: a separation circuit 201, a reciprocal approximation circuit 202, and a multiplication circuit 203, wherein,
the separation circuit 201 is used for decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition;
in the present application, the separation circuit may include: a mobile module and a recording module, wherein,
the moving module is used for moving the decimal point of the binary data corresponding to the denominator to the left or to the right until the moved data meet a first preset condition;
and the recording module is used for recording the moved data meeting the first preset condition as a decimal part and recording the number of the moved bits of the decimal point to obtain an exponential part.
Specifically, the first preset condition is not less than 0.5 and less than 1, or equal to 0.
A reciprocal approximation circuit 202 for approximating the reciprocal of the fractional part decomposed by the separation circuit 201 by using a piecewise function conforming to a second preset condition;
the multiplication circuit 203 is configured to multiply the piecewise function obtained by the reciprocal approximation circuit 202 by the exponential part obtained by decomposition by the separation circuit 201, and calculate an approximation value of the function to be solved.
The reciprocal approximation circuit 202 is specifically configured to approximate the reciprocal of the fractional part by using a piecewise function conforming to a second preset condition according to a linear approximation principle.
The same or similar parts as the first embodiment can be referred to each other, and are not described in detail in this embodiment.
According to the technical scheme, the method and the system for solving the reciprocal operation are provided, the reciprocal operation and the division operation in the digital circuit are converted into simple multiplication operation, the division circuit in the digital circuit is avoided, and therefore the circuit cost is reduced.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (6)

1. A method for solving reciprocal operations, comprising:
decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition by a separation circuit;
approximating, by an inverse approximation circuit, an inverse of the fractional part with a piecewise function that meets a second preset condition;
multiplying the piecewise function and the exponential part by utilizing a multiplication circuit to calculate an approximate value of the function to be solved;
wherein the first preset condition is not less than 0.5 and less than 1, or equal to 0;
the piecewise function meeting the second preset condition comprises:
wherein, y 2 Is a function y 1 Y1=1/f,0.50 ≦ f&1, f represents the fractional part; x is a number between 0.50 and 1; a, b, c, d are constants selected by the piecewise function.
2. The solution method according to claim 1, wherein said decomposing by a separation circuit the denominator in the function to be solved into an exponential part and a fractional part meeting a first preset condition comprises:
moving the decimal point of the binary data corresponding to the denominator to the left or to the right until the moved data meets the first preset condition, and recording the data as a decimal part;
the number of bits of the decimal point movement is noted to obtain the exponent portion.
3. The solution method according to claim 1, wherein said approximating, by an inverse approximation circuit, an inverse of the fractional part with a piecewise function that satisfies a second preset condition comprises:
and according to a linear approximation principle, approximating the reciprocal of the fractional part by using a piecewise function meeting a second preset condition.
4. A system for solving reciprocal operations, comprising: a separation circuit, a reciprocal approximation circuit, and a multiplication circuit, wherein,
the separation circuit is used for decomposing a denominator in a function to be solved into an exponential part and a decimal part meeting a first preset condition;
the reciprocal approximation circuit is used for approximating the reciprocal of the decimal part by a piecewise function meeting a second preset condition;
the multiplication circuit is used for multiplying the piecewise function and the exponential part and calculating an approximate value of the function to be solved;
wherein the first preset condition is not less than 0.5 and less than 1, or equal to 0;
the piecewise function meeting the second preset condition comprises:
wherein, y 2 Is a function y 1 Y1=1/f,0.50 ≦ f&1, f represents the fractional part; x is a number between 0.50 and 1; a, b, c, d are constants selected by the piecewise function.
5. The system according to claim 4, wherein the separation circuit comprises: a moving module and a recording module, wherein,
the moving module is used for moving the decimal point of the binary data corresponding to the denominator to the left or to the right until the moved data meet the first preset condition;
and the recording module is used for recording the moved data meeting the first preset condition as a decimal part and recording the number of bits moved by the decimal point to obtain an exponential part.
6. The system according to claim 4, wherein the reciprocal approximation circuit is configured to approximate the reciprocal of the fractional part using a piecewise function that satisfies a second predetermined condition according to a linear approximation principle.
CN201510672908.1A 2015-10-16 2015-10-16 Reciprocal operation solving method and reciprocal operation solving system Active CN105302520B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510672908.1A CN105302520B (en) 2015-10-16 2015-10-16 Reciprocal operation solving method and reciprocal operation solving system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510672908.1A CN105302520B (en) 2015-10-16 2015-10-16 Reciprocal operation solving method and reciprocal operation solving system

Publications (2)

Publication Number Publication Date
CN105302520A CN105302520A (en) 2016-02-03
CN105302520B true CN105302520B (en) 2018-03-23

Family

ID=55199827

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510672908.1A Active CN105302520B (en) 2015-10-16 2015-10-16 Reciprocal operation solving method and reciprocal operation solving system

Country Status (1)

Country Link
CN (1) CN105302520B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107274362B (en) * 2017-06-01 2021-01-15 西安电子科技大学 Optimization system and method for realizing oriented filtering by hardware
CN107832832A (en) * 2017-10-19 2018-03-23 珠海格力电器股份有限公司 Pooling operation method and device of convolutional neural network
CN111399803B (en) * 2019-01-03 2022-07-15 北京小米松果电子有限公司 Division operation method, device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1175730A (en) * 1996-07-25 1998-03-11 摩托罗拉公司 Method and apparatus for performing microprocessor integer division operations using floating point hardware
CN1510561A (en) * 2002-12-23 2004-07-07 ƽ System and method for designing and using analog circuit in modulation zone
CN103164621A (en) * 2013-03-15 2013-06-19 复旦大学 Partial fraction decomposition method suitable for system function with multiple high-order poles
JP2013210837A (en) * 2012-03-30 2013-10-10 Fujitsu Ltd Arithmetic circuit and arithmetic method
CN104598197A (en) * 2015-01-26 2015-05-06 中国科学院自动化研究所 Operation method for reciprocal value and/or reciprocal square root of floating-point number and operation device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1175730A (en) * 1996-07-25 1998-03-11 摩托罗拉公司 Method and apparatus for performing microprocessor integer division operations using floating point hardware
CN1510561A (en) * 2002-12-23 2004-07-07 ƽ System and method for designing and using analog circuit in modulation zone
JP2013210837A (en) * 2012-03-30 2013-10-10 Fujitsu Ltd Arithmetic circuit and arithmetic method
CN103164621A (en) * 2013-03-15 2013-06-19 复旦大学 Partial fraction decomposition method suitable for system function with multiple high-order poles
CN104598197A (en) * 2015-01-26 2015-05-06 中国科学院自动化研究所 Operation method for reciprocal value and/or reciprocal square root of floating-point number and operation device

Also Published As

Publication number Publication date
CN105302520A (en) 2016-02-03

Similar Documents

Publication Publication Date Title
US10491239B1 (en) Large-scale computations using an adaptive numerical format
CN105302520B (en) Reciprocal operation solving method and reciprocal operation solving system
EP3674883A1 (en) Multiplication circuit, system on chip, and electronic device
US20110010509A1 (en) System and method of sorting and calculating statistics on large data sets with a known value range
CN111310890B (en) Optimization method and device of deep learning model and terminal equipment
CN110888623B (en) Data conversion method, multiplier, adder, terminal device and storage medium
US20150113027A1 (en) Method for determining a logarithmic functional unit
Venkatachalam et al. Approximate sum-of-products designs based on distributed arithmetic
CN116466910A (en) Floating point number-based table lookup method and device, electronic equipment and storage medium
WO2021034387A1 (en) Flexible huffman tree approximation for low latency encoding
CN110222305B (en) Logarithmic function calculation system and method based on hyperbolic CORDIC
CN110187866B (en) Hyperbolic CORDIC-based logarithmic multiplication computing system and method
KR20210090249A (en) Image processing method, apparatus, vehicle-mounted computing platform, electronic device and system
US7606850B2 (en) Method and apparatus for providing a base-2 logarithm approximation to a binary number
CN113126954B (en) Method, device and arithmetic logic unit for floating point number multiplication calculation
CN106484753B (en) Data processing method
EP3401867A1 (en) Information publishing method, information publishing device and storage medium
JPH11212768A (en) Logarithmic value calculation circuit
He et al. A probabilistic prediction based fixed-width booth multiplier
WO2021039164A1 (en) Information processing device, information processing system, and information processing method
JP2008257407A (en) Logarithmic computing unit and logarithmic computing method
CN111384975A (en) Optimization method and device of multi-system LDPC decoding algorithm and decoder
CN111384974A (en) Confidence quantization method and device of multi-system LDPC code and decoder
US20240036821A1 (en) Floating-point number decoder
CN111581590B (en) Integral calculation method and device based on fixed point number variable

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 100084 floor 5F, No. 1, No. 1, Haidian District, Haidian District, Beijing

Patentee after: Beijing Angrui Microelectronics Technology Co., Ltd.

Address before: 100084 Beijing city Haidian District on the 7 Street No. 1 Building No. 1 Huizhong

Patentee before: BeiJing ZhongKe's Chinese is Electron Technology Co., Ltd all over the world

CP03 Change of name, title or address
CP01 Change in the name or title of a patent holder

Address after: 100084 5F, building 1, No.1, shangdiqi street, Haidian District, Beijing

Patentee after: Beijing Angrui Microelectronics Technology Co.,Ltd.

Address before: 100084 5F, building 1, No.1, shangdiqi street, Haidian District, Beijing

Patentee before: Beijing Angrui Microelectronics Technology Co.,Ltd.

CP01 Change in the name or title of a patent holder