CN112256235A - Division operation method, divider, division device, electronic device, and storage medium - Google Patents
Division operation method, divider, division device, electronic device, and storage medium Download PDFInfo
- Publication number
- CN112256235A CN112256235A CN202011173935.1A CN202011173935A CN112256235A CN 112256235 A CN112256235 A CN 112256235A CN 202011173935 A CN202011173935 A CN 202011173935A CN 112256235 A CN112256235 A CN 112256235A
- Authority
- CN
- China
- Prior art keywords
- division
- dividend
- divisor
- result
- value
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 73
- 238000003860 storage Methods 0.000 title claims abstract description 27
- 238000013507 mapping Methods 0.000 claims abstract description 58
- 238000012545 processing Methods 0.000 claims abstract description 11
- 238000004364 calculation method Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 15
- 239000000126 substance Substances 0.000 claims description 9
- 238000010586 diagram Methods 0.000 description 17
- 238000004891 communication Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 7
- 230000011218 segmentation Effects 0.000 description 6
- 238000010295 mobile communication Methods 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000007774 longterm Effects 0.000 description 2
- 239000002356 single layer Substances 0.000 description 2
- 241000764238 Isis Species 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 239000010410 layer Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000013215 result calculation Methods 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/38—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
- G06F7/48—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
- G06F7/52—Multiplying; Dividing
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Complex Calculations (AREA)
Abstract
The embodiment of the application discloses a division operation method, a divider, a division device, electronic equipment and a storage medium; wherein, the division device comprises: a selection unit, a division operation unit and a result output unit; the selection unit is used for selecting a corresponding group of target parameter values from a pre-stored mapping relation set according to the attribute of the dividend, the attribute of the divisor and the rounding mode of the division result; the division operation unit includes: the multiplier, the adder and the shifter are used for operating the dividend according to the group of target parameter values to obtain a division result; and the result output unit is used for outputting the division result after processing.
Description
Technical Field
The embodiment of the application relates to a digital signal processing technology, and relates to but is not limited to a division operation method, a divider, a division device, electronic equipment and a storage medium.
Background
In the mathematical operations of the physical layer codec and modem processes of the fourth Generation mobile communication (4th Generation, 4G) and fifth Generation mobile communication (5th Generation, 5G) systems, there are many integer division operations with a constant divisor. Since the rounding modes of the division result include rounding-down, rounding-up, and the like, different conditions need to be fully considered in designing the divider digital logic of the baseband chip to support different rounding modes.
In a divider implementation with a fixed divisor, the following methods are generally used: the first is to cyclically subtract the divisor from the dividend until the dividend is smaller than the divisor, and the number of cycles is the division result; the second method is to adopt a binary division vertical calculation method, and realize division operation through multiple shifts and subtractions.
However, both methods adopt an iterative manner, and a division result can be obtained only through operation of a plurality of cycles, so that the operation efficiency is restricted, and the requirements of efficient and fast operation cannot be met.
Disclosure of Invention
In view of this, the division operation method, the divider, the division device, the electronic device, and the storage medium provided in the embodiments of the present application can improve the operation efficiency of the division, thereby satisfying the requirement of efficient and fast operation. The division operation method, the divider, the device, the electronic equipment and the storage medium provided by the embodiment of the application are realized as follows:
the division apparatus provided in the embodiment of the present application includes: a selection unit, a division operation unit and a result output unit; the selection unit is used for selecting a corresponding group of target parameter values from a pre-stored mapping relation set according to the attribute of the dividend, the attribute of the divisor and the rounding mode of the division result; the division operation unit includes: the multiplier, the adder and the shifter are used for operating the dividend according to the group of target parameter values to obtain a division result; and the result output unit is used for outputting the division result after processing.
The divider provided by the embodiment of the application comprises: the multiplier is used for multiplying the dividend and the value of a second parameter in the input group of target parameter values to obtain a first operation result; the adder is used for performing addition operation on the first operation result and the value of a third parameter in the group of target parameter values to obtain a second operation result; and the shifter is used for performing shift operation on the second operation result and the value of the first parameter in the group of target parameter values to obtain a division result.
The division operation method provided by the embodiment of the application comprises the following steps: selecting a corresponding group of target parameter values from a pre-stored mapping relation set according to the attribute of the dividend, the attribute of the divisor and the rounding mode of the division result; multiplying the dividend and a value of a second parameter in the group of target parameter values to obtain a first operation result; adding the first operation result and the value of a third parameter in the group of target parameter values to obtain a second operation result; and carrying out shift operation on the second operation result and the value of the first parameter in the group of target parameter values to obtain a division result.
An electronic device provided in an embodiment of the present application includes a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the processor executes the computer program to implement the method according to the embodiment of the present application.
A computer-readable storage medium is provided in an embodiment of the present application, on which a computer program is stored, and the computer program, when executed by a processor, implements a method according to an embodiment of the present application.
The electronic device provided in the embodiments of the present application includes any one of the division apparatuses in the embodiments of the present application.
In the embodiment of the application, a division device is provided, in which a selection unit selects a corresponding set of target parameter values from a pre-stored mapping relation set according to the attribute of a dividend, the attribute of a divisor and the rounding mode of a division result; the division operation unit comprises a multiplier, an adder and a shifter and is used for operating the dividend according to the group of target parameter values to obtain a division result; therefore, the division result can be obtained without adopting an iteration mode, and the division device can obtain the division result more quickly so as to meet the requirement of efficient and quick operation.
Drawings
Fig. 1 is a schematic diagram of a network architecture to which the present invention may be applied;
fig. 2 is a schematic structural diagram of a division apparatus according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of another division apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of another division apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of another division apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another division apparatus according to an embodiment of the present application;
FIG. 7 is a diagram illustrating a divider according to an embodiment of the present disclosure;
FIG. 8 is a schematic diagram illustrating an implementation flow of a division operation method according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a logic circuit according to an embodiment of the present application;
FIG. 10 is a schematic diagram of another embodiment of a logic circuit;
FIG. 11 is a schematic diagram of a logic circuit according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of another division apparatus according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, specific technical solutions of the present application will be described in further detail below with reference to the accompanying drawings in the embodiments of the present application. The following examples are intended to illustrate the present application but are not intended to limit the scope of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
It should be noted that the terms "first \ second \ third" are used in this embodiment of the application to distinguish similar or different objects and do not represent a particular ordering for the objects. It is to be understood that the terms first, second, and third, if any, may be used interchangeably with the specified order or sequence to enable the embodiments of the application described herein to be practiced in other sequences than those illustrated or described herein.
The network architecture and the service scenario described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. As can be known to those skilled in the art, with the evolution of network architecture and the emergence of new service scenarios, the technical solution provided in the embodiments of the present application is also applicable to similar technical problems.
The technical solution of the embodiment of the present application may be applied to the 4th Generation mobile communication system (4G), the fifth Generation mobile communication technology (5th-Generation wireless communication technology, 5G), a New Radio (NR) system or a future communication system, and may also be applied to other various wireless communication systems, for example: a narrowband Band-Internet of Things (NB-IoT) System, a Global System for Mobile communications (GSM), an Enhanced Data rate for GSM Evolution (EDGE) System, a Wideband Code Division Multiple Access (WCDMA) System, a Code Division Multiple Access (Code Division Multiple Access) 2000 System, a Time Division synchronous Code Division Multiple Access (Time Division-synchronous Code Division Multiple Access, TD-SCDMA) System, a General Packet Radio Service (GPRS), a Long Term Evolution (Long Term Evolution, LTE) System, a Frequency Division Duplex (FDD) System, an LTE (Time Division Duplex, TDD) System, and a UMTS-Universal Mobile telecommunications System.
Fig. 1 illustrates a network architecture to which embodiments of the present application may be applied. As shown in fig. 1, the network architecture provided by the present embodiment includes: a network device 101 and a terminal 102. The division apparatus provided in the embodiment of the present application may be applied to the terminal 102 shown in fig. 1, for example, to a codec or a modem of the terminal. The terminal 102 may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem with wireless communication capabilities, as well as various forms of user terminal equipment (terminal device) or Mobile Station (MS), among others.
The division apparatus provided in the embodiment of the present application may also be applied to the network device 101 shown in fig. 1, for example, the division apparatus is applied to a codec or a modem of the network device 101. The network device 101 may be a device deployed in a radio access network to provide wireless communication functions for the terminal 102. In the embodiment of the present application, the network device may be, for example, a base station shown in fig. 1, and the base station may include various forms of macro base stations, micro base stations, relay stations, or access points.
Fig. 2 is a schematic structural diagram of the division apparatus provided in the embodiment of the present application, and as shown in fig. 2, the division apparatus 20 includes a selection unit 201, a division operation unit 202, and a result output unit 203; wherein the content of the first and second substances,
a selecting unit 201, configured to select a corresponding set of target parameter values from a pre-stored mapping relationship set according to the attribute of the dividend, the attribute of the divisor, and the rounding manner of the division result.
In some embodiments, each set of candidate parameter values in the mapping relationship set is used as an input of the division operation unit, so that the division operation unit can correctly operate each dividend in the value range of the dividend when the divisor is fixed. For example, when the division operation unit operates each dividend in the value range to which the current dividend belongs based on the set of target parameter values, a correct division result can be obtained.
In some embodiments, the dividend's attributes include, but are not limited to: signed or unsigned, positive or negative when signed, and the range of values to which the dividend belongs in the application scenario. The properties of the divisor include, but are not limited to: whether it is a signed or unsigned integer, whether it is an integer power of 2 when signed, and the relationship with the upper and lower bounds of the value range. The rounding of the division result can be varied, and can be, for example, rounding up, rounding down, rounding up to infinity, or rounding to zero, etc.
It should be noted that the value range to which the dividend belongs may be understood as the maximum value range to which the dividend belongs in the application scenario. The value range may be different for different application scenarios. For example, in the calculation of the packet Hopping (Group Hopping) parameter of the 5G NR Physical Uplink Control Channel (PUCCH), the initialization value of the pseudo random sequence is set to beWherein n isIDIs a parameter of high-level configuration, and the value range is 0 to 1023. For example, in a Code block segmentation (Code block segmentation) unit of 4G LTE, the number of segmented Code blocks isWherein Z is 6144, L is 24, so Z-L is 6120 is a constant, B is the number of bits of the transmission data block after Cyclic Redundancy Check (CRC) coding, and the range of B is 40 to 137816 in single-layer transmission.
In the embodiment of the present application, the type of the divisor is not limited, and the divisor may be an unsigned integer, a signed integer, or an unsigned or signed fraction (the fraction is a rational number).
In some embodiments, the selecting unit 201 may be configured to update the product of the dividend and the denominator of the divisor to the dividend and update the numerator of the divisor to the divisor when the divisor is a fraction and is a rational number; and selecting a corresponding group of target parameter values according to the updated dividend attribute, the updated divisor attribute and the rounding mode of the division result.
The division operation unit 202 includes a multiplier 2021, an adder 2022, and a shifter 2023, and is configured to perform an operation on the dividend according to the set of target parameter values to obtain a division result.
And a result output unit 203, configured to output the division result after processing.
The manner in which the division result is processed is application scenario dependent. For example, in an application scenario of unsigned integer division (i.e., the dividend and the divisor are both unsigned integers), the divisor and each dividend are both positive numbers or both negative numbers, the result output unit 203 may directly output the division result.
For another example, in an application scenario where each dividend is a non-negative integer and the divisor is a non-positive integer, or each dividend is a non-positive integer and the divisor is a non-negative integer, the result output unit 203 inverts the division result and outputs the result, provided that the division result output to the output unit 203 by the division operation unit is obtained based on the absolute value of the dividend.
For another example, in an application scenario where a part of dividends in the value range are non-negative integers, another part of dividends are non-positive integers, and the divisors are non-negative integers, the result output unit 203 determines whether to directly output the division result or to output the division result after inverting the division result according to the signs of the dividends, which is also assumed that the division result output to the output unit 203 by the division operation unit 202 is obtained based on the absolute values of the dividends.
In the embodiment of the application, a division device is provided, in which a selection unit selects a corresponding set of target parameter values from a pre-stored mapping relation set according to the attribute of a dividend, the attribute of a divisor and the rounding mode of a division result; the division operation unit comprises a multiplier, an adder and a shifter and is used for operating the dividend according to the group of target parameter values to obtain a division result; therefore, the division result can be obtained without adopting an iteration mode, and the division device can obtain the division result more quickly, thereby meeting the requirements of efficient and quick operation and further shortening the communication time delay.
In some embodiments, each set of candidate parameter values in the mapping relationship set is used as an input of the division operation unit, so that the division operation unit can correctly operate each dividend in the value range to which the dividend belongs when the divisor is fixed.
It can be understood that, because each group of candidate parameter values in the mapping relation set is used as the input of the division operation unit, the division operation unit can correctly operate each dividend in the value range to which the corresponding dividend belongs when the corresponding divisor is fixed. Therefore, the division result of each dividend does not need to be stored in advance, and the storage resource is greatly saved.
For example, in the calculation of the packet frequency hopping (grouphping) parameter of the 5G NR Physical Uplink Control Channel (PUCCH), the initialization value of the pseudo random sequence isWherein n isIDIs a parameter of high-level configuration, and the value range is 0 to 1023. In practical application, based on the above embodiment, a set of candidate parameter values suitable for the application scenario is stored in a mapping relationship set, that is, the division operation requirement of the application scenario can be met. That is, the set of candidate parameter values is used as the input of the division operation unit, so that the division operation unit can correctly operate 1024 dividends in the range of 0 to 1023, and a correct division result is obtained. However, if the mapping relationship is concentrated based on the related table lookup method, the division results corresponding to the 1024 dividends respectively need to be stored in advance, and in practical application, the corresponding division results are found by table lookup according to the current dividend. However, this solution comes at the cost of sacrificing a large amount of memory resources of the memory.
For example, in a Code block segmentation (Code block segmentation) unit of 4G LTE, the number of segmented Code blocks isWhere Z is 6144 and L is 24, so Z-L is 6120 is a constant, and B is the number of bits of the transport block after CRC coding, which ranges from 40 to 137816 for single layer transmission. It can be seen that if a table look-up method is used, the image is displayedThe set of relations needs to store the division results corresponding to the 137777 dividends in the range of 40 to 137816 in advance. By adopting the technical scheme provided by the embodiment of the application, the mapping relation set only needs to store a group of candidate parameter values suitable for the application scene, and the group of parameter values are used as the input of the division operation unit, so that the division operation unit can correctly operate the 137777 dividends in the range of 40 to 137816, thereby meeting the communication requirement and greatly saving the storage resources.
In some embodiments, the set of mapping relationships comprises a corresponding first subset of relationships if the dividend and the divisor are both unsigned integers and the rounding is round down. The first subset of relationships includes a first entry, a second entry, a third entry, and/or a fourth entry. Thus, the 4 first entries are stored in the first relational subset, so that the requirements of division operations of different rounded-down divisors in unsigned integer division can be met.
A first entry comprising a corresponding set of candidate parameters (N, M, L) having values of (N) where the divisor is an integer power of 21,M1,L1);(N1,M1,L1)=(log2b,1,0), b denotes a divisor, N denotes a first parameter, M denotes a second parameter, and L denotes a third parameter.
It will be appreciated that, in practical applications, whatever the specific values of the dividend and divisor, the selection circuit may select the corresponding set of candidate parameter values (N) from the set of mapping relationships according to the conditions as long as the conditions are satisfied such that the unsigned integer, the divisor raised to the power of 2, and the rounding manner is rounding down1,M1,L1) As a set of target parameter values for the input divide unit. From another perspective, a set of candidate parameter values is stored in the mapping relation set, and the set of candidate parameter values corresponds to the selection condition: dividends and divisors are unsigned integers, divisors are integer powers of 2, and rounding is down. The following mapping conditions for the second entry and other candidate parameter values may be understood by those skilled in the art with reference to the explanation herein.
It should be noted that the mapping relation set stores the mapping relation set which is already calculated in advance (N)1,M1,L1). The calculation formula (N) is given here1,M1,L1)=(log2b,1,0) for the purpose of description (N)1,M1,L1) How to obtain the parameter values, so that the dividing operation unit can accurately operate each dividend in the value range to which the corresponding dividend belongs when the group of candidate parameter values are used as the input of the dividing operation unit.
A second entry including when the divisor is not an integer power of 2 andin the case of (A), the value of the corresponding set of candidate parameters (N, M, L) is (N)2,M2,L2);amaxIs the upper bound value of the value range, aminIs the lower bound of the value range.
In some embodiments, the set of mapping relationships may store selection conditions such that the dividend and the divisor are both unsigned integers, the rounding is down, the divisor is not an integer power of 2, andand a set of candidate parameter values (N) corresponding to the selection condition2,M2,L2)。
A third entry, including when the divisor is not an integer power of 2, andin the case of (A), the value of the corresponding set of candidate parameters (N, M, L) is (N)3,M3,L3);
A fourth object, consisting in that the divisor is an integer number other than 2Powers of andin the case of (a), the values of the corresponding set of candidate parameters (N, M, L) are:
wherein N isminIs from N to equalStarting search upwards until satisfiedThe minimum N of the time is,
based on the first subset of relationships, in some embodiments, the set of mapping relationships may further include a corresponding second subset of relationships if the dividend and the divisor are unsigned integers and the rounding manner is rounding up; wherein the lower bound value of the dividend is updated toThe upper bound value is updated to amax+ b-1, each set of candidate parameters in said second subset of relationships, respectivelyThe relationship of the values of a set of candidate parameters (N, M, L) corresponding to the same case in the first subset of relationships is: is indicative of the first parameter or parameters of the device,is indicative of the second parameter or parameters of the device,representing the third parameter.
For example, a fifth entry in the second subset of relationships includes a corresponding set of candidate parameter values that are the dividend raised to the power of 2And a first entry in the first subset of relationships includes a corresponding set of candidate parameter values of (N) if the dividend is an integer power of 21,M1,L1);(N1,M1,L1) Is thatA set of candidate parameter values corresponding to the same situation. Because the relationship between the two is as follows:and (N)1,M1,L1) Is equal to (log)2b,1,0), and therefore:
likewise, in some embodiments, stored in the second subset of relationships are pre-computed candidate parameter valuesRather than toTherefore, the complexity of division operation can be saved, and the communication time delay is improved.
It will be appreciated that in practice, the selection circuit may select the mapping whatever the values of the dividend and divisor are, provided that the conditions of unsigned integer, divisor to the power of 2, and rounding to round up are metThe set of candidate parameter values corresponding to the conditions in the set of ray relationsAs a set of target parameter values for the input divide unit. From another perspective, the mapping relation collectively stores a set of candidate parameter valuesThe selection conditions corresponding to the set of candidate parameter values are: the dividend and divisor are unsigned integers, the divisor is an integer power of 2, and the rounding is up.
Similarly, for a sixth entry in the second subset of relationships includes a divisor that is not an integer power of 2In the case of (2), the corresponding set of candidate parameter values isThen (N) for a second entry in the first subset of relationships2,M2,L2) Is thatA set of candidate parameter values corresponding to the same situation. For theThe calculation formula (c) is not specifically derived, and the derivation process andsimilarly. The mapping relation collectively stores a set of candidate parameter valuesThe selection conditions corresponding to the set of candidate parameter values are: dividends and divisors being unsigned integers, rounded up in a manner other than to the power of 2
Of course, a seventh entry may also be included in the second subset of relationships, the entry including a divisor that is not an integer power of 2In case of a corresponding set of candidate parameter valuesThat is, the mapping relation collectively stores a set of candidate parameter valuesThe selection conditions corresponding to the set of candidate parameter values are: dividends and divisors being unsigned integers, rounded up in a manner other than to the power of 2Is equal to
In some embodiments, the second subset of relationships may further include an eighth entry that includes a divisor that is not an integer power of 2In case of a corresponding set of candidate parameter valuesThat is, the mapping relation collectively stores a set of candidate parameter valuesThe selection conditions corresponding to the set of candidate parameter values are: dividends and divisors being unsigned integers, rounded up in a manner other than to the power of 2
It should be noted that the second relationship subset may include at least one of the above fourth to eighth items.
Based on the first subset of relationships, in some embodiments, the set of mapping relationships may further include a corresponding third subset of relationships if the dividend and the divisor are unsigned integers and the rounding manner is rounding; wherein the lower bound value of the dividend is updated toThe upper bound value is updated toEach set of candidate parameters in the third subset of relationshipsThe relationship of the values of a set of candidate parameters (N, M, L) corresponding to the same case in the first subset of relationships is: is indicative of the first parameter or parameters of the device,is indicative of the second parameter or parameters of the device,representing the third parameter.
In summary, the mapping relationship set may include at least one entry content as shown in table 1 below. In this way, when the content of each of the following table entries is included in the mapping relationship set, a large amount of storage resources can be saved, and meanwhile, the division device can support division operation scenarios of multiple rounding modes and multiple divisors without changing the structure of the division device.
TABLE 1
It is understood that the function of the selection unit 201 in the division apparatus 20 may be different in different application scenarios. For example, in an application scenario of unsigned integer division, the selecting unit 201 is configured to select a corresponding set of target parameter values from the mapping relationship set according to whether the divisor is an integer power of 2, a relationship between the divisor and upper and lower boundary values of the value range, and a rounding manner of a division result.
For another example, in an application scenario of signed integer division, the selecting unit circuit 201 is configured to, when the dividend and the divisor are both positive numbers or both negative numbers, select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to whether the dividend and the divisor are unsigned integers, whether the divisor is an integer power of 2, a relationship between the divisor and upper and lower boundary values of the value range, and a rounding manner of a division result.
It is to be understood that by signed integer division, it is meant that each dividend in the application scenario is a signed integer, and the divisor may be a signed integer or an unsigned integer. In general, in an application scenario, the divisor is fixed, i.e., a constant.
And/or the selecting unit 201 is configured to select, when the rounding mode of the division result is rounding to infinity, or when one of the dividend and the divisor is a positive number and the other is a negative number and the rounding mode of the division result is rounding down, a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that the dividend and the divisor are unsigned integers, the rounding mode of the division result is rounding up, the relation between the divisor and upper and lower boundary values of the value range is obtained, and whether the divisor is an integer power of 2.
And/or the selecting unit 201 is configured to select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that the dividend and the divisor are unsigned integers, the division result is rounded down, the divisor is in a relationship with upper and lower boundary values of the value range, and the divisor is an integer power of 2, when the rounding mode of the division result is rounding to zero, or when one of the dividend and the divisor is a positive number and the other is a negative number, and the rounding mode of the division result is rounding up.
And/or, the selecting unit 201 is configured to, when the rounding mode of the division result is rounding, select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that the dividend and the divisor are both unsigned integers, the rounding mode of the division result is rounding, the relationship between the divisor and the upper and lower boundary values of the value range, and whether the divisor is an integer power of 2.
In some embodiments, when both the upper and lower bounds of the range are greater than or equal to zero, the relationship between the divisor and the upper and lower bounds of the range includesAnda relation of (A), orAndthe relationship of (1);
in some embodiments, when the upper bound of the range is greater than or equal to zero and the lower bound is less than or equal to zero, the range may be updated as:correspondingly, the relationship between the divisor and the upper and lower limits of the range includes 0 anda relation of (1) withThe relationship of (1);
in some embodiments, when both the upper and lower bounds of the range are less than or equal to zero, the upper bound of the range is updated toThe lower bound value is updated toCorrespondingly, the relationship between the divisor and the upper and lower bounds of the range of values includes:anda relation of (A), orAndthe relationship (2) of (c).
It should be noted that, for an application scenario in which the divisor is a fraction and is a rational number, the value range is also updated. That is, the upper bound value of the value range of the updated dividend is the product of the upper bound value of the value range of the dividend before updating and the denominator of the divisor, and the lower bound value of the value range of the updated dividend is the product of the lower bound value of the value range of the dividend before updating and the denominator of the divisor.
It will be appreciated that in the context of signed integer division, the divisor may be either a positive or a negative number, and each dividend belonging to the range of values to which the dividend belongs may be a non-negative or a non-positive number, or some dividends may be positive and some dividends may be negative, depending on the particular context. The structure of the division device corresponding to a specific application scenario may be different. For example, in an application scenario where both the upper bound value and the lower bound value of the range to which the dividend belongs are less than or equal to zero and the divisor is also less than or equal to zero, that is, each dividend in the range is not a positive number, and the divisor is not a positive number, in the application scenario, as shown in fig. 3, the division apparatus 30 may include a selecting unit 301, a division operating unit 302, a result output unit 303, and an absolute value calculating unit 304; wherein the content of the first and second substances,
a selecting unit 301, configured to select a corresponding set of target parameter values from the pre-stored mapping relationship set according to whether the dividend and the divisor are unsigned integers, whether the divisor is an integer power of 2, a relationship between the divisor and an upper and lower boundary value of the value range, and a rounding manner of a division result.
An absolute value calculating unit 304, configured to calculate an absolute value of the dividend and output the absolute value to the division operation unit 302.
It should be noted that in some application scenarios, for example, the upper bound value is greater than or equal to zero and the lower bound value is greater than or equal to zero, and the divisor is a positive number, that is, each dividend in the value range is not a negative number, in these application scenarios, the division apparatus 30 may include the absolute value calculating unit 304, or certainly may not include the absolute value calculating unit 304. When not included, the division operation unit 302 is configured to operate the dividend according to a set of target parameter values, and directly output the obtained division result through the result output unit 303.
A division operation unit 302, configured to perform an operation on the absolute value according to the set of target parameter values to obtain a division result;
a result output unit 303, configured to output the division result.
In an application scenario of signed integer division, where an upper bound of the value range is less than or equal to zero, a lower bound of the value range is less than or equal to zero, and the divisor is a non-negative integer, as shown in fig. 4, the division apparatus 40 includes a selecting unit 401, an absolute value calculating unit 402, a division operation unit 403, and an inverse number taking unit 404; wherein the content of the first and second substances,
a selecting unit 401, configured to select, when a rounding manner of the division result is rounding down or rounding to infinity, a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that both the dividend and the divisor are unsigned integers, that a rounding manner of the division result is rounding up a relationship between the divisor and upper and lower boundary values of the value range, and whether the divisor is an integer power of 2;
and/or, the selecting unit 401 is configured to, when the rounding manner of the division result is rounding up or rounding to zero, select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to whether the dividend and the divisor are unsigned integers, the division result is rounding down, the relation between the divisor and the upper and lower boundary values of the value range, and the divisor is an integer power of 2;
and/or, the selecting unit 401 is configured to, when the rounding mode of the division result is rounding, select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that the dividend and the divisor are both unsigned integers, the rounding mode of the division result is rounding, the relationship between the divisor and the upper and lower boundary values of the value range, and whether the divisor is an integer power of 2;
an absolute value obtaining unit 402 configured to determine an absolute value of the dividend and output the absolute value to a division operation unit 403;
a division operation unit 403, configured to perform an operation on the absolute value according to the set of target parameter values to obtain a division result;
and an inverse number unit 404, configured to output the division result after inverting the division result.
Here, the inverse number taking unit 404 is one implementation of the result output unit. In some embodiments, the result output unit may include an output interface for directly outputting the division result. In other embodiments, the result output unit may include an inverse number taking subunit and an output subunit, and the functions of the two subunits may be referred to in the description of the following embodiments.
In some embodiments, when both the upper and lower bounds of the range are greater than or equal to zero, divide byThe relationship between the number and the upper and lower limits of the value range includesAnda relation of (A), orAndthe relationship of (1);
in some embodiments, when the upper bound of the range is greater than or equal to zero and the lower bound is less than or equal to zero, the range may be updated as:correspondingly, the relationship between the divisor and the upper and lower limits of the range includes 0 anda relation of (1) withThe relationship of (1);
in some embodiments, when both the upper and lower bounds of the range are less than or equal to zero, the upper bound of the range is updated toThe lower bound value is updated toCorrespondingly, the relationship between the divisor and the upper and lower bounds of the range of values includes:anda relation of (A), orAndthe relationship (2) of (c).
In the application scenario of signed integer division and non-negative integer divisor, as shown in fig. 5, the division apparatus 50 includes an input unit 501, a selection unit 502, a division operation unit 503, and a result output unit 504; the input unit 501 includes an absolute value calculation subunit 5011 and a symbol calculation subunit 5012; result output unit 504 includes inverse number taking subunit 5041 and output subunit 5042;
an absolute value calculation subunit 5011, configured to determine an absolute value of the dividend, output the absolute value to the division calculating unit 503, so that the division calculating unit 503 calculates the absolute value, and output the obtained division result to the output subunit 5042;
a sign-finding subunit 5012, configured to determine the sign of the dividend, and output the sign of the dividend to the output subunit 5042;
a selecting unit 502, configured to select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that the dividend and the divisor are unsigned integers, the rounding of the division result is performed by rounding the divisor upward to an integer power of 2, and the divisor is an integer power of 2;
and/or, the selecting unit 502 is configured to, when the rounding mode of the division result is rounding up or rounding to zero, select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to whether the dividend and the divisor are unsigned integers, the division result is rounding down, the relation between the divisor and the upper and lower boundary values of the value range, and the divisor is an integer power of 2;
and/or, the selecting unit 502 is configured to, when the rounding mode of the division result is rounding, select a corresponding set of target parameter values from the set of mapping relationships stored in advance according to that the dividend and the divisor are both unsigned integers, the rounding mode of the division result is rounding, the relationship between the divisor and the upper and lower boundary values of the value range, and whether the divisor is an integer power of 2;
a division operation unit 503, configured to perform an operation on the absolute value according to the set of target parameter values to obtain a division result;
an inverse number obtaining subunit 5041, configured to output the inverse number to the output subunit after determining the inverse number of the division result;
the output subunit 5042 is configured to select and output a division result with the same sign as the dividend from the division result and the inverse number.
In practical applications, the division apparatus 50 is mostly suitable for such application scenarios, that is, the upper bound value of the value range to which the dividend belongs is greater than or equal to zero, the lower bound value is less than or equal to zero, and the divisor is a non-negative integer. That is, in the application scenario, the dividend may be greater than or equal to zero or less than or equal to zero, and a part of dividends in the value range are non-positive numbers and a part of dividends are non-negative numbers.
It should be noted that, in some embodiments, when both the upper and lower boundary values of the value range are greater than or equal to zero, the relationship between the divisor and the upper and lower boundary values of the value range includesAnda relation of (A), orAndthe relationship of (1);
in some embodiments, the value range is chosen such that the upper bound is greater than or equal to zero and the lower bound is less than or equal to zeroThe range may be updated as:correspondingly, the relationship between the divisor and the upper and lower limits of the range includes 0 anda relation of (1) withThe relationship of (1);
in some embodiments, when both the upper and lower bounds of the range are less than or equal to zero, the upper bound of the range is updated toThe lower bound value is updated toCorrespondingly, the relationship between the divisor and the upper and lower bounds of the range of values includes:anda relation of (A), orAndthe relationship (2) of (c).
Fig. 6 is a schematic view of another structure of the division apparatus provided in the embodiment of the present application, and as shown in fig. 6, the division apparatus 60 includes a selection unit 601, a division operation unit 602, and a result output unit 603; wherein the content of the first and second substances,
a selecting unit 601, configured to select a corresponding set of target parameter values from a pre-stored mapping relationship set according to an attribute of a dividend, an attribute of a divisor, and a rounding manner of a division result;
in some embodiments, when each group of candidate parameter values in the mapping relationship set is used as an input of the division operation unit 602, the division operation unit 602 can correctly operate each dividend within a value range to which the corresponding dividend belongs when the corresponding divisor is fixed;
as shown in fig. 6, the division operation unit 602 includes: a multiplier 6021, configured to perform multiplication operation on the dividend and a value of a second parameter in the set of target parameter values to obtain a first operation result; an adder 6022, configured to perform addition operation on the first operation result and a value of a third parameter in the set of target parameter values to obtain a second operation result; a shifter 6023, configured to perform shift operation on the second operation result and the value of the first parameter in the set of target parameter values to obtain the division result.
In the embodiments of the present application, the functions of the division unit may be implemented by software, for example, by a processor, i.e., the multiplier, adder and shifter are implemented by corresponding program codes.
The function of the division unit can also be realized by hardware, i.e. the multiplier, adder and shifter are realized by corresponding logic circuits. In hardware implementation, as shown in table 2, in some application scenarios, for example, the value of the second parameter is not 1, the value of the third parameter is not 0, and the value of the first parameter is not 0 in the input target parameter values, the division operation unit 602 may include a multiplier 6021, an adder 6022, and a shifter 6023. In some application scenarios, for example, if the value of the second parameter is 1, the value of the third parameter is not 0, and the value of the first parameter is not 0, in the input target parameter values, the division operation unit 602 may not include a multiplier, so as to save hardware space and production cost of the division operation unit 602, and also save power consumption of the division operation unit 602. In some application scenarios, for example, if the value of the second parameter is not 1, the value of the third parameter is 0, and the value of the first parameter is not 0, the division unit 602 may not include an adder. In some application scenarios, if the value of the second parameter is not 1, the value of the third parameter is not 0, and the value of the first parameter is 0, among the input target parameter values, the division unit 602 may not include a shifter. For the other target parameter values shown in table 2, the components included in the corresponding division unit 602 are not described again, and can be understood by referring to the above description.
TABLE 2
Value of target parameter (N, M, L) | The division operation unit 602 includes devices |
(not 1, not 0) | Multiplier, adder and shifter |
(1, not 0) | Adder and shifter |
(not 1,0, not 0) | Multiplier and shifter |
(not 1, not 0, 0) | Multiplier and adder |
(1, 0, not 0) | Shifting device |
(not 1,0, 0) | Multiplier and method for generating a digital signal |
(1, not 0, 0) | Adder |
And a result output unit 603, configured to output the division result after processing.
In some embodiments, the result output unit 603 may directly output the division result, and such a division apparatus is mostly suitable for an application scenario of unsigned integer division, i.e. the divisor and each dividend are unsigned integers, and such a division apparatus is also suitable for an application scenario of signed integer division, where each dividend and divisor are non-negative integers.
It should be noted that each unit included in the division apparatus and the sub-unit included in each unit described in the embodiment of the present application may be implemented by a processor, and may also be implemented by a specific logic circuit; in addition, the method can be realized by combining software and hardware. In implementation, the processor may be a Central Processing Unit (CPU), a Microprocessor (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or the like.
Fig. 7 is a schematic structural diagram of a divider according to an embodiment of the present invention, and as shown in fig. 7, the divider 70 includes: a multiplier 701, an adder 702, and a shifter 703; wherein the content of the first and second substances,
a multiplier 701, configured to perform multiplication on a dividend and a value of a second parameter in the input set of target parameter values to obtain a first operation result;
in some embodiments, the set of target parameter values enables the divider 70 to operate correctly for each dividend within the range of values to which the dividend belongs when the divisor is fixed;
an adder 702, configured to perform an addition operation on the first operation result and a value of a third parameter in the set of target parameter values to obtain a second operation result;
a shifter 703, configured to perform a shift operation on the second operation result and the value of the first parameter in the set of target parameter values to obtain a division result.
In some embodiments, the divider 70 further comprises a selection circuit for selecting a corresponding set of target parameter values from a pre-stored set of mapping relationships according to the dividend attribute, the divisor attribute, and the rounding mode of the division result
The above description of the divider embodiment is similar to the above description of the divider device embodiment, and has similar advantages to the divider device embodiment. For the content not disclosed in the divider embodiments of the present application, please refer to the description of the divider device embodiments of the present application.
An embodiment of the present application provides a division operation method, fig. 8 is a schematic diagram illustrating an implementation flow of the division operation method according to the embodiment of the present application, and as shown in fig. 8, the method may include the following steps 801 to 805:
in some embodiments, when each group of candidate parameter values in the mapping relation set is used as the input of the division operation unit, the division operation unit can correctly operate each dividend in the value range to which the corresponding dividend belongs when the corresponding divisor is fixed; the division operation unit may implement the following steps 802 to 804.
And step 805, processing the division result and outputting the processed division result.
The above description of the method embodiment is similar to the above description of the division apparatus embodiment, and has similar advantages as the division apparatus embodiment. For the content which is not disclosed in the method embodiments of the present application, please refer to the description of the division apparatus embodiments of the present application.
During the research, the inventor finds that in the related divider implementation with fixed divisor, there are several methods in general:
the first method is based on a lookup table, and calculates all possible division results in advance and stores the division results in the lookup table, and only the dividend is required to be mapped to the index of the lookup table during calculation, and then the corresponding division result can be obtained according to the value of the index lookup table. If the results corresponding to all possible dividends are stored in the lookup table, the dividends and the lookup table indexes are in one-to-one mapping relation;
the second is to cyclically subtract the divisor from the dividend until the dividend is smaller than the divisor, and the number of cycles is the division result;
the third method is to adopt a binary division vertical calculation method to realize division operation through multiple shifts and subtractions. In n-bit unsigned division, for example, dividend a is divided by divisor b. First converting a into a with high n bits as 0 and low n bits as aConverting b into b in the upper n position and 0 in the lower n positionAt the beginning of each cycle, firstLeft shifted by one bit, tail complemented by 0, and then ANDComparing to determine if it is greater thanIf so, thenMinusAnd plus 1; otherwise, continuing to execute the next cycle. The above process is circulated n times, and after the process is finishedThe high n bits are the remainder, and the low n bits are the quotient.
In the three methods, the inventor finds the following defects through analysis:
in the first method based on the lookup table, when the dividend belongs to a large value range, the lookup table needs to store many division results, which consumes storage resources of the memory. For example, in the above calculation of the initialization value of the pseudo random sequence for packet hopping of the 5G NR physical uplink control channel PUCCH, 1024 possible n sequences need to be stored in advanceIDA rounded down division result of the value divided by 30. For example, in a Code block segmentation (Code block segmentation) unit of 4G LTE, it is necessary to store in advance an up-rounded division result of 137777 possible B values divided by 6120 for calculating the number of segmented Code blocks. Moreover, different lookup tables also need to be constructed for different rounding manners.
The second method and the third method both adopt an iterative mode, and the division result can be obtained only through operation of a plurality of cycles, so that the operation efficiency is restricted, and the two methods cannot meet the requirement of efficient and rapid operation.
An exemplary application of the embodiments of the present application in a practical application scenario will be described below.
In the embodiment of the application, a fixed divisor integer division calculation method flexibly supporting different rounding modes is provided. Among them, the unsigned integer division is explained as follows:
first, consider the case of unsigned integer division. The dividend a is an unsigned integer, and usually the dividend is limited by a value range or bit width, and has an upper bound and a lower bound, wherein the value range satisfies amin≤a≤amax(ii) a Let the divisor b be an unsigned integer constant, then the result of the rounding-down is represented asThe division result can be expressed as an approximation of the reciprocal multiplied by the divisor b, plus a rounding offsetThus, the values of a set of parameters (N, M, L) are pre-calculated, such that the equationThis holds for all dividends a.
(1) if b is an integer power of 2, (N, M, L) ═ log2b,1,0);
(2) If b is not an integer power of 2:
(c) If it isIs greater thanFromStart the search up until 2 is satisfiedNIs greater thanLet the minimum N found be denoted Nmin,
For calculating the division result rounded upDue to the fact thatConverting dividends intoThe value range of the strain is correspondingly changed intoAnd therefore can be calculated by converting into a method of rounding down the division result. Assuming that the values of the parameter set obtained by the method of the division result rounded down areThen according toCan obtain the product
For calculating a rounded division resultConverting dividends intoThe value range of the strain is correspondingly changed intoTherefore, the method can also be converted into a method for calculating the division result of rounding down. Assuming that the parameter set obtained by the method of the division result rounded down isThen according toCan obtain the product
Therefore, the division result calculation of the above three rounding modes can be expressed asIs suitably implemented with a multiplier 901, an adder 902 and a shifter 903 in the logic circuit 90, as shown in fig. 9. The dividend a and the parameter M are input to the multiplier 901, the multiplier 901 performs multiplication on the dividend a and the parameter M to obtain a first operation result, and outputs the first operation result to the adder 902, and the adder 902 performs addition operation on the input parameter L and the first operation result to obtain a second operation result; the adder 902 outputs the second operation result to the shifter 903, and the shifter 903 performs a shift operation on the second operation result and the input value of the parameter N to obtain a division result rounded down.
In practical application, a developer can solidify the pre-calculated values of the parameter sets (N, M, L) in a logic design, and further optimize the circuit according to specific parameter values, for example, when M is 1, the designed logic circuit can omit a multiplier, and when L is 0, the designed logic circuit can omit an adder; the developer can also configure the parameter values through registers, so that the designed logic circuit can realize the calculation support of a plurality of divisor values and a plurality of rounding modes.
In addition, the signed integer division is explained as follows:
extending to the case where the dividend is a signed integer. Let dividend a be a signed integer whose value range satisfiesThe divisor b is an unsigned integer constant. The case where the dividend and the divisor b are negative numbers can be converted into positive number calculations by inverting both the numerator and denominator.
If it isThe dividend values are all non-negative integers, and the calculation method is the same as the unsigned integer division.
If it isThe dividend values are all non-positive integers, and after the dividend values are inverted, the result of the division is calculated according to the unsigned integer division, and then the inverted number is obtained. The difference is that when the division result of rounding-down (minus infinity direction) is calculated, the inverse number is taken and then the calculation is carried out according to the mode of rounding-up (plus infinity direction) of unsigned integer; when the division result of the upward rounding (positive infinite direction) is calculated, the inverse number is taken and then the calculation is carried out according to the mode of downward rounding (negative infinite direction) of unsigned integers. The correspondence is shown in table 3 below:
TABLE 3
Signed division | Unsigned division after conversion |
Rounding down (negative infinite direction) | Rounding up (just infinite direction) |
Get rounded upwards (just without)Poor direction) | Rounding down (negative infinite direction) |
Round down on | Round down on |
If it isThe dividend may be a positive or negative number. The absolute dividend value is first changed to a non-negative integer, expressed asThe value range is correspondinglyThen, the division result is calculated according to the unsigned integer division, and finally, the sign of the quotient is determined according to the sign of the original dividend a. In addition, since the rounding method of unsigned division after conversion is related to the sign of the original dividend, it is necessary to calculate the values of the parameter sets according to at most two rounding methods, so that a corresponding set of parameter values can be dynamically selected as input according to the sign of the dividend during signed division operation. The specific correspondence between the signed division rounding mode and the converted unsigned division rounding mode is shown in table 4 below.
TABLE 4
In summary, signed integer division with different rounding modes can be realized by using at most two sets of parameter values, and the logic circuit thereof is as shown in fig. 10, after an absolute value is obtained by an absolute value obtaining circuit 101 for a signed dividend a, the absolute value is input to a multiplier 102, the multiplier 102 obtains parameter values selected from parameter values M1 and M2 according to the sign of the dividend a obtained by a sign obtaining circuit 104 by a selector 103, multiplies the absolute values, and inputs the obtained first operation result to an adder 105, the adder 105 adds the first operation result according to the parameter values selected from parameter values L1 and L2 according to the sign of the dividend a obtained by the sign obtaining circuit 104 by the selector 110, and inputs the obtained second operation result to a shifter 107; the shifter 107 performs shift operation on the second operation result according to the parameter value selected from the parameter values N1 and N2 by the selector 111 according to the sign of the dividend a obtained by the sign obtaining circuit 104, and inputs the obtained division result into the selector 109 and the inverse number taking circuit 108 respectively, and the inverse number taking circuit 108 inputs the division result into the selector 109 after negating the division result; the sign obtaining circuit 104 outputs the obtained sign of the dividend a to the selector 109; in this way, the selector 109 can select, from the division result and the inverted division result, a result output that matches the symbol according to the symbol.
Wherein, (N1, M1, L1) and (N2, M2, L2) are the parameter values corresponding to rounding modes of a ≧ 0 and a < 0, respectively.
If a ≧ 0 and a < 0 correspond to the same rounding mode, i.e., the two sets of parameter values are the same, the logic circuit shown in FIG. 10 can be simplified to the logic circuit shown in FIG. 11.
Similarly, two groups of pre-calculated parameter values (N1, M1, L1) and (N2, M2, L2) are solidified in the logic design, and the circuit is further optimized according to specific values; and the calculation support for a plurality of divisor values and a plurality of rounding modes can be realized through register configuration.
The technical scheme provided by the embodiment of the application has the following advantages: (1) division can be quickly calculated in one clock period, and the use of a lookup table memory is avoided; (2) various rounding modes are supported, and the adaptability is strong; (3) by means of the parameter configuration of the register, division calculation of a plurality of divisor values and a plurality of rounding modes can be realized under the condition of not changing the circuit structure; (4) unsigned integer division and signed integer division are supported.
In some embodiments, it may be extended to cases where the divisor is a rational number. Let dividend a be an integer, divideThe number b is a rational number and can be expressed asWherein c and d are integers, thenCan be converted intoIn the form of (1). The converted dividend ad and divisor c are both integers, so that division results in different rounding manners can be calculated by the method.
It should be noted that the division device described in the embodiment of the present application is illustrative in the division of the unit, and is only a logic function division, and there may be another division manner in actual implementation. In addition, functional units in the embodiments of the present application may be integrated into one processing unit, may exist alone physically, or may be integrated into one unit by two or more units. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. Or may be implemented in a combination of software and hardware. For example, fig. 12 is a schematic structural diagram of a division apparatus according to an embodiment of the present application, and as shown in fig. 12, the division apparatus 120 may include: a processor 121 and a divider 122; wherein the content of the first and second substances,
the processor 121 is configured to select a corresponding set of target parameter values from a pre-stored mapping relationship set according to the dividend attribute, the divisor attribute, and the rounding mode of the division result;
in some embodiments, each group of candidate parameter values in the mapping relation set is used as an input of the divider, so that the divider can correctly operate on each dividend in a value range to which the corresponding dividend belongs when the corresponding divisor is fixed;
a divider 122, configured to perform an operation on the dividend according to the set of target parameter values to obtain a division result;
and the processor 121 is configured to process and output the division result.
In some embodiments, divider 122 comprises: the multiplier is used for multiplying the dividend and the value of a second parameter in the group of target parameter values to obtain a first operation result; the adder is used for performing addition operation on the first operation result and the value of a third parameter in the group of target parameter values to obtain a second operation result; and the shifter is used for performing shift operation on the second operation result and the value of the first parameter in the group of target parameter values to obtain the division result.
It should be noted that, in the embodiment of the present application, if the division apparatus or the division method is implemented in the form of a software functional module and sold or used as a standalone product, the division apparatus or the division method may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a receiving device to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a magnetic disk, or an optical disk. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
Embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps in the division operation method provided in the above embodiments. The computer program, when executed by the processor, may also implement technical details not disclosed in the embodiments of the division operation method, as will be understood with reference to the description of the embodiments of the electronic device of the present application.
When part or all of the division operation methods provided in the above embodiments are implemented by software, as shown in fig. 13, the electronic device 130 includes: a memory 131 for storing programs; the processor 132 is configured to execute the program stored in the memory 131, and when the program is executed, the electronic device 130 may implement the division operation method provided in the foregoing embodiment.
Any electronic device provided by the embodiment of the application can also be a chip.
Embodiments of the present application provide a computer program product comprising instructions, which when run on a computer, enable the computer to perform the division method provided by the above method embodiments, and further perform technical details not disclosed in the above division method embodiments, as can be understood with reference to the description of the embodiments of the division apparatus of the present application.
Here, it should be noted that: the above description of the storage medium, chip and computer program embodiments is similar to the above description of the division apparatus embodiments, with similar beneficial effects as the above division apparatus embodiments. For technical details not disclosed in the embodiments of the storage medium, the chip and the computer program of the present application, reference is made to the description of the embodiments of the division apparatus of the present application.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" or "some embodiments" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" or "in some embodiments" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, storage medium, chip, computer program product, or device 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, apparatus, storage medium, chip, computer program product, or device. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, apparatus, storage medium, chip, computer program product, or device that comprises the element.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus, method, device, and the like may be implemented in other ways. The above-described embodiments of devices and the like are merely illustrative, for example, the division of the unit is only a logical functional division, and other division manners may be available in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be separately used as one module, or two or more units may be integrated into one module; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as a removable Memory device, a Read Only Memory (ROM), a magnetic disk, or an optical disk.
Alternatively, the integrated units described above in the present application may be stored in a computer-readable storage medium if they are implemented in the form of software functional modules and sold or used as independent products. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling an electronic device (to execute all or part of the methods described in the embodiments of the present application). And the aforementioned storage medium includes: a removable storage device, a ROM, a magnetic or optical disk, or other various media that can store program code.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
Features disclosed in several of the product embodiments provided in the present application may be combined in any combination to yield new product embodiments without conflict.
The features disclosed in the several apparatus embodiments provided in the present application may be combined in any combination to arrive at new apparatus embodiments without conflict.
Features disclosed in several of the electronic device embodiments provided herein may be combined arbitrarily without conflict to yield new electronic device embodiments.
The above description is only for the embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (20)
1. A division apparatus, comprising: a selection unit, a division operation unit and a result output unit; wherein the content of the first and second substances,
the selection unit is used for selecting a corresponding group of target parameter values from a prestored mapping relation set according to the attribute of the dividend, the attribute of the divisor and the rounding mode of the division result;
the division operation unit includes: the multiplier, the adder and the shifter are used for operating the dividend according to the group of target parameter values to obtain a division result;
and the result output unit is used for outputting the division result after processing.
2. The division apparatus of claim 1, wherein the selection unit is configured to:
when the divisor is a fraction and is a rational number and the dividend is an integer, updating a product of the dividend and a denominator of the divisor to the dividend and updating a numerator of the divisor to the divisor;
and selecting a corresponding group of target parameter values according to the updated dividend attribute, the updated divisor attribute and the rounding mode of the division result.
3. The division apparatus of claim 1 or 2 wherein the set of mapping relationships comprises a corresponding first subset of relationships if the dividend and the divisor are both unsigned integers and the rounding is round-down; wherein the value range of the dividend is expressed as [ a ]min,amax]The first subset of relationships comprises at least one of:
a first entry comprising a corresponding set of candidate parameters (N, M, L) having values of (N) where the divisor is an integer power of 21,M1,L1);(N1,M1,L1)=(log2b,1,0), b represents a divisor, N represents a first parameter, M represents a second parameter, and L represents a third parameter;
a second entry including when the divisor is not an integer power of 2 andin the case of (A), the value of the corresponding set of candidate parameters (N, M, L) is (N)2,M2,L2);amaxIs the upper bound value, a, of the range of values of the dividendminIs the lower bound value of the value range of the dividend;
a third entry, including when the divisor is not an integer power of 2, andin the case of (A), the value of the corresponding set of candidate parameters (N, M, L) is (N)3,M3,L3);
A fourth item, including when the divisor is not an integer power of 2, andin the case of (a), the values of the corresponding set of candidate parameters (N, M, L) are:
4. the division apparatus of claim 3 wherein the set of mapping relationships further comprises a corresponding second subset of relationships if the dividend and the divisor are unsigned integers and the rounding is round up; wherein the lower bound value of the dividend is updated toThe upper bound value is updated to amax+ b-1, each set of candidate parameters in said second subset of relationships, respectivelyThe relationship of the values of a set of candidate parameters (N, M, L) corresponding to the same case in the first subset of relationships is: is indicative of the first parameter or parameters of the device,is indicative of the second parameter or parameters of the device,representing the third parameter.
5. The division apparatus of claim 3 or 4 wherein the set of mapping relationships further comprises where the dividend and the divisor are both unsigned integers and the rounding is roundingA corresponding third subset of relationships; wherein the lower bound value of the dividend is updated toThe upper bound value is updated toAccordingly, each set of candidate parameters in the third subset of relationshipsThe relationship of the values of a set of candidate parameters (N, M, L) corresponding to the same case in the first subset of relationships is: is indicative of the first parameter or parameters of the device,is indicative of the second parameter or parameters of the device,representing the third parameter.
6. The division apparatus according to any one of claims 3 to 5, wherein in an application scenario in which the dividend is a signed integer, the selection unit is configured to:
and when the dividend and the divisor are both positive numbers or negative numbers, selecting a corresponding group of target parameter values from the pre-stored mapping relationship set according to whether the dividend and the divisor are unsigned integers, whether the divisor is an integer power of 2, the relationship between the divisor and the upper and lower boundary values of the value range and the rounding mode of a division result.
7. The division apparatus as claimed in claim 4, wherein in an application scenario where the dividend is a signed integer, the selection unit is configured to:
when the rounding of the division result is to infinity, or when one of the dividend and the divisor is positive and the other is negative and the rounding of the division result is to down,
and selecting a corresponding group of target parameter values from the pre-stored mapping relation set according to the dividend and the divisor which are unsigned integers, the rounding mode of the division result is rounding up, the relation between the divisor and the upper and lower boundary values of the value range and whether the divisor is an integer power of 2.
8. The division apparatus according to claim 3, wherein in an application scenario where the dividend is a signed integer, the selection unit is configured to:
when the rounding mode of the division result is rounding to zero, or when one of the dividend and the divisor is positive and the other is negative and the rounding mode of the division result is rounding up,
and selecting a corresponding group of target parameter values from the pre-stored mapping relation set according to the dividend and the divisor which are unsigned integers, the division result is rounded downwards, the relation between the divisor and the upper and lower boundary values of the value range and whether the divisor is an integer power of 2.
9. The division apparatus as claimed in claim 5, wherein in an application scenario where the dividend is a signed integer, the selection unit is configured to:
and when the rounding mode of the division result is rounding, selecting a corresponding group of target parameter values from the pre-stored mapping relation set according to the conditions that the dividend and the divisor are unsigned integers, the rounding mode of the division result is rounding, the relation between the divisor and the upper and lower boundary values of the value range and whether the divisor is an integer power of 2.
10. The division apparatus according to claim 6 wherein in an application scenario where an upper bound of the value range is less than or equal to zero and a lower bound of the value range is less than or equal to zero, the division apparatus further comprises an absolute value calculation unit;
the absolute value calculating unit is used for calculating an absolute value of the dividend and outputting the absolute value to the division operation unit; accordingly, the number of the first and second electrodes,
the division operation unit is used for operating the absolute value according to the group of target parameter values to obtain the division result;
and the result output unit is used for outputting the division result.
11. The division apparatus according to any one of claims 7 to 9, wherein in an application scenario where an upper bound of the value range is less than or equal to zero, a lower bound of the value range is less than or equal to zero, and the divisor is a non-negative integer, the division apparatus further comprises an absolute value calculating unit;
the absolute value calculating unit is used for outputting the absolute value to the division operation unit after determining the absolute value of the dividend;
the division operation unit is used for operating the absolute value according to the group of target parameter values to obtain the division result;
and the result output unit is used for outputting the division result after taking the inverse number.
12. The division apparatus according to any one of claims 6 to 9 wherein, in an application scenario where the divisor is a non-negative integer, the result output unit comprises an inverse number taking subunit and an output subunit; wherein the content of the first and second substances,
the inverse number taking subunit is configured to, after determining an inverse number of the division result, output the inverse number to the output subunit;
and the output subunit is used for selecting and outputting a division result with the same sign as the dividend from the division result and the inverse number.
13. The division apparatus of claim 12 further comprising an input unit, the input unit comprising an absolute value sub-unit and a sign sub-unit; wherein the content of the first and second substances,
the absolute value calculation subunit is configured to output the absolute value to the division operation unit after determining the absolute value of the dividend of the signed integer, so that the division operation unit calculates the absolute value and outputs the obtained division result to the output subunit;
the sign calculating subunit is configured to output the sign of the dividend of the signed integer to the output subunit after determining the sign of the dividend.
14. Division means according to any one of claims 3 to 13,
the multiplier is used for multiplying the dividend and the value of a second parameter in the group of target parameter values to obtain a first operation result;
the adder is used for performing addition operation on the first operation result and the value of a third parameter in the group of target parameter values to obtain a second operation result;
and the shifter is used for performing shift operation on the second operation result and the value of the first parameter in the group of target parameter values to obtain the division result.
15. A divider, the divider comprising:
the multiplier is used for multiplying the dividend and the value of a second parameter in the input group of target parameter values to obtain a first operation result;
the adder is used for performing addition operation on the first operation result and the value of a third parameter in the group of target parameter values to obtain a second operation result;
and the shifter is used for performing shift operation on the second operation result and the value of the first parameter in the group of target parameter values to obtain a division result.
16. The divider of claim 15, further comprising a selection circuit;
and the selection circuit is used for selecting a corresponding group of target parameter values from a pre-stored mapping relation set according to the attribute of the dividend, the attribute of the divisor and the rounding mode of the division result.
17. A method of division, the method comprising:
selecting a corresponding group of target parameter values from a pre-stored mapping relation set according to the attribute of the dividend, the attribute of the divisor and the rounding mode of the division result;
multiplying the dividend and a value of a second parameter in the group of target parameter values to obtain a first operation result;
adding the first operation result and the value of a third parameter in the group of target parameter values to obtain a second operation result;
and carrying out shift operation on the second operation result and the value of the first parameter in the group of target parameter values to obtain a division result.
18. An electronic device comprising a memory and a processor, the memory storing a computer program operable on the processor, wherein the processor implements the method of claim 17 when executing the program.
19. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of claim 17.
20. An electronic device, characterized in that the electronic device comprises the division apparatus of any one of claims 1 to 14.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011173935.1A CN112256235A (en) | 2020-10-28 | 2020-10-28 | Division operation method, divider, division device, electronic device, and storage medium |
PCT/CN2021/116710 WO2022088997A1 (en) | 2020-10-28 | 2021-09-06 | Division operation method, divider, division apparatus, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011173935.1A CN112256235A (en) | 2020-10-28 | 2020-10-28 | Division operation method, divider, division device, electronic device, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112256235A true CN112256235A (en) | 2021-01-22 |
Family
ID=74261698
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011173935.1A Pending CN112256235A (en) | 2020-10-28 | 2020-10-28 | Division operation method, divider, division device, electronic device, and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112256235A (en) |
WO (1) | WO2022088997A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022088997A1 (en) * | 2020-10-28 | 2022-05-05 | Oppo广东移动通信有限公司 | Division operation method, divider, division apparatus, electronic device and storage medium |
CN117331529A (en) * | 2023-12-01 | 2024-01-02 | 泰山学院 | Divider logic circuit and method for realizing same |
CN117521581A (en) * | 2024-01-08 | 2024-02-06 | 成都北中网芯科技有限公司 | Divider, application method thereof and division operation system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1961284A (en) * | 2004-06-29 | 2007-05-09 | 英特尔公司 | Method and system of achieving integer division by invariant divisor using N-bit multiply-add operation |
CN101946501A (en) * | 2007-12-14 | 2011-01-12 | 高通股份有限公司 | Efficient diffusion dithering using dyadic rationals |
CN104375802A (en) * | 2014-09-23 | 2015-02-25 | 上海晟矽微电子股份有限公司 | Multiplication and division device and operational method |
US20170185378A1 (en) * | 2015-12-29 | 2017-06-29 | Realtek Semiconductor Corporation | Division operation apparatus and method of the same |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FI20011610A0 (en) * | 2001-08-07 | 2001-08-07 | Nokia Corp | Method and apparatus for performing a division calculation |
US8819094B2 (en) * | 2009-06-10 | 2014-08-26 | Synopsys, Inc. | Multiplicative division circuit with reduced area |
CN201508545U (en) * | 2009-09-02 | 2010-06-16 | 中兴通讯股份有限公司 | Low-complexity and low-latency divider |
CN112256235A (en) * | 2020-10-28 | 2021-01-22 | Oppo广东移动通信有限公司 | Division operation method, divider, division device, electronic device, and storage medium |
-
2020
- 2020-10-28 CN CN202011173935.1A patent/CN112256235A/en active Pending
-
2021
- 2021-09-06 WO PCT/CN2021/116710 patent/WO2022088997A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1961284A (en) * | 2004-06-29 | 2007-05-09 | 英特尔公司 | Method and system of achieving integer division by invariant divisor using N-bit multiply-add operation |
CN101946501A (en) * | 2007-12-14 | 2011-01-12 | 高通股份有限公司 | Efficient diffusion dithering using dyadic rationals |
CN104375802A (en) * | 2014-09-23 | 2015-02-25 | 上海晟矽微电子股份有限公司 | Multiplication and division device and operational method |
US20170185378A1 (en) * | 2015-12-29 | 2017-06-29 | Realtek Semiconductor Corporation | Division operation apparatus and method of the same |
Non-Patent Citations (1)
Title |
---|
周殿凤;王俊华;: "基于FPGA的32位除法器设计", 信息化研究, no. 03 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022088997A1 (en) * | 2020-10-28 | 2022-05-05 | Oppo广东移动通信有限公司 | Division operation method, divider, division apparatus, electronic device and storage medium |
CN117331529A (en) * | 2023-12-01 | 2024-01-02 | 泰山学院 | Divider logic circuit and method for realizing same |
CN117331529B (en) * | 2023-12-01 | 2024-03-05 | 泰山学院 | Divider logic circuit and method for realizing same |
CN117521581A (en) * | 2024-01-08 | 2024-02-06 | 成都北中网芯科技有限公司 | Divider, application method thereof and division operation system |
CN117521581B (en) * | 2024-01-08 | 2024-04-02 | 成都北中网芯科技有限公司 | Divider, application method thereof and division operation system |
Also Published As
Publication number | Publication date |
---|---|
WO2022088997A1 (en) | 2022-05-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112256235A (en) | Division operation method, divider, division device, electronic device, and storage medium | |
GB2537371B (en) | Modulo calculation using polynomials | |
US20040167956A1 (en) | Method and apparatus for executing division | |
CN106126190B (en) | Partial remainder/divisor table split implementation | |
CN110187866B (en) | Hyperbolic CORDIC-based logarithmic multiplication computing system and method | |
EP4072087A1 (en) | Data processing apparatus and method, base station, and storage medium | |
Chaudhary et al. | Two‐stage logarithmic converter with reduced memory requirements | |
CN112955878B (en) | Apparatus for implementing activation logic of neural network and method thereof | |
CN109379191B (en) | Dot multiplication operation circuit and method based on elliptic curve base point | |
EP3379407B1 (en) | Embedded system, communication unit and method for implementing an exponential computation | |
CN115827555A (en) | Data processing method, computer device, storage medium and multiplier structure | |
CN110933003B (en) | DMRS signal generation method based on FPGA | |
CN113805846A (en) | Modulo arithmetic method, circuit, electronic device and computer readable storage medium | |
Kumar et al. | Complex multiplier: implementation using efficient algorithms for signal processing application | |
US9612800B2 (en) | Implementing a square root operation in a computer system | |
KR101318992B1 (en) | Modulo n calculation method and apparatus thereof | |
CN113254072A (en) | Data processor, data processing method, chip, computer device, and medium | |
US12009948B2 (en) | Data processing apparatus and method, base station, and storage medium | |
CN107066643B (en) | Modular hardware generator | |
Vo-Thi et al. | A floating-point FFT Twiddle factor implementation based on adaptive angle recoding CORDIC | |
US20240134609A1 (en) | Efficient computation of a shared exponent | |
JP5305392B2 (en) | IQ data square sum route calculation means | |
CN111752532B (en) | Method, system and device for realizing 32-bit integer division with high precision | |
US10162599B1 (en) | Method and apparatus for modulo operation with a class of divisors | |
Li et al. | Efficient RGB to YCbCr Color Space Conversion for Embedded Application |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |