Operation method of multiplier, operation apparatus, electronic device, and storage medium

The method addresses inefficiencies in multi-precision multiplication by using a single multiplier with carry compensation, reducing resource consumption and area while maintaining accuracy.

JP2024159507AActive Publication Date: 2024-11-08BEIJING HORIZON INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2024035064
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-06-28
Filing Date
2024-03-07
Publication Date
2024-11-08
Estimated Expiration
2044-03-07

AI Technical Summary

Technical Problem

Existing multiplier designs consume excessive hardware resources and area when performing multi-precision multiplication operations by combining multiple multipliers, leading to inefficiencies.

Method used

A method and device that utilize a single multiplier to perform multi-precision multiplication by determining carry compensation terms for lower bit input data groups, generating a target partial product array that offsets carries, ensuring accurate results without the need for multiple multipliers.

Benefits of technology

This approach reduces hardware resource consumption and area overhead while maintaining accuracy in multi-precision multiplication operations, enabling efficient use of a single multiplier for various precision levels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024159507000001_ABST
    Figure 2024159507000001_ABST
Patent Text Reader

Abstract

To provide an operation method of a multiplier, operation apparatus, electronic device, and storage medium which realize multiplication operations with multiple precision, and reduce hardware resource consumption and hardware area.SOLUTION: A method includes the steps of: determining a plurality of input data groups of a multiplier and an encoding manner for the multiplier; determining at least one low-order bit input data group in the plurality of input data groups; determining a carry compensation term corresponding to the at least one low-order bit input data group based on the at least one low-order bit data group and the encoding manner; determining a target partial product array based on the carry compensation term corresponding to the at least one low-order bit input data group and the plurality of input data groups; and determining a multiplication operation result for each input data group based on the target partial product array.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority to a Chinese patent application having application number 202310468468.2, filed on April 27, 2023, the entire contents of which are incorporated herein by reference.

[0002] The present disclosure relates to the technical field of data processing, and more particularly to a multiplier arithmetic method, an arithmetic device, an electronic device, and a storage medium. [Background technology]

[0003] In a microprocessor chip, the multiplier is the core of digital signal processing. Optimizing the speed and area of ​​the multiplier is very important to the overall performance of the microprocessor. In addition, the diversity of the multiplier's calculation precision is also very important to the performance of the microprocessor, since it determines the range of algorithms that the microprocessor can process.

[0004] In order to solve the above problems, the present disclosure is presented. The embodiments of the present disclosure provide a multiplier calculation method, a calculation device, an electronic device, and a storage medium, thereby realizing multi-precision multiplication calculation and reducing the consumption of hardware resources and the hardware area. Summary of the Invention [Problem to be solved by the invention]

[0005] Generally, one multiplier calculates a multiplication operation of one precision. In a related solution, a plurality of multipliers are combined to realize a multiplication operation of a precision other than the one precision, thereby realizing a multi-precision multiplication operation. However, the combination of a plurality of multipliers has problems such as a large consumption of hardware resources and a large area overhead. [Means for solving the problem]

[0006] A multiplier operation method according to a first aspect of the present disclosure includes the steps of determining a plurality of input data groups of the multiplier and an encoding method of the multiplier, determining at least one lower-bit input data group among the plurality of input data groups, determining a carry compensation term corresponding to the at least one lower-bit input data group based on the at least one lower-bit data group and the encoding method, determining a target partial product array based on the carry compensation term corresponding to the at least one lower-bit input data group and the plurality of input data groups, and determining a multiplication operation result of each input data group based on the target partial product array.

[0007] A computing device according to a second embodiment of the present disclosure includes a compensation determination module, a partial product sequence determination module, and a partial product processing module, wherein the compensation determination module is for determining a plurality of input data groups of a multiplier and an encoding method of the multiplier, determining at least one lower-order bit input data group in the plurality of input data groups, and determining a carry compensation term corresponding to the at least one lower-order bit input data group based on the at least one lower-order bit data group and the encoding method.

[0008] The partial product sequencing module is for determining a target partial product sequencing based on the carry compensation terms corresponding to the at least one lower-bit input data group determined by the compensation determination module and the plurality of input data groups. The partial product processing module is for determining a multiplication operation result of each input data group based on the target partial product sequencing determined by the partial product sequencing module.

[0009] A computer-readable storage medium according to a third aspect of the present disclosure stores a computer program for executing the multiplier calculation method according to the first aspect described above.

[0010] An electronic device according to a fourth aspect of the present disclosure includes a processor and a memory storing instructions executable by the processor, the processor reading the executable instructions from the memory and executing the instructions to implement the multiplier calculation method according to the first aspect.

[0011] A fifth aspect of the present disclosure provides a computer program product, the computer program product including computer program instructions, when executed by a processor, for performing the multiplier operation method according to the first aspect above. Effect of the Invention

[0012] According to the multiplier operation method, device, electronic device, and storage medium of the present disclosure, when a carry compensation term corresponding to at least one lower-bit input data group is added to a target partial product array (PPA), the target PPA includes not only sub-PPAs corresponding to each lower-bit input data group, but also carry compensation terms corresponding to each lower-bit input data group. Furthermore, in the accumulation process of the target PPA, the carry compensation term corresponding to each lower-bit input data group in the target PPA can offset the carry when the sub-PPAs corresponding to the lower-bit input data group are accumulated, and the carry when the sub-PPAs corresponding to each lower-bit input data group are accumulated does not affect the multiplication operation result of the upper-bit input data group corresponding to each lower-bit input data group. This ensures the accuracy of the multiplication operation result of the upper-bit input data group corresponding to each lower-bit input data group in the multiple input data groups. In addition, since the multiplication operation result of at least one lower-bit input data group in the multiple input data groups is also accurate, the multiplication operation result of each input data group is accurate, and a multi-precision multiplication operation can be realized. Furthermore, the multiplier calculation method according to the present disclosure does not require combining multiple multipliers, and can realize multi-precision multiplication calculations with a single multiplier, thereby reducing hardware resource consumption and hardware area. [Brief description of the drawings]

[0013] [Figure 1] 1 is a first schematic flowchart of a multiplier calculation method according to the present disclosure. [Diagram 2] FIG. 2 is a schematic diagram of a target PPA corresponding to one input data group according to the present disclosure. [Diagram 3] 4 is a schematic diagram of a target PPA corresponding to multiple input data groups according to the present disclosure. [Figure 4] 4 is a second schematic flowchart of a multiplier operation method according to the present disclosure. [Diagram 5] 13 is a third schematic flowchart of a multiplier operation method according to the present disclosure. [Figure 6] 4 is a fourth schematic flowchart of a multiplier calculation method according to the present disclosure. [Figure 7] 5 is a fifth schematic flowchart of a multiplier calculation method according to the present disclosure. [Figure 8] 1 is a first structural schematic diagram of an electronic device according to the present disclosure. [Figure 9] 13 is a schematic diagram of another target PPA corresponding to multiple input data groups according to the present disclosure. [Figure 10] 4 is a schematic flow chart illustrating a method for performing a multiplier operation on a plurality of input data groups according to the present disclosure; [Figure 11] 11 is a schematic flow chart illustrating another method for performing a multiplier operation on multiple input data groups according to the present disclosure; [Figure 12] FIG. 1 is a first structural schematic diagram of a computing device according to the present disclosure. [Figure 13] FIG. 2 is a second structural schematic diagram of a computing device according to the present disclosure. [Figure 14] FIG. 4 is a third structural schematic diagram of a computing device according to the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0014] In the following, in order to explain the present disclosure, embodiments of the present disclosure will be described in detail with reference to the drawings. The described embodiments are not all embodiments of the present disclosure, but are merely some of the embodiments of the present disclosure, and the present disclosure is not limited to the exemplary embodiments.

[0015] The relative arrangement of parts and steps, formulas, and numerical values ​​described in this embodiment do not limit the scope of the present disclosure unless otherwise stated.

[0016] Hereinafter, the terms "first" and "second" are for descriptive purposes only and are not intended to indicate or imply relative importance, nor do they include the number of technical features depicted. Thus, a feature with "first" or "second" may state or imply the inclusion of one or more of the relevant features. In the description of this disclosure, unless otherwise stated, "plurality" means two or more than two. "A and / or B" includes including only A, including only B, and a combination of A and B. (Application Summary)

[0017] In order to realize multi-precision multiplication, the related solution may use one multiplier to calculate one low-precision multiplication, or may use a combination of multiple multipliers to calculate high-precision multiplication. Specifically, the related solution proposes the following: Two pieces of high-precision data are divided into lower-bit data and upper-bit data, and multiple multipliers capable of performing low-precision multiplication are used to calculate the multiplication result of the two lower-bit data, the multiplication result of the lower-bit data and the upper-bit data, and the multiplication result of the two upper-bit data, respectively, and the multiplication results of the multiple multipliers are accumulated according to weights to obtain the multiplication result of two pieces of high-precision data. The low-precision multiplier realizes low-precision multiplication and high-precision multiplication.

[0018] For example, take the multiplicand A and the multiplier B of int16 as an example. Multiplicand A=a 15 a 14 …a 1 a0 , multiplier B=b 15 b 14 …b 1 b 0 In the related solution, the multiplicand A is expressed as two int8 data (i.e., A H , A L ), and the multiplier B is also divided into two int8 data (B H , B L ), where A=A H ×2 8 +A L , A H =a 15 a 14 …a 9 a 8 , A L =a 7 a 6 …a 1 a 0 B=B H ×2 8 +B L , B H =b 15 b 14 …b 9 b 8 , B L =b 7 b 6 …b 1 b 0 And the related solution is to use four multipliers that can perform int8 multiplication operations to produce A H and B H The result of multiplication with A H and B L The result of multiplication with A L and B H The result of multiplication with A L and B L The multiplication results of the multiplicand A and the multiplier B are respectively calculated, and the four multiplication results are accumulated according to the weights to obtain the multiplication result of the multiplicand A and the multiplier B. The multiplication result of the multiplicand A and the multiplier B is shown in the following formula (1).

[0019] A×B=A H ×B H ×2 16 +(A H ×B L +A L×B H )×2 8 +A L ×B L (1)

[0020] The related solution combines four int8 multipliers to realize int16 multiplication.

[0021] The above-mentioned related solutions can realize multi-precision multiplication operations such as low precision and high precision, but to realize high-precision multiplication operations, multiple low-precision multipliers need to be combined. The use of multiple multipliers has the problems of high hardware resource consumption and large area overhead. (Example System)

[0022] The multiplier calculation method according to the embodiments of the present disclosure can be widely used in multiple scenarios, such as real-time image processing and digital signal processing.

[0023] The multiplication operation method of the multiplier according to the embodiment of the present disclosure can be performed by an electronic device or a computing device. The computing device can be provided in the electronic device and can be a part of the electronic device (e.g., a CPU, a microprocessor chip, or a multiplier). Exemplary Methods

[0024] 1 is a schematic flowchart of a multiplier calculation method according to an exemplary embodiment of the present disclosure. The multiplier calculation method according to this embodiment can be applied to an electronic device, and can include the following steps S101 to S105, as shown in FIG.

[0025] In step S101, a plurality of input data groups of a multiplier and an encoding method of the multiplier are determined.

[0026] The electronic device may include a multiplier that performs a multiplication operation on two data. The electronic device may obtain a plurality of input data groups, send the plurality of input data groups to a multiplier, and then perform an arithmetic method on the plurality of input data groups at the multiplier. Here, each of the plurality of input data groups may include a multiplier and a multiplicand. The multiplier and the multiplicand may be signed or unsigned numbers.

[0027] In some embodiments, the maximum data bit width that the multiplier in the electronic device can execute is N, and the multiplier can execute a multiplication operation of a plurality of data bit widths (which can be said to be a multi-precision multiplication operation). The plurality of data bit widths that the multiplier can execute are all smaller than N. That is, the multiplier can calculate a multiplication operation of two data, the data bit width of which is N, and a multiplication operation of two data, the data bit width of which of at least one of the data is another data bit width. The another data bit width is smaller than N, where N is a positive integer (e.g., 32, 16, or 8).

[0028] In some embodiments, the electronic device may receive multiple input data groups input by a user, or the electronic device may generate multiple input data groups.

[0029] Exemplarily, a plurality of input data groups acquired by the electronic device can be divided into one multiplier (which can be referred to as a first multiplier) and one multiplicand (which can be referred to as a first multiplicand). The first multiplier is composed of a plurality of second multipliers. The first multiplicand is composed of a plurality of second multiplicands. The plurality of second multipliers and the plurality of second multiplicands correspond one-to-one, and one second multiplier and one corresponding second multiplicand constitute one input data group. Here, the data bit width of the first multiplier and the data bit width of the first multiplicand are both equal to or less than N. The data bit width of the second multiplier is equal to or less than the data bit width of the first multiplier, and the data bit width of the second multiplicand is equal to or less than the data bit width of the first multiplicand.

[0030] In some embodiments, the electronic device obtains a plurality of input data groups, and the data bit widths of the second multiplier and the second multiplicand included in each of the plurality of input data groups may be the same or different. If the data bit widths of the second multiplier and the second multiplicand in any one of the input data groups are different, the electronic device can pre-process the corresponding input data group to obtain a pre-processed input data group, and then the electronic device updates any one of the input data groups to the pre-processed input data group. Here, the data bit widths of the second multiplier and the second multiplicand in the pre-processed input data group are the same, and the numerical magnitudes of the input data group before and after the pre-processing are the same (including the numerical magnitudes of the second multiplier before and after the pre-processing being the same, and the numerical magnitudes of the second multiplicand before and after the pre-processing being the same).

[0031] Further, the electronic device can obtain the updated input data groups and continue to execute S102 on the updated input data groups. The data bit widths of the second multiplier and the second multiplicand included in each of the updated input data groups are the same.

[0032] For example, one input data group includes one multiplier with a data bit width of 8 bits and one multiplicand with a data bit width of 16 bits, and the electronic device can pre-process the multiplier in the corresponding input data group to obtain a multiplier with a data bit width of 16 bits. The pre-processing includes adding an 8-bit number to bits higher than the most significant bit of the multiplier, and the 8-bit number is all 0.

[0033] In the embodiment of the present disclosure, an input data group in which the data bit width of the included second multiplier and the included second multiplicand are the same will be taken as an example to describe the operation method of the multiplier according to the embodiment of the present disclosure.

[0034] In some embodiments, the data bit widths of different input data groups in the multiple input data groups may be the same or different. The data bit width of each input data group may refer to the data bit width of the second multiplier included in the input data group, or may refer to the data bit width of the second multiplicand included in the input data group. For example, the multiple input data groups may include two 8-bit input data groups. As another example, the multiple input data groups may include one 8-bit input data group and one 16-bit input data group.

[0035] In some embodiments, the electronic device can store the encoding method of the multiplier in advance. For example, the encoding method of the multiplier can be radix-4 Booth encoding or radix-8 Booth encoding.

[0036] The operation principle of the multiplier calculating the multiplication result of one multiplier and one multiplicand is as follows: the first digit of the multiplier is multiplied by all the digits included in the multiplicand to generate a set of product terms corresponding to the first digit, the second digit of the multiplier is multiplied by all the digits included in the multiplicand to generate a set of product terms corresponding to the second digit, and the other digits of the multiplier are analogized in this manner. Then, the product terms (which can be said to be multiple sets of product terms) corresponding to all the digits included in the multiplier are arranged to obtain one partial product array (PPA). Here, the process of "arranging product terms corresponding to all the digits included in the multiplier" includes shifting a set of product terms corresponding to the second digit one place to the left compared to a set of product terms corresponding to the first digit, shifting a set of product terms corresponding to the third digit one place to the left compared to a set of product terms corresponding to the second digit, and so on for other product terms. Finally, the partial product array is accumulated to obtain the multiplication result of the multiplier and the multiplicand.

[0037] Here, both the multiplier and the multiplicand can be binary numbers. If the multiplier has a single digit that is 1, the set of product terms corresponding to this single digit is the multiplicand. If the multiplier has a single digit that is 0, the set of product terms corresponding to this single digit are all 0.

[0038] Booth coding also transforms the multiplier to reduce the number of non-zero values ​​contained in the transformed multiplier, which reduces the number of partial products and reduces the size of the PPA. In other words, the multiplier in the electronic device uses Booth coding to accelerate the generation of the PPA. The number of partial products that can be reduced by Booth coding with different radixes is also different. For example, Booth coding with radix 4 (i.e., radix 4-Booth coding) can reduce the number of rows of partial products contained in the PPA by half, and Booth coding with radix 8 (i.e., radix 8-Booth coding) can reduce the number of rows of partial products contained in the PPA by about one-third.

[0039] For example, the multiplier A of int16, both of which are signed data, 16 and int16 multiplicand B 16 For example, the electronic device adopts radix-4 Booth coding to multiply the multiplier A 16 and multiplicand B 16 As shown in Figure 2, all black dots in the PPA shown in Figure 2 indicate product terms, and s is a multiplier A 16 is the sign bit obtained by Booth coding, and e is the multiplier A 16 s denotes the sign bit of a set of product terms corresponding to the values ​​of each bit of , and  ̄e denotes the value obtained by inverting e in the first row of the PPA. All s's in Figure 2 are either 1 or 0, and the values ​​of s's in different rows of the PPA may be the same or different. All e's in Figure 2 are either 1 or 0, and the values ​​of e's in different rows of the PPA may be the same or different.

[0040] int16 multiplier A 16 and multiplicand B 16For and , the number of rows of product terms included in the PPA generated by the electronic device using base 4-Booth coding is 8 rows. The electronic device employs 4-Booth coding to reduce the number of rows of product terms included in the PPA from 16 rows to 8 rows.

[0041] In step S102, at least one lower-order bit input data group from among the multiple input data groups is determined.

[0042] The electronic device can determine at least one least significant bit input data group from the plurality of input data groups based on a position of each input data group in the plurality of input data groups, where the at least one least significant bit input data group includes an input data group other than a most significant bit input data group in the plurality of input data groups, and the most significant bit input data group is an input data group located at a most significant bit among the plurality of input data groups.

[0043] In some embodiments, the position of each input data group in the plurality of input data groups can be the number of each input data group in the plurality of input data groups (e.g., first, second, third, etc.). The number of each input data group in the plurality of input data groups indicates the order of bits that the input data group occupies in the plurality of input data groups. The smaller the number of each input data group in the plurality of input data groups, the lower the bit that the input data group occupies in the plurality of input data groups.

[0044] For example, the first multiplier A has a data bit width of 32 bits. 32 and the first multiplicand B, whose data bit width is 32 bits. 32 For example, let us take a group of input data including A and B. 32 =a 31 a 30 …a 1 a 0 , B 32 =b 31 b 30 …b1 b 0 The first multiplier A 32 includes a plurality of second multipliers, each of which includes a second multiplier A having a data bit width of 16 bits. 16-1 , the second multiplier A whose data bit width is 8 bits 8-2 and a second multiplier A whose data bit width is 8 bits. 8-3 A 16-1 =a 15 a 14 …a 1 a 0 , A 8-2 =a 23 a 22 …a 17 A 16 , A 8-3 =a 31 a 30 …a 25 a 24 A in multiple input data groups 16-1 , A 8-2 and A 8-3 number (i.e., the first multiplier A 32 A in 16-1 , A 8-2 and A 8-3 The numbers 1, 2 and 3 are respectively ranked 1st, 2nd and 3rd.

[0045] First multiplier B 32 includes a plurality of second multiplicands, each of which includes a second multiplicand B 16-1 , the second multiplicand B whose data bit width is 8 bits 8-2 and a second multiplicand B whose data bit width is 8 bits. 8-3 It is. B 16-1 =b 15 b 14 …b 1 b 0 , B 8-2 =b 23 b 22 …b 17 b 16 , B 8-3 =b 31 b 30 …b 25 b 24B in multiple input data groups 16-1 , B 8-2 and B. 8-3 (i.e., the first multiplicand B 32 B in 16-1 , B 8-2 and B. 8-3 The numbers 1, 2 and 3 are respectively ranked 1st, 2nd and 3rd.

[0046] Here, the first multiplier A 32 and the first multiplicand B 32 and for at least one lower-order bit input data group, a second multiplier A 16-1 and the second multiplicand B 16-1 A lower bit input data group consisting of a second multiplier A 8-2 and the second multiplicand B 8-2 and another lower-order bit input data group composed of:

[0047] In some embodiments, in addition to obtaining the multiple input data groups, the electronic device can obtain an input signal, and the input signal indicates a data bit width (which can be said to be a data precision of each input data group) of each input data group included in the multiple input data groups. The input signal can include multiple sets of numerical values, and the bits occupied by the multiple sets of numerical values ​​in the input signal are different, and the positions of the numerical values ​​of each set in the input signal are the same as the positions of the one input data group corresponding to the numerical values ​​of each set in the multiple input data groups (e.g., the numbers of the numerical values ​​of each set in the input signal are the same as the numbers of the one input data group corresponding to the numerical values ​​of each set in the multiple input data groups). Furthermore, the electronic device can determine the positions of each input data group in the multiple input data groups based on the input signal.

[0048] Here, each set of values ​​may include one or more values, and each set of values ​​may indicate a data bit width of one input data group corresponding to the corresponding set of values.

[0049] For example, the input signal dxlp may be data with a data bit width of 8 bits, where dxlp=d 7 d 6 …d 1 d 0 The numerical value of the first and second bits of the input signal dxlp (i.e., d 1 d 0 The numerical value of the third and fourth bits of the input signal dxlp (i.e., d 3 d 2 The numerical value of the 5th and 6th bits of the input signal dxlp (i.e., d 5 d 4 The numerical value of the 7th and 8th bits of the input signal dxlp (i.e., d 7 d 6 The numerical value of ) indicates the data bit width of the fourth input data group in the multiple input data groups.

[0050] Here, the numerical value indicating the data bit width of one input data group in the input signal dxlp may be the same as or different from this data bit width. For example, d 1 d 0 =01 indicates that the data bit width of the first input data group in the multiple input data groups is 8 bits. 7 d 6 =00 indicates that the data bit width of the fourth input data group in the multiple input data groups is 0 bits, and this indicates that the multiple input data groups does not include the fourth input data group.

[0051] In the above example, the input signal dxlp was described as an example in which two bits of the input signal dxlp indicate the data bit width of one input data group, but other numbers of multiple bits (e.g., three bits, four bits, etc.) in the input signal dxlp can also indicate the data bit width of one input data group, and the greater the number of multiple bits, the greater the variety of data group widths of one input data group indicated by the multiple bits.

[0052] In step S103, a carry compensation term corresponding to the at least one lower-order bit input data group is determined based on the at least one lower-order bit input data group and the encoding scheme.

[0053] In a process in which the electronic device calculates the multiplication operation results of the multiple input data groups with one multiplier, a PPA corresponding to the multiple input data groups can be obtained, and the PPA can include sub-PPAs (sub-PPAs corresponding to each lower bit input data group) corresponding to each input data group, and the sub-PPA corresponding to each input data group is a PPA obtained by multiplying the input data groups. When the sub-PPAs corresponding to each lower bit input data group in the multiple input data groups are accumulated, a carry occurs, and this carry affects the multiplication operation result of one upper bit input data group corresponding to each lower bit input data group. Thus, the electronic device determines a carry compensation term corresponding to at least one lower bit input data group in the multiple input data groups. The carry compensation term corresponding to each lower bit input data group offsets the carry when the sub-PPAs corresponding to the lower bit input data group are accumulated.

[0054] Here, the bits occupied by one upper bit input data group corresponding to each lower bit input data group in the multiple input data groups are higher than the bits occupied by the lower bit input data group in the multiple input data groups, and the bits occupied by the upper bit input data group in the multiple input data groups are adjacent to the bits occupied by the lower bit input data group in the multiple input data groups. 16-1 and the second multiplicand B 16-1 The second multiplier A 8-2 and the second multiplicand B 8-2 Includes:

[0055] A carry compensation term corresponding to each lower-order bit input data group is used to offset a carry when the sub-PPA corresponding to the lower-order bit input data group is accumulated, and the sub-PPA corresponding to the lower-order bit input data group depends on the second multiplier and the second multiplicand included in the lower-order bit input data group and the encoding method of the multiplier used to generate the sub-PPA. Thus, the electronic device can determine the carry compensation term corresponding to each lower-order bit input data group based on each lower-order bit input data group and the encoding method of the multiplier.

[0056] For example, the lower-order bit input data groups include a first multiplier A of int16, which is all signed data. 16 and the first multiplicand B of int16 16 The first multiplier A 16 contains two second multipliers (i.e., second multiplier A 8-1 and the second multiplier A 8-1 ) and the first multiplicand B 16 contains two second multiplicands (i.e., second multiplicand B 8-1 and the second multiplicand B 8-1 For example, A 8-1 =a 7 a 6 …a1 a 0 , A 8-2 =a 15 a 14 …a 9 a 8 , B 8-1 =b 7 b 6 …b 1 b 0 , B 8-2 =b 15 b 14 …b 9 b 8 A 8-1 and A 8-2 The first multiplier A 16 The numbers in are the first and second places, respectively. B 8-1 and B 8-2 and the first multiplicand B 16 The numbers in are the first and second digits, respectively. The second multiplier A 8-1 and the second multiplicand B 8-1 The input data group (which can be said to be the first input data group) is composed of the second multiplier A 8-2 and the second multiplicand B 8-2 The first-order input data group is a lower-order bit input data group, and the upper-order bit input data group corresponding to the first-order input data group is a second-order input data group.

[0057] The electronics uses radix-4 Booth coding to generate the first multiplier A 16 and the first multiplicand B 16 A PPA (which may be referred to as an initial PPA) may be generated with the first and second input data groups. The initial PPA includes a sub-PPA corresponding to the first input data group and a sub-PPA corresponding to the second input data group.

[0058] Referring to FIG. 3, the sub-PPA corresponding to the first input data group includes all the product terms indicated by black dots in rows 1 to 4 and all the sign bits in rows 1 to 4. All the sign bits in rows 1 to 4 include s 0 , e0 ,  ̄e 0 and 1, where s 0 is the second multiplier A 8-1 is the code bit obtained by Booth coding e 0 is the second multiplier A 8-1 denotes the sign bit of a pair of product terms corresponding to the numerical value of each bit of e 0 is the first line of the PPA 0 The numerical values ​​obtained by inverting are shown in Fig. 3. 0 The values ​​of are either 1 or 0 and correspond to the s in different rows of the PPA. 0 The values ​​of e in FIG. 3 may be the same or different. 0 The values ​​of are either 1 or 0 and are in different rows of the PPA. 0 The numerical values ​​may be the same or different.

[0059] Referring to FIG. 3, the sub-PPA corresponding to the second-order input data group includes all the product terms indicated by black dots in rows 5 to 8 and all the sign bits in rows 5 to 8. All the sign bits in rows 5 to 8 include s 1 , e 1 ,  ̄e 1 and 1, where s 1 is the second multiplier A 8-2 is the code bit obtained by Booth coding e 1 is the second multiplier A 8-2 denotes the sign bit of a pair of product terms corresponding to the numerical value of each bit of e 1 is the fifth line of the PPA 1 The numerical values ​​obtained by inverting are shown in Fig. 3. 1 The values ​​of are either 1 or 0 and correspond to the s in different rows of the PPA. 1 The values ​​of e in FIG. 3 may be the same or different. 1 The values ​​of are either 1 or 0 and are in different rows of the PPA. 1 The numerical values ​​may be the same or different.

[0060] In addition, the second multiplier A 8-1and the second multiplicand B 8-1 For a lower-order bit input data group constituted by: and, the electronic device can determine a carry compensation term corresponding to the lower-order bit input data group. The carry compensation term corresponding to the lower-order bit input data group offsets a carry when the sub-PPA corresponding to the lower-order bit input data group is accumulated.

[0061] In step S104, a target partial product array is obtained based on a carry compensation term corresponding to at least one lower-bit input data group and the multiple input data groups.

[0062] The electronic device can generate an initial PPA using multiple input data groups, and combine the initial PPA with a carry compensation term corresponding to at least one lower-bit input data group to obtain a target partial product array (i.e., a target PPA).

[0063] For example, the electronic device may 16 and the first multiplicand B 16 and generate an initial PPA using the second multiplier A 8-1 and the second multiplicand B 8-1 A carry compensation term corresponding to the lower bit input data group composed of the first multiplier A and the second multiplier B is added to obtain the target PPA shown in FIG. 8-1 and the second multiplicand B 8-1 and a carry compensation term corresponding to the lower-order input data group constituted by

[0064] Second multiplier A 8-1 and the second multiplicand B 8-1The position of the carry when the sub-PPAs corresponding to the lower bit input data groups are accumulated is at the position of the carry compensation term E shown in FIG. 3. The carry compensation term E can offset the carry when the sub-PPAs corresponding to the lower bit input data groups are accumulated, and the carry when the sub-PPAs corresponding to the lower bit input data groups are accumulated is offset by the carry compensation term E when the sub-PPAs corresponding to the lower bit input data groups are accumulated. 8-2 and the second multiplicand B 8-2 and , the multiplication result of the input data group consisting of the upper bit input data group and the lower bit input data group is accurate. This ensures the accuracy of the multiplication result of the upper bit input data group. In addition, since the multiplication result of the lower bit input data group is also accurate, the multiplication result of each input data group is accurate, and multi-precision multiplication can be realized.

[0065] In step S105, the multiplication operation result of each input data group is determined based on the target partial product array.

[0066] The electronic device can accumulate the target PPA to obtain an accumulated result. The accumulated result can be constructed by combining the multiplication operation results of each input data group, and the position of the multiplication operation result of each input data group in the accumulated result (e.g., the number of the multiplication operation result of each input data group in the accumulated result) is the same as the position of each input data group in the multiple input data groups (e.g., the number of each input data group in the multiple input data groups).

[0067] For example, the data bit width of the input data groups is 16, and the data bit width of the accumulation result corresponding to the input data groups is 32. Therefore, it can be seen that the bits occupied by each input data group in the input data groups are different from the bits occupied by the multiplication operation result of that input data group in the accumulation result.

[0068] For example, the number of a certain input data group among the multiple input data groups is number 1, and the input data group is located from bit 1 to bit 16 among the multiple input data groups. The number of the multiplication operation result of the input data group in the accumulation result is also number 1, but the multiplication operation result of the input data group is located from bit 1 to bit 32 in the accumulation result.

[0069] When the electronic device adds a carry compensation term corresponding to at least one lower-bit input data group to the target PPA, the target PPA includes not only the sub-PPAs corresponding to each lower-bit input data group, but also the carry compensation term corresponding to each lower-bit input data group. Furthermore, in the process in which the electronic device accumulates the target PPA, the carry compensation term corresponding to each lower-bit input data group in the target PPA can offset the carry when the sub-PPA corresponding to the lower-bit input data group is accumulated, and the carry when the sub-PPA corresponding to each lower-bit input data group is accumulated does not affect the multiplication operation result of the upper-bit input data group corresponding to each lower-bit input data group. This ensures the accuracy of the multiplication operation result of the upper-bit input data group corresponding to each lower-bit input data group in the multiple input data groups. In addition, since the multiplication operation result of at least one lower-bit input data group in the multiple input data groups is also accurate, the multiplication operation result of each input data group is accurate, and multi-precision multiplication operation can be realized. Furthermore, the multiplier calculation method according to the present disclosure does not require combining multiple multipliers, and can realize multi-precision multiplication calculations with a single multiplier, thereby reducing hardware resource consumption and hardware area.

[0070] In addition, in the process of using multiple low-precision multipliers to achieve high-precision multiplication in the above-mentioned related solutions, the multiple multiplication results output from the multiple multipliers need to be accumulated according to weights to obtain high-precision multiplication results. In the process of accumulating multiple multiplication results according to weights, it is necessary to shift the multiplication results with different weights (for example, in the related solutions, A H ×B H Shift the multiplication result of A H ×B H ×2 16 Get A H ×B L Shift the multiplication result of A H ×B L ×2 8 Get A L ×B H Shift the multiplication result of A L ×B H ×2 8 (Acquire high precision multiplication results). The shift operation in the related solution increases the time required to acquire high precision multiplication results. In the embodiment of the present disclosure, the electronic device can acquire the multiplication results (including high precision multiplication results) of each input data group by only accumulating the target PPA, and does not need to perform a shift operation, thereby reducing the time required to acquire the multiplication results (including high precision multiplication results) of each input data group.

[0071] In some embodiments, the maximum data bit width that the multiplier in the electronic device can execute is N, so after determining the multiple input data groups, the electronic device can determine whether the sum of the data bit widths of each input data group is less than or equal to N (i.e., less than N or equal to N), and if the sum of the data bit widths of each input data group is less than or equal to N, the electronic device can continue to execute the calculation method on the multiple input data groups; if the sum of the data bit widths of each input data group is greater than N, the electronic device can end the process.

[0072] Illustratively, step S102 in the multiplier operation method according to an embodiment of the present disclosure may include determining at least one lower-bit input data group in the multiple input data groups according to the sum of the data bit widths of the input data groups being less than or equal to N.

[0073] The electronic device can perform a multiplication operation on one input data group having a data bit width of less than N bits using one multiplier with a maximum possible data bit width of N bits, and can also perform multiplication operations on multiple input data groups having a total data bit width of less than N bits.

[0074] In some embodiments, in order to offset the carry when the sub-PPAs corresponding to each lower bit input data group are accumulated, it is necessary to set the compensation position of the carry compensation term corresponding to each lower bit input data group based on the position of the carry when the sub-PPAs corresponding to each lower bit input data group are accumulated, and to set the compensation value of the carry compensation term corresponding to each lower bit input data group based on the numerical value of the carry when the sub-PPAs corresponding to each lower bit input data group are accumulated.

[0075] As shown in FIG. 4, in addition to the embodiment shown in FIG. 1 above, step S103 in the multiplier calculation method according to the embodiment of the present disclosure may include the following steps S201 to S202.

[0076] In step S201, a position of a carry compensation term corresponding to at least one lower-bit input data group is determined based on an encoding method, a data bit width of at least one lower-bit input data group, and a position of the at least one lower-bit input data group among the multiple input data groups.

[0077] The electronic device can determine the number of rows of the sub-PPA corresponding to each lower-bit input data group based on the encoding method of the multiplier, the data bit width of the second multiplier included in each lower-bit input data group (i.e., the data bit width of each lower-bit input data group), and the position of each lower-bit input data group in the multiple input data groups. Then, the electronic device determines the compensation position of the carry compensation term corresponding to each lower-bit input data group based on the number of rows of the sub-PPA corresponding to each lower-bit input data group.

[0078] In some embodiments, the electronic device determines the position of the last row of the sub-PPA corresponding to at least one lower-bit input data group based on the encoding method of the multiplier, the data bit width of at least one lower-bit input data group, and the position of at least one lower-bit input data group in the multiple input data groups, and the position of the last row of the sub-PPA corresponding to each lower-bit input data group is the position of the carry compensation term corresponding to that lower-bit input data group.As shown in Figure 5, in addition to the embodiment shown in Figure 4 above, step S201 in the calculation method of the multiplier according to this embodiment can include the following steps S301 to S302.

[0079] In step S301, the position of the last row of the sub partial product array corresponding to at least one lower-bit input data group is determined based on the encoding method, the data bit width of at least one lower-bit input data group, and the position of the at least one lower-bit input data group among the multiple input data groups.

[0080] Here, the position of the last row of the sub-PPA corresponding to each lower-bit input data group can refer to the row number of the last row of that sub-PPA in a PPA corresponding to multiple input data groups.

[0081] In some embodiments, the position of each input data group in the plurality of input data groups can refer to the number of each input data group in the plurality of input data groups. Furthermore, the electronic device determines a bit position of the at least one lower-bit input data group in the plurality of input data groups based on a data bit width of the at least one lower-bit input data group and the position of the at least one lower-bit input data group in the plurality of input data groups, and determines a position of the last row of the sub-PPA corresponding to each lower-bit input data group based on an encoding scheme of the multiplier and the bit position of the at least one lower-bit input data group in the plurality of input data groups.

[0082] Here, the multiple input data groups may include a first multiplier and a first multiplicand, and each lower-order bit input data group may include a second multiplier and a second multiplicand. The bit position that each lower-order bit input data group occupies in the multiple input data groups may indicate the bit position that the second multiplier occupies in the first multiplier, or may indicate the bit position that the second multiplicand occupies in the first multiplicand.

[0083] Exemplarily, the plurality of input data groups are 32 and the first multiplicand B 32 and at least one lower-order bit input data group among the plurality of input data groups is provided with the second multiplier A 16-1 and the second multiplicand B 16-1 The first lower-order bit input data group is composed of the second multiplier A 8-2 and the second multiplicand B 8-2and a second lower-bit input data group consisting of: and the electronic device determines bit positions occupied by the two lower-bit input data groups in the multiple input data groups based on the data bit widths of the two lower-bit input data groups and the numbers of the two lower-bit input data groups in the multiple input data groups. Here, the data bit width of the first lower-bit input data group is 16 bits, and the data bit width of the second lower-bit input data group is 8 bits. The first lower-bit input data group is in the first position in the multiple input data groups, and the second lower-bit input data group is in the second position in the multiple input data groups. The bit positions occupied by the second lower-bit input data group in the multiple input data groups are from the 17th bit to the 24th bit.

[0084] Here, the bit position that the first lower-order bit input data group occupies in the multiple input data groups is determined by the second multiplier A 16-1 is the first multiplier A 32 or the bit position occupied in the second multiplicand B 16-1 is the first multiplicand B 32 The bit position that the second least significant bit input data group occupies in the plurality of input data groups may be a bit position that the second least significant bit input data group occupies in the plurality of input data groups. 8-2 is the first multiplier A 32 or the bit position occupied in the second multiplicand B 8-2 is the first multiplicand B 32 It may also refer to the bit position occupied in

[0085] Further, taking as an example that the encoding method of the multiplier is radix-4 Booth encoding, the electronic device can determine that the position of the last row of the sub-PPA corresponding to the first least significant bit input data group is row 8, based on the radix-4 Booth encoding and the bit positions occupied by the first least significant bit input data group in the multiple input data groups being bit 1 to bit 16. Similarly, the electronic device can determine that the position of the last row of the sub-PPA corresponding to the second least significant bit input data group is row 12, based on the radix-4 Booth encoding and the bit positions occupied by the second least significant bit input data group in the multiple input data groups being bit 17 to bit 24.

[0086] In step S302, a compensation position of a carry compensation term corresponding to at least one lower-order bit input data group is determined based on the position of the last row of the sub partial product array corresponding to at least one lower-order bit input data group.

[0087] The electronic device can determine that the position of the last row of the sub-PPA corresponding to each lower-order bit input data group is the compensation position of the carry compensation term corresponding to that lower-order bit input data group. For example, if the position of the last row of the sub-PPA corresponding to the first lower-order bit input data group is the 8th row, the compensation position of the carry compensation term corresponding to the first lower-order bit input data group is the 8th row of the PPA corresponding to the multiple input data groups. As another example, if the position of the last row of the sub-PPA corresponding to the second lower-order bit input data group is the 12th row, the compensation position of the carry compensation term corresponding to the second lower-order bit input data group is the 12th row of the PPA corresponding to the multiple input data groups.

[0088] The carry when the sub-PPA corresponding to each lower-bit input data group is accumulated is in the last row of the sub-PPA. Therefore, the compensation position of the carry compensation term corresponding to the lower-bit input data group is set to the last row of the sub-PPA so that the carry compensation term corresponding to the lower-bit input data group can offset the carry when the sub-PPA corresponding to the lower-bit input data group is accumulated.

[0089] In step S202, a compensation value of a carry compensation term corresponding to the at least one lower-order bit input data group is determined based on a numerical value of a sign bit of each data in the at least one lower-order bit input data group.

[0090] The electronic device can determine a compensation value of a carry compensation term corresponding to each lower-order bit input data group based on a numerical value of a sign bit of each data in each lower-order bit input data group, where each lower-order bit input data group can include a second multiplier and a second multiplicand, and the numerical value of the sign bit of each data in each lower-order bit input data group can include a numerical value of a sign bit of the second multiplier and a numerical value of a sign bit of the second multiplicand.

[0091] Exemplarily, each data (e.g., the second multiplier or the second multiplicand) in each lower-bit input data group may include a sign bit, and the value of the sign bit indicates the sign type of each data. For example, when the value of the sign bit included in the second multiplier is 1, it indicates that the sign type of the second multiplier is a negative number. As another example, when the value of the sign bit included in the second multiplier is 0, it indicates that the sign type of the second multiplier is a positive number.

[0092] In some embodiments, the electronic device can determine a compensation value of a carry compensation term corresponding to each lower-order bit input data group based on the numerical value of the sign bit of each data included in each lower-order bit input data group. As shown in Fig. 5, in addition to the embodiment shown in Fig. 4 above, step S202 in the multiplier operation method according to this embodiment can include the following steps S303 to S304.

[0093] In step S303, an XNOR operation is performed on the numerical values ​​of the sign bits of the multiplier and multiplicand in each of the lower-order bit input data groups to determine a numerical value after the XNOR operation.

[0094] Each lower-order bit input data group includes one multiplier (i.e., the second multiplier) and one multiplicand (i.e., the second multiplicand). The electronic device can perform an XNOR operation on the numerical value of the sign bit of the second multiplier and the numerical value of the sign bit of the second multiplicand to determine a numerical value after the XNOR operation. Here, the numerical value of the sign bit included in the second multiplier indicates the type of sign of the second multiplier. The numerical value of the sign bit included in the second multiplicand indicates the type of sign of the second multiplicand.

[0095] For example, the value of the sign bit included in the second multiplier is 0 or 1. The value of the sign bit included in the second multiplicand is 0 or 1. The value after the XNOR operation is 0 or 1. Here, the type of sign indicated by 0 is a positive number, and the type of sign indicated by 1 is a negative number.

[0096] For example, when an electronic device performs an XNOR operation on 0 and 1, the resulting number after the XNOR operation is 0. As another example, when an electronic device performs an XNOR operation on 1 and 1, the resulting number after the XNOR operation is 1. As yet another example, when an electronic device performs an XNOR operation on 0 and 0, the resulting number after the XNOR operation is 1.

[0097] In some embodiments, the sign of the result of the XNOR operation on each least significant input data group is the opposite of the sign of the result of the multiplication operation on that least significant input data group.

[0098] For example, when the sign type of the second multiplier indicated by the value of the sign bit of the second multiplier included in the lower bit input data group is a positive number, and the sign type of the second multiplicand indicated by the value of the sign bit of the second multiplicand included in this lower bit input data group is a positive number, the electronic device performs an XNOR operation on the value of the sign bit of the second multiplier and the value of the sign bit of the second multiplicand to determine a value after the XNOR operation. As a result, the sign type indicated by the value after the XNOR operation is a negative number, and the sign type of the multiplication operation result corresponding to the lower bit input data group is a positive number. This shows that the sign type indicated by the value after the XNOR operation and the sign type of the multiplication operation result corresponding to this lower bit input data group are opposite to each other.

[0099] As another example, when the sign type of the second multiplier indicated by the value of the sign bit of the second multiplier included in the lower bit input data group is a positive number, and the sign type of the second multiplicand indicated by the value of the sign bit of the second multiplicand included in this lower bit input data group is a negative number, the electronic device performs an XNOR operation on the value of the sign bit of the second multiplier and the value of the sign bit of the second multiplicand to determine a value after the XNOR operation. As a result, the sign type indicated by the value after the XNOR operation is a positive number, and the sign type of the multiplication operation result corresponding to the lower bit input data group is a negative number. This shows that the sign type indicated by the value after the XNOR operation and the sign type of the multiplication operation result corresponding to this lower bit input data group are reversed.

[0100] In step S304, a compensation value of a carry compensation term corresponding to at least one lower-order bit input data group is determined based on the value after the XNOR operation.

[0101] The electronic device can determine that the numerical value after the XNOR operation of each lower-order bit input data group is the compensation value of the carry compensation term corresponding to that lower-order bit input data group. For example, if the numerical value after the XNOR operation of the lower-order bit input data group is 0, it can be determined that the compensation value of the carry compensation term corresponding to that lower-order bit input data group is 0. As another example, if the numerical value after the XNOR operation of the lower-order bit input data group is 1, it can be determined that the compensation value of the carry compensation term corresponding to that lower-order bit input data group is 1.

[0102] Since electronic devices usually calculate PPAs using binary numbers corresponding to a plurality of input data groups, the numerical value in the sub-PPA corresponding to each lower-bit input data group is 0 or 1, and the carry when the sub-PPA corresponding to each lower-bit input data group is accumulated is also 0 or 1. The sign value of the multiplication operation result of each lower-bit input data group indicates the type of sign of the multiplication operation result of that lower-bit input data group, and the sign value is 0 or 1. The type of sign indicated by the inverted value of the sign value (for example, the inverted value of 0 is 1, and the inverted value of 1 is 0) is the opposite of the type of sign of the multiplication operation result corresponding to the lower-bit input data group, and the inverted value of the sign value can cancel the carry when the sub-PPA corresponding to the lower-bit input data group is accumulated. The type of sign indicated by the numerical value after the XNOR operation corresponding to the lower-bit input data group is also the opposite of the type of sign of the multiplication operation result corresponding to the lower-bit input data group, so the numerical value after the XNOR operation is the same as the inverted value of the sign value, and the numerical value after the XNOR operation can similarly cancel the carry when the sub-PPA corresponding to the lower-bit input data group is accumulated.

[0103] Here, when the first multiplier and the second multiplicand included in the multiple input data groups are both binary numbers, the binary numbers corresponding to the multiple input data groups are the first multiplier and the second multiplicand. When the first multiplier and the second multiplicand included in the multiple input data groups are not binary numbers, the electronic device can convert the first multiplier and the second multiplicand, respectively, to obtain a converted first multiplier and a converted second multiplicand. The converted first multiplier and the converted second multiplicand are both binary numbers, and the binary numbers corresponding to the multiple input data groups include the converted first multiplier and the converted second multiplicand.

[0104] In another embodiment, the electronic device can determine a code value indicating the type of sign of the multiplication operation result of each lower-order bit input data group based on the numerical value of the sign bit of each data included in each lower-order bit input data group, and determine a compensation value of the carry compensation term corresponding to the lower-order bit input data group based on this code value. As shown in Fig. 6, in addition to the embodiment shown in Fig. 4 above, step S202 in the operation method of the multiplier according to this embodiment can include the following steps S401 to S402.

[0105] In step S401, the sign value of the multiplication result of the multiplier and the multiplicand is determined based on the value of the sign bit of the multiplier and the multiplicand in each lower-order bit input data group.

[0106] The electronic device can determine the sign value of the multiplication result of the second multiplier and the second multiplicand (i.e., the sign value of the multiplication result of that lower-bit input data group) based on the numerical value of the sign bit of the second multiplier and the numerical value of the sign bit of the second multiplicand included in each lower-bit input data group.

[0107] For example, if the value of the sign bit included in the second multiplier is 0 and the value of the sign bit included in the second multiplicand is 0, the code value of the multiplication result of the second multiplier and the second multiplicand is 0. As another example, if the value of the sign bit included in the second multiplier is 0 and the value of the sign bit included in the second multiplicand is 1, the code value of the multiplication result of the second multiplier and the second multiplicand is 1. As yet another example, if the value of the sign bit included in the second multiplier is 1 and the value of the sign bit included in the second multiplicand is 1, the code value of the multiplication result of the second multiplier and the second multiplicand is 0. Here, the type of sign indicated by the numerical value 0 is a positive number, and the type of sign indicated by the numerical value 1 is a negative number.

[0108] In step S402, the sign value of the multiplication result is inverted to obtain the compensation value of the carry compensation term corresponding to each lower-order bit input data group.

[0109] For example, a sign value of 0 of a multiplication result of lower-order bit input data groups indicates that the sign type of the multiplication result is a positive number, and the electronic device can obtain that the compensation value of the carry compensation term corresponding to the lower-order bit input data group is 1. As another example, a sign value of 1 of a multiplication result of lower-order bit input data groups indicates that the sign type of the multiplication result is a negative number, and the electronic device can obtain that the compensation value of the carry compensation term corresponding to the lower-order bit input data group is 0.

[0110] The sign value of the multiplication operation result of each lower bit input data group indicates the type of sign of the multiplication operation result of that lower bit input data group, and the sign value is 0 or 1. The type of sign indicated by the inverted value of the sign value is opposite to the type of sign of the multiplication operation result corresponding to that lower bit input data group, and the inverted value of the sign value can offset the carry when the sub-PPA corresponding to that lower bit input data group is accumulated. Thus, the electronic device can determine the inverted value of the sign value as the compensation value of the carry compensation term corresponding to the lower bit input data group, and the compensation value of the carry compensation term corresponding to the lower bit input data group can offset the carry when the sub-PPA corresponding to the lower bit input data group is accumulated.

[0111] In some embodiments, the electronic device obtains a carry compensation term corresponding to at least one lower-bit input data group, and then generates an initial PPA based on a plurality of input data groups, and obtains a target PPA by adding the carry compensation term to the initial PPA. As shown in Fig. 7, in addition to the embodiment shown in Fig. 4, step S104 in the multiplier calculation method according to this embodiment can include the following steps S501 to S503.

[0112] In step S501, an encoding method corresponding to the data bit width of each input data group is adopted to encode each input data group to obtain encoded data corresponding to each input data group.

[0113] Since the electronic device calculates the multiplication operation result of each input data group, the electronic device separately encodes (e.g., Booth encodes) each input data group to obtain encoded data corresponding to each input data group, where the encoded data corresponding to each input data group can be multiple sets of product terms.

[0114] For details about multiple sets of product terms, please refer to the description of multiple sets of product terms in the above embodiment.

[0115] Exemplarily, the input data groups include a data bit width of n 1 One input data group is n bits, and the data bit width is n 2 and one input data group, each of which is n bits. 1 The data bit width is n by using Booth coding. 1 Encode the input data group, which is n bits, 2 The data bit width is n by using Booth coding. 2 Input data groups that are bits can be encoded.

[0116] Furthermore, if the coding scheme of the multiplier is radix-4 Booth coding, the electronic device can 1 The data bit width is n by using radix 4-Booth coding. 1 Encode the input data group, which is n bits, 2 The data bit width is n by using radix 4-Booth coding. 2 Input data groups that are bits can be encoded.

[0117] In some embodiments, the electronic device sets, through a selector, the multiplier to adopt an encoding scheme corresponding to a data bit width of each input data group, and encodes each input data group through the set multiplier to obtain encoded data corresponding to each input data group.

[0118] In step S502, an initial partial product array including sub partial product arrays corresponding to each input data group is generated based on the coded data corresponding to each input data group.

[0119] The electronic device can use the coded data corresponding to each input data group to generate a sub-PPA corresponding to each input data group, and generate an initial PPA corresponding to the multiple input data groups based on the sub-PPA corresponding to each input data group, where the sub-PPAs corresponding to different input data groups occupy different columns in the initial PPA.

[0120] In some embodiments, the coded data corresponding to each input data group can be multiple sets of product terms, and the electronics can arrange the multiple sets of product terms to obtain a sub-PPA corresponding to each input data group.

[0121] For details about the electronic device arranging multiple sets of product terms, refer to the explanation in the above embodiment regarding "arranging product terms corresponding to all numerical values ​​included in the multiplier," and therefore the explanation will be omitted here.

[0122] In step S503, a carry compensation term is added to the initial partial product array based on the compensation position and compensation value of the carry compensation term corresponding to at least one lower-order bit input data group to obtain a target partial product array.

[0123] The electronic device can add a carry compensation term corresponding to at least one lower-order bit input data group to the initial PPA to obtain the target PPA.

[0124] In some embodiments, the initial PPA includes a sub-PPA corresponding to at least one lower-bit input data group. A carry position corresponding to each lower-bit input data group is a position of the last row of the sub-PPA corresponding to the lower-bit input data group. Furthermore, the electronic device adds a compensation value of the carry compensation term corresponding to the lower-bit input data group to the last row of the sub-PPA corresponding to the lower-bit input data group, so as to add a carry compensation term corresponding to the lower-bit input data group to the initial PPA based on the position of the last row of the sub-PPA corresponding to the lower-bit input data group. The electronic device adds a carry compensation term corresponding to the at least one lower-bit input data group to the initial PPA to obtain a target PPA.

[0125] For example, the electronic device can set a target most significant bit in the last row of the sub-PPA corresponding to each lower-bit input data group to a compensation value of a carry compensation term corresponding to the lower-bit input data group. The target most significant bit is a bit whose position is higher than the position of the partial product and the position of the sign bit in the last row of the sub-PPA corresponding to the lower-bit input data group.

[0126] In the embodiment of the present disclosure, instead of encoding the multiple input data groups as a whole, each input data group is encoded separately to obtain encoded data corresponding to each input data group. Furthermore, the electronic device can use the encoded data corresponding to each input data group to generate a sub-PPA corresponding to each input data group, and then generate an initial PPA including the sub-PPA corresponding to each input data group. A multiplication operation result for each input data group can be obtained based on the initial PPA.

[0127] In some embodiments, the electronic device can accumulate the target PPA to obtain a multiplication operation result for each input data group, or the electronic device can compress the target PPA to obtain compressed data, and accumulate the compressed data to obtain a multiplication operation result for each input data group.

[0128] As an example, the electronic device compresses the target PPA to obtain the multiplication result of each input data group, and the process of the electronic device obtaining the multiplication result of each input data group will be described. Specifically, as shown in Fig. 7, in addition to the embodiment shown in Fig. 4, step S105 in the multiplier calculation method according to this embodiment can include the following steps S504 to S505.

[0129] In step S504, the target partial product array is compressed using a Wallace tree compressor to obtain compressed data.

[0130] The electronic device can use a Wallace tree compressor (also called a Wallace tree multiplier) to compress the target PPA to obtain compressed data. The compressed data can include two sets of numbers, which are a product accumulation value of the target PPA and a carry value of the target PPA, respectively.

[0131] In step S505, the compressed data is accumulated to obtain the multiplication operation result for each input data group.

[0132] The electronic device can accumulate two sets of values ​​included in the compressed data to obtain an accumulation result. The accumulation result includes the multiplication operation results of each input data group. The data bit width of the accumulation result is 2N.

[0133] The electronic device compresses the target PPA through a Wallace tree compressor to obtain compressed data. The amount of data included in the compressed data is less than the amount of data included in the target PPA. This improves the accumulation speed of the compressed data, and allows the multiplication operation results of each input data group to be obtained quickly.

[0134] For illustrative purposes, with reference to Fig. 8, a calculation method of a multiplier according to an embodiment of the present disclosure will be described by taking the electronic device shown in Fig. 8 as an example. The electronic device shown in Fig. 8 includes one multiplier with a data bit width of N, a Wallace tree compressor, and an adder, and the calculation method performed by the electronic device includes the following steps:

[0135] In step 1, the electronic device obtains a plurality of input data groups, an input signal dlxp, and an encoding method of a multiplier.

[0136] For example, the input data groups include a first multiplier A N and the first multiplicand B NThe input signal dlxp indicates the data bit width of each input data group. Specifically, the input signal dlxp indicates that the data bit width of the input data group located at the first position among the multiple input data groups (abbreviated as the first input data group) is n 1 The data bit width of the second input data group (abbreviated as the second input data group) is n 2 The data bit width of the m-th input data group (abbreviated as the m-th input data group) is n m It indicates that the number of bits is 1. The encoding method of the multiplier is Booth encoding. m is a positive integer.

[0137] In step 2, the electronic device uses an encoding method corresponding to the data bit width of each input data group through a multiplier to encode each input data group to obtain encoded data corresponding to each input data group.

[0138] Here, in step 2, the electronics uses a multiplier to 1 The first input data group is encoded using n-bit Booth coding; 2 The second input data group is encoded using a 1-bit Booth encoding, ..., and n m The method includes: encoding the m-th input data group by adopting 1-bit Booth coding to obtain coded data corresponding to the first input data group, coded data corresponding to the second input data group, ..., and coded data corresponding to the m-th input data group.

[0139] In step 3, the electronic device generates sub-PPAs corresponding to each input data group through a multiplier using the coded data corresponding to each input data group, and generates initial PPAs corresponding to the multiple input data groups based on the sub-PPAs corresponding to each input data group. Here, the sub-PPAs corresponding to each input data group include a sub-PPA corresponding to a first input data group (i.e., PPA 1), the sub-PPA corresponding to the second-order input data group (i.e., PPA 2 ), …, and the sub-PPA corresponding to the m-th input data group (i.e., PPA m ) are included.

[0140] For example, referring to FIG. 8 and FIG. 9, the data bit width of the first input data group, n 1 n bits, the data bit width of the second input data group 2 bits, …, and n m For example, the number of bits is 8, and the coding method of the multiplier is radix-4 Booth coding. The electronic device can obtain sub-PPAs corresponding to each input data group shown in FIG. 9. The sub-PPAs include a sub-PPA corresponding to the first input data group (i.e., PPA 1 ), the sub-PPA corresponding to the second-order input data group (i.e., PPA 2 ), …, and the sub-PPA corresponding to the m-th input data group (i.e., PPA m ) are included.

[0141] PPA shown in Figure 9 1 For details, refer to the description of the sub-PPA corresponding to the first input data group shown in FIG. 3 in the above embodiment, and refer to the PPA shown in FIG. 2 For details, refer to the description of the sub-PPA corresponding to the second input data group shown in FIG. 3 in the above embodiment, and refer to the PPA shown in FIG. m For details, please refer to the description of the sub-PPA corresponding to the m-th input data group shown in FIG. 3 in the above embodiment, and therefore the description will be omitted here.

[0142] In step 4, the electronic device determines, through a multiplier, a carry compensation term corresponding to the at least one lower-bit input data group according to the at least one lower-bit input data group and the encoding scheme, and adds the carry compensation term corresponding to the at least one lower-bit input data group to the initial PPA to obtain a target PPA, where the at least one lower-bit input data group includes a first-order input data group, a second-order input data group, a third-order input data group, a fourth-order input data group, a fifth-order input data group, a sixth-order input data group, a seventh-order input data group, a fifth-order input data group, a seventh-order input data group, a fifth-order input data group, a sixth-order input data group, a seventh ...

[0143] For example, referring to FIG. 8 and FIG. 9 , the carry compensation terms corresponding to at least one lower-order bit input data group determined by the electronic device include a carry compensation term E 1 , the carry compensation term E corresponding to the second input data group 2 , …, and the carry compensation term E corresponding to the m-1th input data group m-1 Further, the electronic device can obtain a target PPA as shown in FIG.

[0144] In step 5, the electronic device compresses the target PPA through a Wallace tree compressor to obtain compressed data.

[0145] In step 6, the electronic device accumulates the compressed data through the adder to obtain a multiplication result for each input data group. Here, the data bit width of the multiplication result obtained by the electronic device accumulating the compressed data is 2N. The accumulation result includes the multiplication result for each input data group. For example, the multiplication result for the first input data group is 2×n bits from the first bit in the accumulation result. 1 The multiplication result of the second input data group is 2×n 1 +2×n from the 1st bit 2 This is the number indicated by the bit number.

[0146] For example, referring to FIG. 10, a first multiplier A of int16 shown in FIG. 10 is applied to a plurality of input data groups. 16 and the first multiplicand B of int1616 For example, electronic equipment includes B 16 ×A 16 Calculate the first multiplier A 16 and the first multiplicand B 16 Both are signed data, and the first multiplier A 16 The second multiplier A shown in FIG. 8-1 and the second multiplier A 8-2 and the first multiplicand B 16 The second multiplicand B 8-1 and the second multiplicand B 8-2 A 16 =(0010101100110001) 2 And A 8-1 =(00110001) 2 And A 8-2 =(00101011) 2 And A 8-1 The decimal number represented by is 49, and A 8-2 The decimal number represented by is 43. 16 =(0000001010001010) 2 And B 8-1 =(10001010) 2 And B 8-2 =(00000010) 2 And B 8-1 The decimal value represented by is -118, and B 8-2 The decimal value represented by is 2.

[0147] Figure 10 shows a simplified binary number, for example (0010101100110001). 2 is simplified to 0010101100110001, (00110001) 2 is simplified to 00110001.

[0148] First, the second multiplier A 8-1 and the second multiplicand B 8-1 The data bit width of the first input data group is 8 bits, and the second multiplier A 8-2 and the second multiplicand B 8-2and the data bit width of the second-ranked input data group is 8 bits, the electronic device adopts 8-bit radix-4 Booth coding to encode the first-ranked input data group to obtain encoded data corresponding to the first-ranked input data group, and adopts 8-bit radix-4 Booth coding to encode the second-ranked input data group to obtain encoded data corresponding to the second-ranked input data group.

[0149] Next, the electronic device generates a sub-PPA (i.e., PPA 1 ) corresponding to the second input data group based on the encoded data corresponding to the second input data group, and 2 ) can be generated.

[0150] Then, when the first input data group is a lower-order bit input data group, the electronic device generates a carry compensation term E corresponding to the first input data group. 1 The electronic device determines the carry compensation term E corresponding to the first input data group. 1 Determining the second multiplier A in the first input data group includes the following steps: 8-1 The sign bit of the second multiplicand B in the first input data group has a value of 0. 8-1 If the sign bit of B is 1, the electronic device multiplies the second multiplicand B 8-1 and the second multiplier A 8-1 The sign value of the multiplication result is determined to be 1, and the sign value of the multiplication result is inverted to obtain a carry compensation term E corresponding to the first-place input data group. 1 The compensation value of is taken as 0, and the position of the last row of the sub-PPA corresponding to the first input data group (i.e., PPA 1 The fourth line of the 1 It can be determined that the correct position is

[0151] Furthermore, the electronic device generates a target PPA as shown in FIG. 10, and multiplies the multiplication result C of the first input data group based on the target PPA. 1 and the multiplication result C of the second input data group 2 can be determined, where C 1 =(1110100101101010) 2 and C 1 The decimal number represented by is -5728, and -5728 is B 8-1 and A 8-1 (i.e., -118 multiplied by 49). 2 =(0000000001010110) 2 and C 2 The decimal number represented by is 86, and 86 is B 8-2 and A 8-2 (i.e., 2 multiplied by 43).

[0152] The sign bit (s 0 , e 0 ,  ̄e 0 , s 1 , e 1 For details of the sign bit (s 0 , e 0 ,  ̄e 0 , s 1 , e 1 , and 1) can be referred to, so the explanation will be omitted here.

[0153] For example, referring to FIG. 11, a first multiplier A of int16 shown in FIG. 11 is applied to a plurality of input data groups. 16 and the first multiplicand B of int16 16 For example, electronic equipment includes B 16 ×A 16 Calculate the first multiplier A 16 and the first multiplicand B 16 are all signed data, and the first multiplier A 16 The second multiplier A shown in FIG. 8-1 and the second multiplier A 8-2 and the first multiplicand B16 The second multiplicand B 8-1 and the second multiplicand B 8-2 A 16 =(1000101000110000) 2 And A 8-1 =(00110000) 2 And A 8-2 =(10001010) 2 And A 8-1 The decimal number represented by is 48, and A 8-2 The decimal value represented by is -118. 16 =(0110110100101000) 2 And B 8-1 =(00101000) 2 And B 8-2 =(01101101) 2 And B 8-1 The decimal number represented by is 40, and B 8-2 The decimal number represented by is 109.

[0154] Figure 11 shows a simplified binary number, for example (1000101000110000). 2 is simplified to 1000101000110000, (00110000) 2 is simplified to 00110000.

[0155] Here, in the electronic device, when the first-order input data group shown in FIG. 11 is a lower-order bit input data group, a carry compensation term E 1 The electronic device determines the carry compensation term E corresponding to the first input data group. 1 Determining the second multiplier A in the first input data group includes the following steps: 8-1 The sign bit of the second multiplicand B in the first input data group has a value of 0. 8-1 If the sign bit of B is 0, the electronic device 8-1 and the second multiplier A 8-1The sign value of the multiplication result is determined to be 0, and the sign value of the multiplication result is inverted to obtain a carry compensation term E corresponding to the first-place input data group. 1 The compensation value of is taken as 1, and the position of the last row of the sub-PPA corresponding to the first input data group (i.e., PPA 1 The fourth line of the 1 It can be determined that the correct position is

[0156] Furthermore, the electronic device generates a target PPA as shown in FIG. 11, and multiplies the multiplication result C of the first input data group based on the target PPA. 1 and the multiplication result C of the second input data group 2 can be determined, where C 1 =(0000011110000000) 2 and C 1 The decimal number represented by is 1920, and 1920 is B 8-1 and A 8-1 (i.e., 40 multiplied by 48). C 2 =(1100110111000010) 2 and C 2 The decimal number represented by is -12862, and -12862 is B 8-1 and A 8-1 (i.e., 109 multiplied by -118).

[0157] The process by which an electronic device performs the multiplier multiplication operation method for multiple input data groups shown in Figure 11 is similar to the process by which an electronic device performs the multiplier multiplication operation method for multiple input data groups shown in Figure 10, so the description thereof will be omitted here. (Exemplary Apparatus)

[0158] When adopting each functional module divided according to each function, the embodiment of the present disclosure further provides a computing device. Figure 12 is a structural schematic diagram of a computing device according to an embodiment of the present disclosure. The computing device 600 includes a compensation determination module 601, a partial product sequence determination module 602, and a partial product processing module 603.

[0159] Here, the compensation determination module 601 is for determining a plurality of input data groups of a multiplier and an encoding method of the multiplier, determining at least one lower-bit input data group in the plurality of input data groups, and determining a carry compensation term corresponding to the at least one lower-bit input data group based on the at least one lower-bit data group and the encoding method.

[0160] The partial product ordering determination module 602 is for determining a target partial product ordering based on a carry compensation term corresponding to at least one lower-bit input data group determined by the compensation determination module 601 and a plurality of input data groups.

[0161] The partial product processing module 603 is for determining a multiplication operation result for each input data group based on the target partial product sequence determined by the partial product sequence determination module 602 .

[0162] In some embodiments, as shown in Figure 12 and Figure 13, the compensation determination module 601 includes a compensation position determination unit 6011 and a compensation value determination unit 6012. Here, the compensation position determination unit 6011 is for determining a position of a carry compensation term corresponding to at least one lower-bit input data group based on the encoding scheme, the data bit width of the at least one lower-bit input data group, and the position of the at least one lower-bit input data group in the multiple input data groups. The compensation value determination unit 6012 is for determining a compensation value of a carry compensation term corresponding to at least one lower-bit input data group based on the value of a sign bit of each data in the at least one lower-bit input data group.

[0163] In some embodiments, the compensation position determination unit 6011 determines a position of the last row of the sub partial product array corresponding to the at least one lower bit input data group based on the encoding scheme, the data bit width of the at least one lower bit input data group, and the position of the at least one lower bit input data group in the multiple input data groups, and determines a position of a carry compensation term corresponding to the at least one lower bit input data group based on the position of the last row of the sub partial product array corresponding to the at least one lower bit input data group.

[0164] In some embodiments, the compensation value determination unit 6012 performs an XNOR operation on the numerical values ​​of the sign bits of the multiplier and the multiplicand in each lower-bit input data group to determine a numerical value after the XNOR operation, and determines a compensation term value of the carry compensation term corresponding to each lower-bit input data group based on the numerical value after the XNOR operation.

[0165] In some embodiments, the compensation value determination unit 6012 determines a sign value of the multiplication result of the multiplier and the multiplicand according to the value of the sign bit of the multiplier and the multiplicand in each lower-bit input data group, and inverts the sign value to obtain a compensation term value of the carry compensation term corresponding to each lower-bit input data group.

[0166] In some embodiments, as shown in Figure 12 and Figure 13, the partial product sequencing module 602 includes an encoding unit 6021 and a partial product sequencing unit 6022. Here, the encoding unit 6021 is for encoding each input data group by adopting an encoding method corresponding to the data bit width of each input data group to obtain encoded data corresponding to each input data group. The partial product sequencing unit 6022 is for generating an initial partial product array including sub partial product arrays corresponding to each input data group according to the encoded data corresponding to each input data group, and adding a carry compensation term to the initial partial product array according to the compensation position and compensation value of the carry compensation term corresponding to at least one lower bit input data group to obtain a target partial product array.

[0167] In some embodiments, the compensation determination module 601 determines at least one lower-bit input data group in the multiple input data groups according to a sum of the data bit widths of the input data groups being less than or equal to a maximum data bit width that the multiplier can implement.

[0168] 12 and 13, in some embodiments, the partial product processing module 603 includes a partial product compression unit 6031 and an accumulation unit 6032. Here, the partial product compression unit 6031 is for compressing the target partial product array using a Wallace tree compressor to obtain compressed data. The accumulation unit 6032 is for accumulating the compressed data to obtain a multiplication operation result of each input data group.

[0169] The beneficial technical effects corresponding to the exemplary embodiments of the present apparatus may be referred to the beneficial technical effects in the above exemplary method section, and therefore will not be described here. (Example Electronic Devices)

[0170] FIG. 14 is a structural diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 10 includes at least one processor 11 and a memory 12.

[0171] The processor 11 may be a central processing unit (CPU) or other type of processing unit having data processing and / or instruction execution capabilities, and may control other components within the electronic device 10 to perform desired functions.

[0172] The memory 12 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. The computer-readable storage medium may store one or more computer program instructions, and the processor 11 may execute one or more program instructions to realize the multiplier operation method according to each embodiment of the present disclosure and / or other desired functions.

[0173] In one example, electronic device 10 may further include input device(s) 13 and output device(s) 14 connected to each other via a bus system and / or other form of connection (not shown).

[0174] The input device 13 may include, for example, a keyboard and a mouse.

[0175] The output device 14 can output various information to the outside, and can include, for example, a display, a speaker, a printer, a communication network, and remote output devices to which they are connected.

[0176] For simplicity, Fig. 14 shows only some of the components related to the present disclosure in the electronic device 10, and omits components such as a bus and an input / output interface. In addition, the electronic device 10 may further include any appropriate components according to specific application conditions. Exemplary Computer Program Products and Computer-Readable Storage Media

[0177] In addition to the above methods and apparatuses, the embodiments of the present disclosure may provide a computer program product including computer program instructions that, when executed by a processor, cause the processor to perform steps in the multiplier operation method according to each embodiment described in the "Exemplary Method" section above.

[0178] The computer program product may be written with program code for carrying out operations of the disclosed embodiments in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, and general procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed as follows: entirely on the user computing device, partially on the user device, as a separate software package, partly on the user computing device and partly on a remote computing device, or entirely on the remote computing device or a server.

[0179] Moreover, the embodiments of the present disclosure may further provide a computer-readable storage medium having stored thereon computer program instructions which, when executed by a processor, cause the processor to perform steps of the multiplier operation methods according to the embodiments described in the "Exemplary Method" section above.

[0180] Any combination of one or more readable media can be employed as the computer readable storage medium. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include an electrical connection having one or more conductors, a mobile hard drive, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0181] Although the basic principles of the present disclosure have been described above with reference to specific embodiments, the advantages, merits, effects, etc. mentioned in the present disclosure are merely illustrative and not limiting, and are not necessarily possessed by each embodiment of the present disclosure. In addition, the specific details of the above disclosure are merely illustrative and easy-to-understand functions, and are not limiting, and the above details do not necessarily limit the present disclosure to be realized by the above specific details.

[0182] Those skilled in the art can make various modifications and variations to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. determining a plurality of input data groups of a multiplier and an encoding scheme for said multiplier; determining at least one least significant bit input data group of the plurality of input data groups; determining a carry compensation term corresponding to at least one group of least significant input data based on the at least one group of least significant input data and the encoding scheme; obtaining a target partial product array based on a carry compensation term corresponding to the at least one lower-order bit input data group and the plurality of input data groups; determining a multiplication operation result for each input data group based on the target partial product array; 4. A multiplier operation method comprising:

2. determining a carry compensation term corresponding to the at least one least significant bit input data group based on at least one least significant bit input data group among the plurality of input data groups and the encoding scheme, determining a position of a carry compensation term corresponding to the at least one least significant bit input data group based on the encoding scheme, a data bit width of the at least one least significant bit input data group, and a position of the at least one least significant bit input data group among the plurality of input data groups; determining a compensation value of a carry compensation term corresponding to the at least one lower-order input data group based on a numerical value of a sign bit of each data in the at least one lower-order input data group; 2. The multiplier operation method according to claim 1 .

3. determining a position of a carry compensation term corresponding to the at least one lower-order bit input data group based on the encoding scheme, a data bit width of the at least one lower-order bit input data group, and a position of the at least one lower-order bit input data group in the plurality of input data groups, determining a position of a last row of a sub partial product array corresponding to the at least one lower-bit input data group based on the encoding method, a data bit width of the at least one lower-bit input data group, and a position of the at least one lower-bit input data group among the plurality of input data groups; determining a compensation position of a carry compensation term corresponding to the at least one lower-order bit input data group based on a position of a last row of a sub partial product array corresponding to the at least one lower-order bit input data group; 3. The multiplier operation method according to claim 2.

4. determining a compensation value of a carry compensation term corresponding to the at least one lower-order input data group based on a numerical value of a sign bit of each data in the at least one lower-order input data group, performing an XNOR operation on the values ​​of the sign bits of the multiplier and multiplicand in each of the least significant input data groups to determine a post-XNOR value; determining a compensation value for a carry compensation term corresponding to the at least one lower-order bit input data group based on the value after the XNOR operation; 3. The multiplier operation method according to claim 2.

5. determining a compensation value of a carry compensation term corresponding to the at least one lower-order input data group based on a numerical value of a sign bit of each data in the at least one lower-order input data group, determining a sign value of a multiplication result of the multiplier and the multiplicand based on the value of the sign bit of the multiplier and the multiplicand in each of the lower-order bit input data groups; inverting a sign value of the multiplication operation result to obtain a compensation value of a carry compensation term corresponding to each of the lower-order bit input data groups; 3. The multiplier operation method according to claim 2.

6. The step of obtaining a target partial product array based on a carry compensation term corresponding to the at least one lower-order bit input data group and the plurality of input data groups includes: Encoding each of the input data groups by adopting an encoding method corresponding to a data bit width of each of the input data groups to obtain encoded data corresponding to each of the input data groups; generating an initial partial product array including sub partial product arrays corresponding to each of the input data groups based on encoded data corresponding to each of the input data groups; adding the carry compensation term to the initial partial product array based on a position of the compensation value of a carry compensation term corresponding to the at least one lower-order bit input data group and the compensation value to obtain the target partial product array.

6. The multiplier operation method according to claim 2, wherein the first and second inputs are multiplied by one another.

7. The step of determining at least one least significant bit input data group of the plurality of input data groups comprises: determining at least one lower-bit input data group among the plurality of input data groups in response to a sum of data bit widths of the input data groups being equal to or less than a maximum data bit width that the multiplier can implement; 6. The multiplier operation method according to claim 1,

8. determining a multiplication operation result for each input data group based on the target partial product array, compressing the target partial product array using a Wallace tree compressor to obtain compressed data; accumulating the compressed data to obtain a multiplication operation result for each of the input data groups; 6. The multiplier operation method according to claim 1,

9. a compensation determination module for determining a plurality of input data groups of a multiplier and an encoding scheme of the multiplier, determining at least one lower-order bit input data group in the plurality of input data groups, and determining a carry compensation term corresponding to the at least one lower-order bit input data group based on the at least one lower-order bit data group and the encoding scheme; a partial product ordering module for determining a target partial product ordering based on the carry compensation term corresponding to the at least one lower-order bit input data group determined by the compensation determination module and the plurality of input data groups; a partial product processing module for determining a multiplication operation result for each input data group based on the target partial product sequence determined by the partial product sequence determination module; A computing device comprising:

10. A computer program for executing the multiplier calculation method according to any one of claims 1 to 5 is stored. A computer-readable storage medium comprising:

11. A processor; a memory for storing instructions executable by the processor; The processor implements the multiplier operation method according to any one of claims 1 to 5 by reading the executable instructions from the memory and executing them.

1. An electronic device comprising:

Citation Information

Patent Citations

  • Multiplier and product-sum operator

    JP2000076046A

  • Method and device for performing operations involving multiplication of selectively partitioned binary inputs using booth encoding

    US20040225705A1

  • Using a single instruction multiple data (SIMD) instruction to speed up galois counter mode (GCM) computations

    US20090310775A1

  • Method and apparatus for performing multiple types of multiplication including signed and unsigned multiplication

    US6144980A