Multiplier, data processing method, device and chip

By improving the regular signed number encoding circuit, Wallace tree circuit and accumulation circuit, combined with the 4-2 compressor and logic gate unit, the problem of insufficient versatility of the existing multiplier in low-bit width data operations is solved, and the multiplier is realized. The multiplication operation of data with different bit widths improves the versatility and efficiency of the multiplier.

CN113031911BActive Publication Date: 2024-09-17SHANGHAI CAMBRICON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911349744.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-24
Publication Date
2024-09-17
Estimated Expiration
2040-03-06

AI Technical Summary

Technical Problem

Existing multipliers have low versatility when performing low-bit-width data operations and cannot effectively handle data of different bit-widths, resulting in limited application of the multiplier.

Method used

A multiplier is designed, which adopts an improved regular signed number encoding circuit, an improved Wallace tree circuit and an improved accumulation circuit, and uses a 4-2 compressor and selection circuit, combined with a logic gate unit, to achieve multiplication of data with different bit widths. Operation, the data bit width is determined through the function mode selection signal to improve the versatility of the multiplier.

Benefits of technology

It realizes multiplication operations on a variety of data with different bit widths, improves the versatility and computing efficiency of the multiplier, and reduces the power consumption and complexity of the multiplier.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113031911B
    Figure CN113031911B
Patent Text Reader

Abstract

The present application provides a multiplier, a data processing method, a device and a chip. The multiplier includes: an improved regular signed number encoding circuit, an improved Wallace tree circuit and an improved accumulation circuit. The improved Wallace tree circuit includes a 4-2 compressor, and the 4-2 compressor includes a selection circuit and a full adder. The output end of the improved regular signed number encoding circuit is connected to the input end of the improved Wallace tree circuit, and the output end of the improved Wallace tree circuit is connected to the input end of the improved accumulation circuit. The improved Wallace tree circuit and the improved accumulation circuit both include a logic gate unit, and the input end of the logic gate unit is used to receive a receiving function mode selection signal, and the function mode selection signal is used to determine the data bit width that can be processed by the multiplier. The multiplier can perform multiplication operations on data of multiple different bit widths, thereby improving the versatility of the multiplier.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a multiplier, a data processing method, a device and a chip. Background Art

[0002] With the continuous development of digital electronic technology, the rapid development of various artificial intelligence (AI) chips has put higher and higher requirements on high-performance digital multipliers. As one of the widely used algorithms in smart chips, neural network algorithms use multipliers for multiplication, which is a common operation in neural network algorithms.

[0003] Generally, existing multipliers with different bit widths can realize multiplication operations of data with different bit widths. However, for low bit width data operations, existing multipliers that can process high bit width data cannot be used for multiplication operations, resulting in low versatility of the multiplier. Summary of the invention

[0004] Based on this, it is necessary to provide a multiplier, a data processing method, a device and a chip that can improve the versatility of the multiplier in response to the above technical problems.

[0005] The embodiment of the present application provides a multiplier, the multiplier comprising: an improved regular signed number encoding circuit, an improved Wallace tree circuit and an improved accumulation circuit, the improved Wallace tree circuit comprising a 4-2 compressor, the 4-2 compressor comprising a selection circuit and a full adder; the output end of the improved regular signed number encoding circuit is connected to the input end of the improved Wallace tree circuit, the output end of the improved Wallace tree circuit is connected to the input end of the improved accumulation circuit, the improved Wallace tree circuit and the improved accumulation circuit both comprise a logic gate unit, the input end of the logic gate unit is used to receive a receiving function mode selection signal, the function mode selection signal is used to determine the data bit width that can be processed by the multiplier;

[0006] Among them, the improved regular signed number encoding circuit is used to perform regular signed number encoding processing on the received data to obtain the target code, and obtain the partial product after the sign bit is extended according to the target code, the improved Wallace tree circuit is used to perform accumulation processing on the partial product after the sign bit is extended to obtain the accumulation operation result, and the improved accumulation circuit is used to perform accumulation processing on the accumulation operation result to obtain the target operation result.

[0007] In one of the embodiments, the improved regular signed number encoding circuit includes an encoding processing branch and a partial product acquisition branch; the encoding processing branch is used to perform regular signed number encoding processing on the received data to obtain a target code; the partial product acquisition branch is used to obtain the partial product after sign bit expansion according to the target code.

[0008] In one embodiment, the encoding processing branch includes a regular signed number encoding unit; the partial product acquisition branch includes a low-order partial product acquisition unit, a low-order selector group unit, a low-order AND logic unit, a high-order partial product acquisition unit, a high-order selector group unit, and a high-order AND logic unit; the first output end of the regular signed number encoding unit is connected to the first input end of the low-order partial product acquisition unit, the output end of the low-order selector group unit is connected to the second input end of the low-order partial product acquisition unit, the output end of the low-order AND logic unit is connected to the third input end of the low-order partial product acquisition unit, the second output end of the regular signed number encoding unit is connected to the first input end of the high-order partial product acquisition unit, the output end of the high-order selector group unit is connected to the second input end of the high-order partial product acquisition unit, and the output end of the high-order AND logic unit is connected to the third input end of the high-order partial product acquisition unit;

[0009] Among them, the regular signed number encoding unit is used to determine the bit width of the data that can be processed by the multiplier according to the received functional mode selection signal, and perform regular signed number encoding processing on the received first data to obtain the low-order target code and the high-order target code, the low-order partial product acquisition unit is used to obtain the low-order partial product after sign bit extension according to the received low-order target code and the second data, the low-order selector group unit is used to select the first value in the low-order partial product after sign bit extension, the low-order AND logic unit is used to perform an AND logic operation according to the received functional mode selection signal to obtain the second value in the low-order partial product after sign bit extension, the high-order partial product acquisition unit is used to obtain the high-order partial product after sign bit extension according to the received high-order target code and the second data, the high-order selector group unit is used to select the third value in the high-order partial product after sign bit extension, and the high-order AND logic unit is used to perform an AND logic operation according to the received functional mode selection signal to obtain the fourth value in the high-order partial product after sign bit extension.

[0010] In one embodiment, the regular signed number encoding unit includes: a first data input port, a first mode selection signal input port, a low-order target code output port and a high-order target code output port; the first data input port is used to receive the first data, the first mode selection signal input port is used to receive the functional mode selection signal, the low-order target code output port is used to output the low-order target code obtained after regular signed number encoding processing is performed on the first data, and the high-order target code output port is used to output the high-order target code obtained after regular signed number encoding processing is performed on the first data.

[0011] In one embodiment, the low-order partial product acquisition unit includes: a low-order target code input port, a first selection value input port, a second selection value input port, a second data input port and a low-order partial product output port; the low-order target code input port is used to receive the low-order target code, the first selection value input port is used to receive the first value in the low-order partial product after the sign bit is extended and output by the low-order selector group unit after being selected, the second selection value input port is used to receive the second value in the low-order partial product after the sign bit is extended and output by the low-order and logic unit, the second data input port is used to receive the second data, and the low-order partial product output port is used to output the low-order partial product after the sign bit is extended.

[0012] In one of the embodiments, the low-bit selector group unit comprises: a low-bit selector; the low-bit selector is used to select the first value in the low-bit partial product after the sign bit is extended.

[0013] In one embodiment, the low-order AND logic unit includes: a first mode selection signal input port, a first sign bit value input port and a first result output port; wherein the first mode selection signal input port is used to receive the functional mode selection signal, the first sign bit value input port is used to receive the first sign bit value in the low-order partial product after the sign bit is extended, and the first result output port is used to output the logic operation result.

[0014] In one embodiment, the high-order partial product acquisition unit includes: a high-order target code input port, a third selection value input port, a fourth selection value input port, a second data input port and a high-order partial product output port; the high-order partial product acquisition unit is used to receive the high-order target code, the third selection value input port is used to receive the third value in the high-order partial product after the sign bit is extended and output after the high-order selector group unit is selected, the fourth selection value input port is used to receive the fourth value in the high-order partial product after the sign bit is extended and output by the high-order and logic unit, the second data input port is used to receive the second data, and the high-order partial product output port is used to output the high-order partial product after the sign bit is extended.

[0015] In one of the embodiments, the high-order selector group unit includes: a high-order selector, and the high-order selector is used to select a third value in the high-order partial product after the sign bit is extended.

[0016] In one embodiment, the high-order AND logic unit includes: a second mode selection signal input port, a second sign bit value input port and a second result output port; wherein the second mode selection signal input port is used to receive the functional mode selection signal, the second sign bit value input port is used to receive the second sign bit value in the high-order partial product after the sign bit is extended, and the second result output port is used to output the logic operation result.

[0017] In one embodiment, the improved Wallace tree circuit includes: a low-order Wallace tree unit, an AND logic unit and a high-order Wallace tree unit, the output end of the low-order Wallace tree unit is connected to the input end of the AND logic unit, and the output end of the AND logic unit is connected to the input end of the high-order Wallace tree unit; wherein the low-order Wallace tree unit is used to perform accumulation processing on each column of values ​​in the partial products after all sign bits are extended, the AND logic unit is used to perform an AND logic operation on the received functional mode selection signal and the carry output signal output by the low-order Wallace tree unit to obtain the carry input signal received by the high-order Wallace tree unit, and the high-order Wallace tree unit is used to perform accumulation processing on each column of values ​​in the partial products after all sign bits are extended.

[0018] In one embodiment, the low-order Wallace tree unit and the high-order Wallace tree unit both include the 4-2 compressor and a mode selection circuit, the output end of the mode selection circuit is connected to the input end of the 4-2 compressor, and the mode selection circuit includes a first input end for receiving the functional mode selection signal; wherein the 4-2 compressor is used to accumulate the values ​​of each column in all the partial products after sign bit expansion, and the mode selection circuit is used to select the values ​​in the partial products after sign bit expansion received by the 4-2 compressor.

[0019] In one embodiment, the improved accumulation circuit includes: a low-order adder, an AND logic unit and a high-order adder, the low-order adder is used to perform accumulation processing on the low-order accumulation operation result, the AND logic unit is used to perform an AND logic operation on the received functional mode selection signal and the output signal of the low-order adder to obtain the carry input signal of the high-order adder, and the high-order adder is used to perform an accumulation operation based on the carry input signal and the high-order accumulation operation result.

[0020] The multiplier provided in this embodiment performs regular signed number encoding processing on the received data by improving the regular signed number encoding circuit to obtain the partial product after the sign bit is extended, and accumulates the partial product after the sign bit is extended by improving the Wallace tree circuit to obtain the target operation result; the above-mentioned multiplier can perform multiplication operations on data of various different bit widths, thereby improving the versatility of the multiplier.

[0021] The present application provides a data processing method, the method comprising:

[0022] Receiving data to be processed and a function mode selection signal, wherein the function mode selection signal is used to indicate a bit width of currently processable data;

[0023] According to the function mode selection signal, determining whether the data to be processed needs to be split and processed;

[0024] If the data to be processed needs to be split, the data to be processed is split to obtain split data;

[0025] Performing regular signed number encoding processing on the split data to obtain a target code;

[0026] Obtaining the partial product after the sign bit extension according to the functional mode selection signal, the target code and the split data;

[0027] The partial products after the sign bit extension are accumulated to obtain the target operation result.

[0028] In one of the embodiments, judging whether the data to be processed needs to be split according to the functional mode selection signal includes: judging whether the bit width of the data to be processed is equal to the data bit width that can be processed by the multiplier according to the functional mode selection signal.

[0029] In one of the embodiments, the method further includes: if the data to be processed does not need to be split, then continue to perform regular signed number encoding processing on the data to be processed to obtain the target code.

[0030] In one embodiment, the split data is subjected to regular signed number encoding processing to obtain a target code, including: converting consecutive l-bit values ​​1 in the split data into (l+1) highest bit values ​​1, lowest bit values ​​-1, and the remaining bits as values ​​0, to obtain the target code, wherein l is greater than or equal to 2.

[0031] In one embodiment, performing regular signed number encoding processing on the split data to obtain a target code includes:

[0032] Performing regular signed number encoding processing on the split data to obtain an intermediate code;

[0033] The target code is obtained according to the intermediate code and the functional mode selection signal.

[0034] In one embodiment, the target code includes a low-order target code and a high-order target code; and obtaining the partial product after the sign bit extension according to the function mode selection signal, the target code and the split data includes:

[0035] Obtaining a first partial product after sign bit extension according to a low-order target code in the target code and the split data;

[0036] According to the function mode selection signal, a first value of the low-order partial product after the sign bit is extended is obtained;

[0037] Performing an AND logic operation on the function mode selection signal and the sign bit value in the first partial product after the sign bit is extended to obtain a second value in the low-order partial product after the sign bit is extended;

[0038] The value in the first partial product after the sign bit is extended, the first value, and the second value are combined to obtain the low-order partial product after the sign bit is extended.

[0039] In one embodiment, obtaining the partial product after the sign bit extension according to the functional mode selection signal, the target code and the split data includes:

[0040] Obtaining a second partial product after sign bit extension according to a high-order target code in the target code and the split data;

[0041] Obtaining a third value of the high-order partial product after the sign bit is extended according to the function mode selection signal;

[0042] Performing an AND logic operation on the function mode selection signal and the sign bit value in the second partial product after the sign bit is extended to obtain a fourth value in the high-order partial product after the sign bit is extended;

[0043] The value in the second partial product after the sign bit extension, the third value and the fourth value are combined to obtain the high-order partial product after the sign bit extension.

[0044] In one embodiment, the accumulating the partial products after the sign bit extension to obtain the target operation result includes:

[0045] Performing accumulation processing on the column values ​​in the partial product after the sign bit is extended by using a low-order Wallace tree unit to obtain an accumulation operation result;

[0046] Performing an AND logic operation on the accumulation operation result and the function mode selection signal through an AND logic unit to obtain a carry input signal;

[0047] The carry input signal and the column values ​​in the partial product after the sign bit is extended are accumulated through the high-order Wallace tree unit to obtain the target operation result.

[0048] A data processing method provided by the present embodiment, the multiplier can receive data to be processed and a function mode selection signal, and judge whether the data to be processed needs to be split according to the function mode selection signal. If the data to be processed needs to be split, the data to be processed is split to obtain the split data, and the split data is coded with a regular signed number to obtain a target code, and partial products after sign bit extension are obtained according to the function mode selection signal, the target code and the split data, and the partial products after sign bit extension are accumulated to obtain a target operation result; the method can perform multiplication operations on data of various different bit widths according to the function mode selection signal received by the multiplier, thereby improving the versatility of the multiplier.

[0049] The embodiment of the present application provides a machine learning operation device, which includes one or more multipliers as described above; the machine learning operation device is used to obtain data to be operated and control information from other processing devices in the machine learning operation device except the multiplier, and perform specified machine learning operations, and transmit the execution results to other processing devices in the machine learning operation device except the multiplier through an I / O interface;

[0050] When the machine learning computing device includes a plurality of the multipliers, the plurality of the multipliers are connected via a preset structure and transmit data;

[0051] Among them, multiple multipliers are interconnected and transmit data through a PCIE bus to support larger-scale machine learning operations; multiple multipliers share the same control system or have their own control systems; multiple multipliers share memory or have their own memory; the interconnection method of multiple multipliers is any interconnection topology.

[0052] An embodiment of the present application provides a combined processing device, which includes a machine learning processing device as described above, a universal interconnection interface, and other processing devices in the combined processing device except the machine learning operation device; the machine learning operation device interacts with other processing devices in the combined processing device except the machine learning operation device to jointly complete user-specified operations; the combined processing device may also include a storage device, which is respectively connected to the machine learning operation device and other processing devices in the combined processing device except the machine learning operation device and the storage device, and is used to save data of the machine learning operation device and other processing devices in the combined processing device except the machine learning operation device and the storage device.

[0053] An embodiment of the present application provides a neural network chip, which includes the multiplier mentioned above, the machine learning operation device mentioned above, or the combined processing device mentioned above.

[0054] An embodiment of the present application provides a neural network chip packaging structure, which includes the neural network chip described above.

[0055] An embodiment of the present application provides a board card, which includes the neural network chip packaging structure described above.

[0056] An embodiment of the present application provides an electronic device, which includes the neural network chip or the board mentioned above.

[0057] A chip provided in an embodiment of the present application includes at least one multiplier as described in any one of the above items.

[0058] An electronic device provided in an embodiment of the present application includes the chip as described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 A schematic diagram of the structure of a multiplier provided by an embodiment;

[0060] Figure 2 A specific structural circuit diagram of a multiplier provided in another embodiment;

[0061] Figure 3 A specific structural circuit diagram of an improved regular signed number encoding circuit provided by another embodiment;

[0062] Figure 4 A schematic diagram of the distribution of partial products after sign bit extension obtained by multiplying two groups of 4-bit data provided by an embodiment;

[0063] Figure 5 A schematic diagram of the distribution of partial products after sign bit extension obtained by multiplication and accumulation operations of 8-bit data provided by an embodiment;

[0064] Figure 6 A schematic diagram of the circuit structure of an improved Wallace tree unit and an improved accumulation circuit provided in another embodiment;

[0065] Figure 7 A schematic diagram of a data processing method flow chart provided by an embodiment;

[0066] Figure 8 A schematic flow chart of a method for obtaining a target code provided by another embodiment;

[0067] Fig. 9 A schematic flow chart of a method for obtaining a partial product after sign bit extension provided in another embodiment;

[0068] Fig.10 A structural diagram of a combined processing device provided by an embodiment;

[0069] Fig.11 A structural diagram of another combined processing device provided by an embodiment;

[0070] Fig.12 A schematic diagram of the structure of a board provided in an embodiment. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0072] The multiplier provided in the present application can be applied to an AI chip, a field programmable gate array FPGA (Field-Programmable Gate Array, FPGA) chip, or other hardware circuit devices for multiplication processing. The specific structural diagram is shown in FIG. Figure 1 and Figure 2 shown.

[0073] like Figure 1 FIG. 1 is a structural diagram of a multiplier provided by an embodiment. Figure 1 As shown, the multiplier includes: an improved regular signed number encoding circuit 11, an improved Wallace tree circuit 12 and an improved accumulation circuit 13, wherein the improved Wallace tree circuit 12 includes a 4-2 compressor, and the 4-2 compressor includes a selection circuit and a full adder; the output end of the improved regular signed number encoding circuit 11 is connected to the input end of the improved Wallace tree circuit 12, and the output end of the improved Wallace tree circuit 12 is connected to the input end of the improved accumulation circuit 13.

[0074] Wherein, the improved Wallace tree circuit 12 and the improved accumulation circuit 13 both include a logic gate unit, the input end of the logic gate unit is used to receive a function mode selection signal (mode signal), and the function mode selection signal is used to determine the data bit width that the multiplier can process. The improved regular signed number encoding circuit 11 is used to perform regular signed number encoding processing on the received data to obtain a target code, and obtain a partial product after the sign bit is extended according to the target code, the improved Wallace tree circuit 12 is used to perform accumulation processing on the partial product after the sign bit is extended to obtain an accumulation operation result, and the improved accumulation circuit 13 is used to perform accumulation processing on the accumulation operation result to obtain a target operation result.

[0075] Optional, continue to see Figure 1 As shown, the improved regular signed number encoding circuit 11 includes an encoding processing branch 111 and a partial product acquisition branch 112; the encoding processing branch 111 is used to perform regular signed number encoding processing on the received data to obtain a target code; the partial product acquisition branch 112 is used to obtain the partial product after sign bit expansion according to the target code.

[0076] Specifically, the above-mentioned improved regular signed number encoding circuit 11 may include two data processing units with different functions, namely, the encoding processing branch 111 and the partial product acquisition branch 112, and the improved regular signed number encoding circuit 11 may receive two data, which can be used as the multiplier and the multiplicand in the multiplication operation respectively. In the multiplication operation, the above-mentioned data can be a fixed-point number. Optionally, the encoding processing branch 111 may include a unit with a regular signed number encoding processing function, and the partial product acquisition branch 112 may include a data processing unit with multiple different functions. Optionally, the improved regular signed number encoding circuit 11 can receive data with multiple different bit widths, that is, the multiplier provided in this embodiment can process multiplication operations of multiple different bit widths of data. However, in the same multiplication operation, the multiplier and the multiplicand received by the improved regular signed number encoding circuit 11 can be data with the same bit width, that is, the bit widths of the multiplier and the multiplicand are equal. Illustratively, the multiplier provided in this embodiment can process 4-bit*4-bit data multiplication operations, 8-bit*8-bit data multiplication operations, 16-bit*16-bit data multiplication operations, 32-bit*32-bit data multiplication operations, and can also process 64-bit*64-bit data multiplication operations, and this embodiment does not impose any limitation on this.

[0077] It should be noted that the above-mentioned improved regular signed number encoding circuit 11 can receive the multiplier and multiplicand in the multiplication operation, and perform regular signed number encoding on the multiplier to obtain the target code, and obtain the partial product after sign bit expansion according to the target code and the received multiplicand. The bit width of the partial product after sign bit expansion can be equal to twice the bit width of the data currently processed by the multiplier. Exemplarily, a multiplier receives data with a bit width of 8 bits, and the multiplier can currently process 4-bit data multiplication operations. Then, the improved regular signed number encoding circuit 11 in the multiplier needs to divide the 8-bit data into two data with a high 4 bits and a low 4 bits, and synchronously perform regular signed number encoding processing on the data. The bit width of the partial product after the sign bit is expanded can be equal to twice the bit width of the data currently processed by the multiplier. During the synchronous processing of the two groups of data with the high 4 bits and the low 4 bits, the number of partial products after the sign bit is expanded can be equal to 5, that is, the bit width of the data that the multiplier can currently process plus 1; if the multiplier can currently process 8-bit data multiplication operations, the improved regular signed number encoding circuit 11 in the multiplier needs to operate on the entire 8-bit data. At this time, the bit width of the partial product after the sign bit is expanded can be 16 bits, and the number of partial products after the sign bit is expanded can be equal to 10, that is, the bit width of the data that the multiplier can currently process plus 2. In this embodiment, the above-mentioned regular signed number encoding process can be characterized as a data processing process encoded by the numerical values ​​0, -1 and 1.

[0078] It is understandable that there may be multiple functional mode selection signals, and different functional mode selection signals correspond to multiplication operations of different bit width data that the multiplier can currently process. Optionally, during the same multiplication operation, the logic gate units included in the improved Wallace tree circuit 12 and the improved accumulation circuit 13 may receive the same functional mode selection signals. Optionally, the logic gate unit may be an AND gate logic unit, or a logic unit composed of an AND gate logic unit and an OR gate logic unit.

[0079] Exemplarily, the mode signal that the logic unit can receive may be equal to 0 or 1; however, in this embodiment, a mode signal of 0 may indicate that the multiplier can process 4-bit data, and a mode signal of 1 may indicate that the multiplier can process 8-bit data.

[0080] It can also be understood that the above-mentioned method of regular signed number encoding processing can be characterized in the following manner: if the data bit width received by the multiplier is 2N, N-bit data can be processed at present, and for an N-bit multiplier, processing is performed from low-bit values ​​to high-bit values. If there are continuous l (l>=2)-bit values ​​1, then the continuous n-bit values ​​1 can be converted and processed into data "1 (0) l-1 (-1)", and the remaining corresponding (Nl)-bit values ​​are combined with the converted (l+1)-bit value to obtain a new data; then the new data is used as the initial data for the next level of conversion processing until there are no continuous l (l>=2)-bit values ​​of 1 in the new data obtained after the conversion processing; wherein, the N-bit multiplier is subjected to regular signed number encoding processing, and the bit width of the obtained target code can be equal to the data bit width 2N plus 2 received by the multiplier). Further, during the regular signed number encoding processing, data 11 can be converted to (100-001), that is, data 11 can be equivalently converted to 10(-1); data 111 can be converted to (1000-0001), that is, data 111 can be equivalently converted to 100(-1); and so on, the conversion processing method of other continuous l (l>=2)-bit values ​​of 1 is similar.

[0081] For example, the multiplier received by the encoding processing branch 111 is "001010101101110", and the first new data obtained after the first level conversion processing on the multiplier is "0010101011100(-1)0", and the second new data obtained after the second level conversion processing on the first new data is "0010101100(-1)00(-1)0", and the third new data obtained after the third level conversion processing on the second new data is "0010110(-1)00(-1)00(-1)0", and the fourth level conversion processing on the third new data is performed. The fourth new data obtained after processing is "00110(-1)0(-1)00(-1)00(-1)00(-1)0", and the fifth new data obtained after continuing to perform the fifth-level conversion processing on the fourth new data is "010(-1)0(-1)0(-1)00(-1)00(-1)00(-1)0". There are no consecutive l (l>=2)-bit values ​​1 in the fifth new data. At this time, the fifth new data can be called the initial code, and after a bit-filling processing is performed on the initial code, the intermediate code representing the regular signed number encoding processing is completed, wherein the bit width of the initial code can be equal to the bit width of the multiplier. Optionally, the encoding processing branch 111 performs regular signed number encoding processing on the multiplier to obtain new data (i.e., initial code); if the highest bit value and the second highest bit value in the new data are "10" or "01", the encoding processing branch 111 can fill the highest bit value of the new data with a single-digit value of 0, and obtain the corresponding intermediate code high three-digit values ​​of "010" or "001" respectively. Optionally, the bit width of the above intermediate code can be equal to the bit width of the data that the multiplier can currently process plus 1. In addition, if the data bit width received by the current multiplier is 2N, and the multiplier can currently process N-bit data operations, the encoding processing branch 111 in the multiplier can split the 2N-bit data into two groups of N-bit data for separate data operations. At this time, the two groups of (N+1)-bit intermediate codes obtained can be combined and used as the target code; if the multiplier can currently process 2N-bit data operations, the encoding processing branch 111 in the multiplier can complement the highest bit value of the obtained (2N+1)-bit intermediate code with a single-bit value of 0 (i.e., complement processing), and use the (2N+2)-bit data after complement processing as the target code.

[0082] In this embodiment, the improved regular signed number encoding circuit 11 can perform regular signed number encoding processing on the multiplier to obtain the original partial product, and then perform sign bit extension processing on the original partial product to obtain the partial product after the sign bit extension, the bit width of the original partial product can be equal to the data bit width N currently processed by the multiplier, and the bit width of the partial product after the sign bit extension can be equal to 2N; wherein, the high N-bit values ​​of the partial product after the sign bit extension can be equal, and the low N-bit values ​​can be equal to the values ​​in the original partial product obtained by the target code and the multiplicand. If the target code and the N-bit multiplicand can obtain the N-bit original partial product, the high N-bit values ​​of the partial product after the sign bit extension can all be equal to the highest bit value of the original partial product, and the low N-bit values ​​of the partial product after the sign bit extension can be equal to the N-bit value of the original partial product. Optionally, the above-mentioned target code can include three values, namely -1, 0 and 1. When the value in the target code is -1, the original partial product can be -X, when the value in the target code is 1, the original partial product can be X, and when the value in the target code is 0, the original partial product can be 0, wherein X is the multiplicand received by the multiplier, and each value in the target code can obtain a corresponding original partial product. Optionally, the original partial product can include an original low-order partial product and an original high-order partial product. In this embodiment, the improved Wallace tree circuit 12 can be composed of a 4-2 compressor. Optionally, a 4-2 compressor can include multiple full adders and a selection circuit. Under certain conditions, the selection circuit in the 4-2 compressor can control the full adder to be in a closed state to improve the efficiency of the improved Wallace tree subcircuit and reduce the delay. Optionally, the selection circuit can be a circuit composed of multiple selectors, the selector can be a two-way selector, and the selection circuit can receive a functional mode selection signal, and control the on and off state of the full adder according to the received functional mode selection signal.

[0083] The multiplier provided in this embodiment performs regular signed number encoding processing on received data by improving the regular signed number encoding circuit to obtain partial products after sign bit extension, and performs accumulation processing on the partial products after sign bit extension by improving the Wallace tree circuit to obtain the target operation result; the above-mentioned multiplier can perform multiplication operations on data of various different bit widths, thereby improving the versatility of the multiplier; in addition, the multiplier can perform regular signed number encoding processing on received data by improving the regular signed number encoding circuit, and can obtain a smaller number of effective partial products, thereby reducing the complexity of the multiplier to implement multiplication operations, improving the operation efficiency of the multiplication operations, and effectively reducing the power consumption of the multiplier; at the same time, the multiplier can further effectively reduce the power consumption of the multiplier by accumulating the partial products after sign bit extension by improving the Wallace tree group circuit.

[0084] Figure 2A schematic diagram of a specific structure of a multiplier provided in another embodiment, wherein the multiplier includes a coding processing branch 111, the coding processing branch 111 includes a regular signed number coding unit 1111, the partial product acquisition branch 112 includes a low-order partial product acquisition unit 1121, a low-order selector group unit 1122, a low-order AND logic unit 1123, a high-order partial product acquisition unit 1124, a high-order selector group unit 1125 and a high-order AND logic unit 1126; the first output end of the regular signed number coding unit 1111 is connected to the first input end of the low-order partial product acquisition unit 1121, the low-order selector group unit 1122, the low-order AND logic unit 1123, the high-order partial product acquisition unit 1124, the high-order selector group unit 1125 and the ... The output end of the selector group unit 1122 is connected to the second input end of the low-order partial product acquisition unit 1121, the output end of the low-order AND logic unit 1123 is connected to the third input end of the low-order partial product acquisition unit 1121, the second output end of the regular signed number encoding unit 1111 is connected to the first input end of the high-order partial product acquisition unit 1124, the output end of the high-order selector group unit 1125 is connected to the second input end of the high-order partial product acquisition unit 1124, and the output end of the high-order AND logic unit 1126 is connected to the third input end of the high-order partial product acquisition unit 1124.

[0085] The regular signed number encoding unit 1111 is used to determine the bit width of the data that can be processed by the multiplier according to the received functional mode selection signal, and perform regular signed number encoding on the received first data to obtain the low-order target code and the high-order target code. The low-order partial product acquisition unit 1121 is used to obtain the low-order partial product after the sign bit is extended according to the received low-order target code and the second data. The low-order selector group unit 1122 is used to select the first value in the low-order partial product after the sign bit is extended. The low-order and logic unit 1123 It is used to perform an AND logic operation according to the received functional mode selection signal to obtain the second value in the low-order partial product after the sign bit is extended. The high-order partial product acquisition unit 1124 is used to obtain the high-order partial product after the sign bit is extended according to the received high-order target code and the second data. The high-order selector group unit 1125 is used to select the third value in the high-order partial product after the sign bit is extended. The high-order AND logic unit 1126 is used to perform an AND logic operation according to the received functional mode selection signal to obtain the fourth value in the high-order partial product after the sign bit is extended.

[0086] Specifically, the regular signed number encoding unit 1111 can receive first data and perform regular signed number encoding on the first data to obtain a low-order target code and a high-order target code; the first data can be a multiplier in a multiplication operation, and the low-order target code and the high-order target code can be collectively referred to as a target code. Optionally, the low-order partial product acquisition unit 1121 can obtain a low-order partial product after sign bit extension based on the received second data and the low-order target code obtained by the regular signed number encoding unit 1111; the high-order partial product acquisition unit 1124 can obtain a high-order partial product after sign bit extension based on the received second data and the high-order target code obtained by the regular signed number encoding unit 1111; the second data can be a multiplicand in a multiplication operation. Optionally, if the data bit width that the multiplier can currently process is N bits, and the data bit width received by the regular signed number encoding unit 1111 in the multiplier is 2N, the regular signed number encoding unit 1111 can automatically divide the received 2N-bit data into high-N-bit data and low-N-bit data, and perform regular signed number encoding processing on the high-N-bit data and the low-N-bit data respectively, and the number of high-bit target codes obtained is equal to N plus 1, and the number of low-bit target codes obtained is equal to N plus 1; at the same time, the bit width of the high-bit target code can be equal to the sign bit width. The number of high-order partial products after expansion; the bit width of the low-order target code can be equal to the number of low-order partial products after the sign bit is expanded; if the data bit width that the multiplier can currently process is 2N, and the data bit width received by the regular signed number encoding unit 1111 in the multiplier is 2N, then the regular signed number encoding unit 1111 can perform regular signed number encoding on the received 2N-bit data to obtain a (2N+2)-bit target code, wherein the target code includes a (N+1)-bit low-order target code and a (N+1)-bit high-order target code.

[0087] Furthermore, the data received by the multiplier may include low-order data and high-order data. If the data is "y7y6y5y4y3y2y1y0", the high-order data may be "y7y6y5y4" and the low-order data may be "y3y2y1y0". That is, if the data bit width is N, the high-order N-bit value in the data may be called high-order data, and the low-order N-bit value may be called low-order data.

[0088] It should be noted that the above-mentioned low-order selector group unit 1122 can select the partial bit value in the low-order partial product after the sign bit is extended according to the received functional mode selection signal, which is the value in the low-order partial product after the sign bit is extended obtained by the N-bit multiplication operation, or the value in the low-order partial product after the sign bit is extended obtained by the 2N-bit multiplication operation; similarly, the high-order selector group unit 1125 can select the partial bit value in the high-order partial product after the sign bit is extended according to the received functional mode selection signal, which is the value in the high-order partial product after the sign bit is extended obtained by the N-bit multiplication operation, or the value in the high-order partial product after the sign bit is extended obtained by the 2N-bit multiplication operation.

[0089] In addition, the above-mentioned low-order AND logic unit 1123 can perform an AND logic operation according to the received functional mode selection signal, and output the logic operation result as a partial bit value in the low-order partial product after the sign bit is extended, which is the value in the low-order partial product after the sign bit is extended by the 2N-bit multiplication operation; the low-order AND logic unit 1123 can also perform an AND logic operation according to the received functional mode selection signal, and use the logic operation result as a partial bit value in the low-order partial product after the sign bit is extended, which is the value in the low-order partial product after the sign bit is extended by the N-bit multiplication operation; similarly, the high-order AND logic unit 1126 can perform an AND logic operation according to the received functional mode selection signal, and output the logic operation result as a partial bit value in the high-order partial product after the sign bit is extended, which is the value in the high-order partial product after the sign bit is extended by the 2N-bit multiplication operation; the high-order AND logic unit 1126 can also perform an AND logic operation according to the received functional mode selection signal, and output the logic operation result as a partial bit value in the high-order partial product after the sign bit is extended, which is the value in the high-order partial product after the sign bit is extended by the 2N-bit multiplication operation. Among them, the low-order selector group unit 1122 and the low-order AND logic unit 1123 output some bit values ​​in the low-order partial product after the sign bit is extended, which correspond to different bit values ​​in the low-order partial product after the sign bit is extended, and the high-order selector group unit 1125 and the high-order AND logic unit 1126 output some bit values ​​in the high-order partial product after the sign bit is extended, which correspond to different bit values ​​in the high-order partial product after the sign bit is extended.

[0090] It can be understood that if the data bit width received by the multiplier can be 2N bits, and N-bit data multiplication operations can be processed currently, then the low-order partial product acquisition unit 1121 in the multiplier can obtain the partial product after sign bit extension corresponding to the low N-bit data according to each bit value in the low-order target code; the above-mentioned low-order selector group unit 1122 can select the first value in the low-order partial product after sign bit extension; the low-order and logic unit 1123 can use the final output result as the second value in the low-order partial product after sign bit extension; then the partial product after sign bit extension, the first value in the low-order partial product after sign bit extension obtained after selection, and the second value in the low-order partial product after sign bit extension obtained by logical operation are combined to obtain the low-order partial product after sign bit extension.

[0091] It can also be understood that the high-order partial product acquisition unit 1124 in the multiplier can obtain the partial product after the sign bit is extended corresponding to the high N-bit data according to each bit value in the high-order target code; the above-mentioned high-order selector group unit 1125 can select the third value in the high-order partial product after the sign bit is extended; the high-order and logic unit 1126 can use the final output logic operation result as the fourth value in the high-order partial product after the sign bit is extended; then the partial product after the sign bit is extended, the third value in the high-order partial product after the sign bit is extended obtained after the selection, and the fourth value in the high-order partial product after the sign bit is extended obtained by the logic operation are combined to obtain the high-order partial product after the sign bit is extended. Optionally, in the process of regular signed number encoding, the bit width of the obtained low-order target code can be equal to the bit width of the obtained high-order target code. Optionally, each of the above-mentioned low-order partial product acquisition units 1121 may include 2N value generation subunits, and each high-order partial product acquisition unit 1124 may also include 2N value generation subunits, and each value generation subunit may obtain a one-bit value in the low-order partial product after the sign bit is extended. In this embodiment, the improved regular signed number encoding circuit 11 may include (N+1) low-order partial product acquisition units 1121 and (N+1) high-order partial product acquisition units 1124. At this time, the bit widths of the high-order target code and the low-order target code obtained by the improved regular signed number encoding circuit 11 may both be equal to (N+1), wherein the bit width of the data received by the multiplier is 2N, and the multiplier can currently process N-bit data. In addition, if the multiplier can currently process 2N bits of data, the bit width of the intermediate code obtained by the improved regular signed number encoding circuit 11 can be equal to (2N+1), and then the intermediate code is processed once to obtain a (2N+2)-bit target code, wherein the high (N+1)-bit value can be the high-order target code, and the low (N+1)-bit value can be the low-order target code.

[0092] The present embodiment provides a multiplier, which improves the regular signed number encoding unit in the regular signed number encoding circuit, performs regular signed number encoding processing on the received data to obtain the low-order target code and the high-order target code, and the low-order partial product acquisition unit and the high-order partial product acquisition unit respectively obtain the low-order partial product after the sign bit is extended and the high-order partial product after the sign bit is extended according to the low-order target code and the high-order target code, and then accumulates the low-order partial product after the sign bit is extended and the high-order partial product after the sign bit is extended by improving the Wallace tree circuit to obtain the target operation result; the above-mentioned multiplier can perform multiplication operations on data of various different bit widths, thereby improving the versatility of the multiplier; in addition, the multiplier can perform regular signed number encoding processing on the received data by improving the regular signed number encoding circuit, and can obtain a smaller number of effective partial products, thereby reducing the complexity of the multiplication operation implemented by the multiplier, improving the operation efficiency of the multiplication operation, and effectively reducing the power consumption of the multiplier.

[0093] In one embodiment, Figure 3 A specific structural diagram of an improved regular signed number encoding circuit 11 is provided, wherein the encoding processing branch 111 in the improved regular signed number encoding circuit 11 includes a regular signed number encoding unit 1111, and the regular signed number encoding unit 1111 includes: a first data input port 1111a, a first mode selection signal input port 1111b, a low-order target encoding output port 1111c, and a high-order target encoding output port 1111d; the first data input port 1111a is used to receive the first data, the first mode selection signal input port 1111b is used to receive the functional mode selection signal, the low-order target encoding output port 1111c is used to output the low-order target encoding obtained after regular signed number encoding processing is performed on the first data, and the high-order target encoding output port 1111d is used to output the high-order target encoding obtained after regular signed number encoding processing is performed on the first data.

[0094] Specifically, during the multiplication operation, the regular signed number encoding unit 1111 can receive the first data through the first data input port 1111a, receive the functional mode selection signal through the first mode selection signal input port 1111b, perform regular signed number encoding processing on the first data to obtain an intermediate code, and determine whether it is necessary to perform complement processing on the intermediate code to obtain a target code according to the received functional mode selection signal, and then output the low-order target code in the target code through the low-order target code output port 1111c, and output the high-order target code in the target code through the high-order target code output port 1111d. It should be noted that the above-mentioned complement processing can be to complement the value 0 at the higher bit of the highest bit value of the intermediate code.

[0095] A multiplier provided in this embodiment can use a regular signed number encoding unit to perform regular signed number encoding processing on received data to reduce the number of effective partial products obtained during the multiplication operation, thereby reducing the complexity of the multiplication operation implemented by the multiplier, improving the operational efficiency of the multiplication operation, and effectively reducing the power consumption of the multiplier.

[0096] As one example, Figure 3 The specific structural diagram of the improved regular signed number encoding circuit 11, wherein the partial product acquisition branch 112 in the improved regular signed number encoding circuit 11 includes a low-order partial product acquisition unit 1121, and the low-order partial product acquisition unit 1121 includes: a low-order target code input port 1121a, a first selection value input port 1121b, a second selection value input port 1121c, a second data input port 1121d and a low-order partial product output port 1121e; the low-order target code input port 1121a is used to receive the low-order target code input port 1121a. The low-order target encoding, the first selection value input port 1121b is used to receive the first value in the low-order partial product after the sign bit is extended and output by the low-order selector group unit 1122 after being selected, the second selection value input port 1121c is used to receive the second value in the low-order partial product after the sign bit is extended and output by the low-order and logic unit 1123, the second data input port 1121d is used to receive the second data, and the low-order partial product output port 1121e is used to output the low-order partial product after the sign bit is extended.

[0097] Specifically, the low-order partial product acquisition unit 1121 in the multiplier can receive the low-order target code output by the regular signed number encoding unit 1111 through the low-order target code input port 1121a, receive the multiplicand in the multiplication operation through the second data input port 1121d, and obtain the sign-bit extended partial product corresponding to the low-order target code according to each bit value in the low-order target code and the multiplicand, and then combine the first value in the sign-bit extended low-order partial product received by the first selection value input port 1121b, the second value in the sign-bit extended low-order partial product received by the second selection value input port 1121c, and the sign-bit extended partial product to obtain the sign-bit extended low-order partial product. Optionally, if the data bit width that the multiplier can currently process is also 2N, the low-order partial product acquisition unit 1121 in the multiplier can include 4N value generation subunits, each of which can obtain a single-bit value in the low-order partial product after the sign bit is extended; wherein, 2N value generation subunits can be connected to 2N low-order AND logic units 1123, N value generation subunits can be connected to N selectors, and the remaining N value generation subunits are not connected to the low-order AND logic unit 1123 and the selector; the remaining N value generation subunits can be corresponding to the value generation subunits between the 1st and Nth values ​​in the low-order partial product after the sign bit is extended, starting from the lowest bit (i.e., the 1st bit) to the highest bit. Among them, the number of value generation subunits can be equal to twice the data bit width that the multiplier can currently process. The position distribution of the 4N value generation subunits in each low-order partial product acquisition unit 1121 can be described as follows: the same-bit value generation subunits in each low-order partial product acquisition unit 1121 are all located in the same column.

[0098] Exemplarily, if the multiplier can process 2N-bit data operations, and the low-order partial product acquisition unit 1121 receives a multiplicand X with a width of 2N bits, the low-order partial product acquisition unit 1121 can directly obtain the corresponding 4N-bit sign-bit extended low-order partial product according to the multiplicand X and the three values ​​-1, 1 and 0 contained in the high-order target code; the low 2N-bit values ​​in the low-order partial product after the sign bit extension can be equal to all the values ​​in the original low-order partial product directly obtained from the low-order target code; the high 2N-bit values ​​in the low-order partial product after the sign bit extension can be equal to the sign bit value in the original low-order partial product; the sign bit value is also the highest bit value of the original low-order partial product. When the value in the low-order target code is -1, the original low-order partial product can be -X; when the value in the low-order target code is 1, the original low-order partial product can be X; when the value in the low-order target code is 0, the original low-order partial product can be 0, that is, each bit value in the original low-order partial product is equal to 0.

[0099] Furthermore, the distribution of all sign-bit extended low-order partial products obtained by the low-order partial product acquisition unit 1121 can be characterized as follows: the lowest bit value in the low-order partial product after the first sign bit extension and the lowest bit values ​​in the low-order partial products after other sign bit extensions are all located in the same column; the other bit values ​​in the low-order partial product after the first sign bit extension and the corresponding bit values ​​in the low-order partial products after other sign bit extensions are all located in the same column.

[0100] Optional, continue to see Figure 3 As shown, Figure 3 The partial product acquisition branch 112 in the improved regular signed number encoding circuit 11 includes a high-order partial product acquisition unit 1124, and the high-order partial product acquisition unit 1124 includes: a high-order target code input port 1124a, a third selection value input port 1124b, a fourth selection value input port 1124c, a second data input port 1124d and a high-order partial product output port 1124e; the high-order partial product acquisition unit 1124 is used to receive the high-order target code, the third selection value input port 1124b is used to receive the third value in the high-order partial product after the sign bit is extended and output after the high-order selector group unit 1125 is selected, the fourth selection value input port 1124c is used to receive the fourth value in the high-order partial product after the sign bit is extended and output by the high-order and logic unit 1126, the second data input port 1124d is used to receive the second data, and the high-order partial product output port 1124e is used to output the high-order partial product after the sign bit is extended.

[0101] It should be noted that the high-order partial product acquisition unit 1124 in the multiplier can receive the high-order target code output by the regular signed number encoding unit 1111 through the high-order target code input port 1124a, receive the multiplicand in the multiplication operation through the second data input port 1124d, and obtain the sign-bit extended partial product corresponding to the high-order target code according to each bit value in the high-order target code and the multiplicand, and then combine the first value in the sign-bit extended high-order partial product received by the third selection value input port 1124b, the second value in the sign-bit extended high-order partial product received by the fourth selection value input port 1124c, and the sign-bit extended partial product to obtain the sign-bit extended high-order partial product.

[0102] In addition, if the data bit width that the multiplier can currently process is also 2N, the high-order partial product acquisition unit 1124 in the multiplier can include 4N value generation subunits, each of which can correspond to a single-bit value in the high-order partial product after the sign bit is extended, wherein 2N value generation subunits can be connected to 2N high-order AND logic units 1126, N value generation subunits can be connected to N selectors, and the remaining N value generation subunits are not connected to the high-order AND logic unit 1126 and the selector; the remaining N value generation subunits can be corresponding to the value generation subunits between the (2N+1)th and 3Nth values ​​in the high-order partial product after the sign bit is extended, starting from the lowest bit (i.e., the first bit) to the highest bit. The number of value generation subunits can be equal to twice the data bit width that the multiplier can currently process. The position distribution of the 4N value generation subunits in each high-order partial product acquisition unit 1124 can be described as follows: the same-bit value generation subunits in each high-order partial product acquisition unit 1124 are all located in the same column.

[0103] Furthermore, the distribution of all sign-bit extended high-order partial products obtained by the high-order partial product acquisition unit 1124 can be characterized as follows: the lowest bit value in the high-order partial product after the first sign bit extension and the lowest bit values ​​in the high-order partial products after other sign bit extensions are all located in the same column; the other bit values ​​in the high-order partial product after the first sign bit extension and the corresponding bit values ​​in the high-order partial products after other sign bit extensions are all located in the same column.

[0104] A multiplier provided in this embodiment can obtain a low-order partial product after sign bit extension according to each bit value in the low-order target code and second data through a low-order partial product acquisition unit, and obtain a high-order partial product after sign bit extension according to a high-order partial product acquisition unit, and then the multiplier accumulates the low-order partial product after sign bit extension and the high-order partial product after sign bit extension to obtain a target operation result. The number of effective partial products that can be obtained by the multiplier is small, thereby reducing the complexity of the multiplication operation implemented by the multiplier, improving the operation efficiency of the multiplication operation, and effectively reducing the power consumption of the multiplier; at the same time, the above-mentioned multiplier can perform multiplication operations on data of multiple different bit widths, thereby improving the versatility of the multiplier.

[0105] In one embodiment, see Figure 3 As shown, Figure 3 The partial product acquisition branch 112 in the improved regular signed number encoding circuit 11 includes a low-bit selector group unit 1122, and the low-bit selector group unit 1122 includes: a low-bit selector 1122a, and a plurality of the low-bit selectors 1122a are used to select the first value in the low-bit partial product after the sign bit is extended.

[0106] Specifically, the number of the lower-order selectors 1122a in the lower-order selector group unit 1122 may be equal to N. 2 / 2, 2N can represent the bit width of the data that the multiplier can currently process, and the internal circuit structure of each low-order selector 1122a in the low-order selector group unit 1122 can be the same. Optionally, during the multiplication operation, each low-order partial product acquisition unit 1121 of the corresponding (N+1) low-order partial product acquisition units 1121 connected to the regular signed number encoding unit 1111 can include 4N value generation subunits, wherein N value generation subunits can be connected to N low-order selectors 1122a, and each of the N value generation subunits can be connected to one low-order selector 1122a. Optionally, the N value generation subunits corresponding to the N low-order selectors 1122a can be corresponding bit value generation subunits for the values ​​between the (N+1)th bit and the 2Nth bit, starting from the lowest bit (i.e., the 1st bit) to the highest bit in the low-order partial product after the sign bit is extended; at the same time, the external input ports of the N low-order selectors 1122a have two other input ports in addition to the mode selection signal input port (mode signal input port). Optionally, if the multiplier can process data operations with n different bit widths, and the bit width of the data received by the multiplier is 2N, then the signals received by the other two input ports of the above-mentioned low-order selector 1122a can be respectively the sign bit value in the partial product after the sign bit is extended obtained by the multiplier performing a 2N-bit data operation, and the corresponding bit value in the partial product after the sign bit is extended obtained by the multiplier performing a 2N-bit data operation. Optionally, if the multiplier performs a 2N-bit data operation, the low-order selector 1122a selects the corresponding bit value in the partial product after the sign bit is extended, that is, the first value; if the multiplier performs an N-bit data operation, the low-order selector 1122a selects the sign bit value in the partial product after the sign bit is extended, that is, the first value. Figure 3 Only one lower selector 1122a is shown.

[0107] Optional, continue to see Figure 3 As shown, Figure 3 The partial product acquisition branch 112 in the improved regular signed number encoding circuit 11 includes a high-order selector group unit 1125, and the high-order selector group unit 1125 includes: a high-order selector 1125a, and a plurality of the high-order selectors 1125a are used to select the third value in the high-order partial product after the sign bit is extended.

[0108] It should be noted that the number of the upper selectors 1125a in the upper selector group unit 1125 may be equal to N. 2 / 2, 2N can represent the bit width of the data that the multiplier can currently process, and the internal circuit structure of each high-order selector 1125a in the high-order selector group unit 1125 can be the same. Optionally, during the multiplication operation, each high-order partial product acquisition unit 1124 of the corresponding N / 2 high-order partial product acquisition units 1124 connected to the regular signed number encoding unit 1111 can include 4N value generation subunits, wherein N value generation subunits can be connected to N high-order selectors 1125a, and each of the N value generation subunits can be connected to one high-order selector 1125a. Optionally, the N value generation subunits corresponding to the N high-order selectors 1125a can be the value generation subunits corresponding to the values ​​between the (3N+1)th and 4Nth bits, starting from the highest bit (i.e., the 1st bit) to the lowest bit in the high-order partial product after the sign bit is extended; at the same time, the external input ports of the N high-order selectors 1125a have two other input ports in addition to the mode selection signal input port (mode signal input port). Optionally, if the multiplier can process data operations with n different bit widths, and the bit width of the data received by the multiplier is 2N, then the signals received by the other two input ports of the above high-order selector 1125a can be respectively the sign bit value in the partial product after the sign bit is extended obtained by the multiplier performing N-bit data operations, and the sign bit value in the partial product after the sign bit is extended obtained by the multiplier performing 2N-bit data operations. Optionally, if the multiplier performs data operations with different bit widths, the third value selected by the high-bit selector 1125a can be the sign bit value in the partial product after the sign bit is extended when the corresponding bit data is operated. Figure 3 Only one upper selector 1125a is shown.

[0109] A multiplier provided in this embodiment can select some bit values ​​in the low-order partial product after sign bit extension through a low-order selector group unit to obtain the low-order partial product after sign bit extension, and perform addition operation on the low-order partial product after sign bit extension through an improved Wallace tree circuit to obtain a target operation result; the above-mentioned multiplier can perform multiplication operation on data of multiple different bit widths, thereby improving the versatility of the multiplier.

[0110] As one example, see Figure 3 As shown, Figure 3The partial product acquisition branch 112 in the improved regular signed number encoding circuit 11 includes a low-order AND logic unit 1123, and the low-order AND logic unit 1123 includes: a first mode selection signal input port 1123a, a first sign bit value input port 1123b and a first result output port 1123c; wherein, the first mode selection signal input port 1123a is used to receive the functional mode selection signal, the first sign bit value input port 1123b is used to receive the first sign bit value in the low-order partial product after the sign bit is extended, and the first result output port 1123c is used to output the logic operation result.

[0111] Specifically, if the data received by the multiplier is 2N bits, and the functional mode selection signal received by the first mode selection signal input port 1123a in the multiplier is a value of 0, then the multiplier can perform multiplication on the N-bit data, and the low-order AND logic unit 1123 can perform an AND logic operation on the functional mode selection signal and the first sign bit value received by the first sign bit value input port 1123b, and output the logic operation result through the first result output port 1123c; if the functional mode selection signal received by the first mode selection signal input port 1123a in the multiplier is a value of 1, then the multiplier can perform multiplication on the 2N-bit data, and the low-order AND logic unit 1123 can perform an AND logic operation on the functional mode selection signal and the first sign bit value received by the first sign bit value input port 1123b, and output the logic operation result through the first result output port 1123c; wherein, the first sign bit value can be equal to the sign bit value in the partial product after the sign bit is expanded when the multiplier performs a multiplication on the 2N-bit data. In addition, if the data bit width that the multiplier can currently process is also 2N, then among the 4N value generation subunits contained in the low-order partial product acquisition unit 1121 in the multiplier, the N value generation subunits connected to the N low bits and the logic unit 1123 can be the corresponding value generation subunits from the lowest bit (i.e., the 1st bit) to the highest bit in the low-order partial product after the sign bit extension, starting from the lowest bit (i.e., the 1st bit) to the highest bit, corresponding to the (2N+1)th bit to the 4Nth bit value.

[0112] Optional, continue to see Figure 3 As shown, Figure 3The partial product acquisition branch 112 in the improved regular signed number encoding circuit 11 includes a high-order AND logic unit 1126, and the high-order AND logic unit 1126 includes: a second mode selection signal input port 1126a, a second sign bit value input port 1126b and a second result output port 1126c; wherein, the second mode selection signal input port 1126a is used to receive the functional mode selection signal, the second sign bit value input port 1126b is used to receive the second sign bit value in the high-order partial product after the sign bit is extended, and the second result output port 1126c is used to output the logic operation result.

[0113] It should be noted that, if the data received by the multiplier is 2N bits, and the functional mode selection signal received by the second mode selection signal input port 1126a in the multiplier is a value of 0, then the multiplier can perform multiplication on the N-bit data, and the high-order AND logic unit 1126 can perform an AND logic operation on the functional mode selection signal and the second sign bit value received by the second sign bit value input port 1126b, and output the logic operation result through the second result output port 1126c; if the functional mode selection signal received by the second mode selection signal input port 1126a in the multiplier is a value of 1, then the multiplier can perform multiplication on the 2N-bit data, and the high-order AND logic unit 1126 can perform an AND logic operation on the functional mode selection signal and the second sign bit value received by the second sign bit value input port 1126b, and output the logic operation result through the second result output port 1126c; wherein, the second sign bit value can be equal to the sign bit value in the high-order partial product after the sign bit extension obtained in the process of the multiplier performing multiplication on the 2N-bit data. In addition, if the data bit width that the multiplier can currently process is also 2N, then among the 4N value generation subunits contained in the high-order partial product acquisition unit 1124 in the multiplier, the N value generation subunits connected to the 2N high bits and the logic unit 1126 can be the corresponding value generation subunits from the lowest bit (i.e., the 1st bit) to the highest bit in the high-order partial product after the sign bit is extended, starting from the lowest bit (i.e., the 1st bit) to the highest bit, corresponding to the bit value generation subunits between the 1st bit and the 2Nth bit value.

[0114] A multiplier provided in this embodiment can obtain partial bit values ​​in the low-bit partial product after sign bit extension through processing by a low-bit AND logic unit, thereby obtaining the low-bit partial product after sign bit extension, and perform addition operation on the low-bit partial product after sign bit extension through an improved Wallace tree circuit to obtain a target operation result; the above-mentioned multiplier can perform multiplication operation on data of various different bit widths, thereby improving the versatility of the multiplier.

[0115] As one example, see Figure 2The multiplier includes an improved Wallace tree circuit 12, which includes: a low-order Wallace tree unit 121, an AND logic unit 122 and a high-order Wallace tree unit 123, wherein the output end of the low-order Wallace tree unit 121 is connected to the input end of the AND logic unit 122, and the output end of the AND logic unit 122 is connected to the input end of the high-order Wallace tree unit 123; wherein the plurality of the low-order Wallace tree units 121 are used to perform accumulation processing on each column of values ​​in the partial products after all sign bits are extended, the AND logic unit 122 is used to perform an AND logic operation on the received function mode selection signal and the carry output signal output by the low-order Wallace tree unit 121 to obtain the carry input signal received by the high-order Wallace tree unit 123, and the plurality of the high-order Wallace tree units 123 are used to perform accumulation processing on each column of values ​​in the partial products after all sign bits are extended.

[0116] Optionally, the low-order Wallace tree unit 121 and the high-order Wallace tree unit 123 both include the 4-2 compressor and a mode selection circuit, and the output end of the mode selection circuit is connected to the input end of the 4-2 compressor; wherein the mode selection circuit includes a first input end for receiving the functional mode selection signal; the 4-2 compressor is used to accumulate the values ​​of each column in all the partial products after sign bit expansion, and the mode selection circuit is used to select the values ​​in the partial products after sign bit expansion received by the 4-2 compressor.

[0117] Specifically, the improved Wallace tree circuit 12 can be understood as a circuit that can process multi-bit input signals and add the multi-bit input signals to obtain a two-bit output signal. Optionally, the number of columns of the partial products after all sign bits are extended can be equal to twice the data bit width that the multiplier can currently process, and the values ​​in the partial products after all sign bits are extended are involved in the accumulation operation. Exemplarily, if the two data bit widths received by the multiplier are both 8 bits, and the current multiplication operation that can process 8-bit data is 8 bits wide, then the current multiplier can process two groups of 4-bit * 4-bit data multiplication operations, and the distribution of the low-order partial products after the 5 sign bits are extended and the high-order partial products after the 5 sign bits are extended obtained by the multiplier through the regular signed number encoding unit 1111 is as follows: Figure 4 As shown, the upper right corner is a distribution diagram of the low-order partial product after 5 sign bits are extended, the lower left corner is a distribution diagram of the high-order partial product after 5 sign bits are extended, and "○" represents a partial bit value in the low-order partial product after the sign bit is extended. represents the partial bit value in the high-order partial product after the sign bit is extended, "●" represents the sign bit value of the low-order partial product after the sign bit is extended or the high-order partial product after the sign bit is extended; if the multiplier can currently process 8-bit*8-bit data multiplication and accumulation operations, the distribution of the 5 low-order partial products after the sign bit is extended and the 5 high-order partial products after the sign bit is extended obtained by the regular signed number encoding unit 1111 of the multiplier is as follows Figure 5 As shown, where "○" represents the partial bit value in the low-order partial product after the sign bit is extended, Indicates the partial bit value in the high-order partial product after the sign bit is extended, and "●" indicates the sign bit value of the low-order partial product after the sign bit is extended or the high-order partial product after the sign bit is extended.

[0118] It should be noted that the number of low-order Wallace tree units 121 in the improved Wallace tree circuit 12 can be equal to the data bit width N currently received by the multiplier, and can also be equal to the number of high-order Wallace tree units 123, and the low-order Wallace tree units 121 can be connected in series, and the high-order Wallace tree units 123 can also be connected in series. Optionally, the output end of the last low-order Wallace tree unit 121 is connected to the input end of the logic unit 122, and the output end of the logic unit 122 is connected to the input end of the first high-order Wallace tree unit 123. Optionally, each low-order Wallace tree unit 121 in the improved Wallace tree circuit 12 can perform addition processing on each column of all partial products after the sign bit is extended, and each low-order Wallace tree unit 121 can output two signals, namely, a carry signal Carry. i and a sum signal Sum i , where i can represent the number corresponding to each low-order Wallace tree unit 121, and the number of the first low-order Wallace tree unit 121 is 0. Optionally, the number of input signals received by each low-order Wallace tree unit 121 can be equal to the target coding number or the number of partial products after the sign bit is extended. Wherein, the sum of the number of high-order Wallace tree units 123 and the number of low-order Wallace tree units 121 in the improved Wallace tree circuit 12 can be equal to 2N, and the total number of columns from the lowest column to the highest column in all partial products after the sign bit is extended can be equal to 2N, and the N low-order Wallace tree units 121 can perform accumulation operations on each column in the low N columns of all partial products after the sign bit is extended, and the N high-order Wallace tree units 123 can perform accumulation operations on each column in the high N columns of all partial products after the sign bit is extended.

[0119] Exemplarily, if the data bit width received by the multiplier is 2N bits, and no matter whether the current multiplier performs N-bit or 2N-bit data multiplication operation, the total number of low-order Wallace tree units 121 and high-order Wallace tree units 123 included in the multiplier can be equal to twice the data bit width received by the multiplier, and the number of low-order Wallace tree units 121 and high-order Wallace tree units 123 each accounts for half, then the AND logic unit 122 can output the carry output signal Cout for the last low-order Wallace tree unit 121 in the improved Wallace tree circuit 12. N The AND logic operation is performed on the function mode selection signal, and the logic operation result is used as the carry input signal Cin received by the first high-order Wallace tree unit 123 in the improved Wallace tree circuit 12. N+1 Optionally, the multiplier can currently divide the received 2N-bit data into high-N-bit and low-N-bit data for respective multiplication operations, wherein the corresponding numbers i from the first low-order Wallace tree unit 121 to the last low-order Wallace tree unit 121 are 1, 2, ..., N, respectively, and the corresponding numbers i from the first high-order Wallace tree unit 123 to the last high-order Wallace tree unit 123 are N+1, N+2, ..., 2N, respectively.

[0120] It can be understood that, in each of the lower-order Wallace tree units 121 and the upper-order Wallace tree unit 123 in the improved Wallace tree circuit 12, the received signal may include the carry input signal Cin i , partial product value input signal, carry output signal Cout i Optionally, the partial product value input signal received by each low-order Wallace tree unit 121 and the high-order Wallace tree unit 123 may be the value of the corresponding column in the partial product after all sign bits are extended, and the carry signal Cout output by each low-order Wallace tree unit 121 and the high-order Wallace tree unit 123 may be i The number of digits can be equal to N Cout =floor((N I +N Cin ) / 2)-1. Among them, N I The number of data input bits that can represent this Wallace tree unit, N Cin It can represent the number of carry input bits of the Wallace tree unit, N CoutIt can represent the minimum number of carry output bits of the Wallace tree unit, and floor(·) can represent a floor function. Optionally, the carry input signal received by each low-order Wallace tree unit 121 or high-order Wallace tree unit 123 in the improved Wallace tree circuit 12 can be the carry output signal output by the previous low-order Wallace tree unit 121 or high-order Wallace tree unit 123, and the carry input signal received by the first low-order Wallace tree unit 121 is 0. The carry input signal received by the first high-order Wallace tree unit 123 can be determined by the bit width of the data currently processable by the multiplier and the bit width of the data received by the multiplier.

[0121] A multiplier provided in this embodiment can accumulate partial products after sign bit extension by improving the Wallace tree circuit to obtain two output signals, and accumulate the two output signals again by improving the accumulation circuit to obtain a multiplication result. The multiplier can perform multiplication operations on data of various different bit widths, thereby improving the versatility of the multiplier and effectively reducing the area occupied by the multiplier on the AI ​​chip; in addition, the multiplier can effectively reduce the power consumption of the multiplier by accumulating partial products after sign bit extension by improving the Wallace tree group circuit.

[0122] Continue to see Figure 2 A specific structural diagram of a multiplier provided for another embodiment, the multiplier includes the improved accumulation circuit 13, the improved accumulation circuit 13 includes: a low-bit adder 131, an AND logic unit 132 and a high-bit adder 133, the low-bit adder 131 is used to perform accumulation processing on the low-bit accumulation operation result, the AND logic unit 132 is used to perform an AND logic operation on the received functional mode selection signal and the output signal of the low-bit adder 131 to obtain a carry input signal of the high-bit adder 133, and the high-bit adder 133 is used to perform an accumulation operation based on the carry input signal and the high-bit accumulation operation result.

[0123] Specifically, the low-order adder 131 and the high-order adder 133 can both be carry-lookahead adders of different bit widths, and the data bit width that can be processed by the carry-lookahead adder can be equal to twice the data bit width received by the multiplier. Optionally, the low-order adder 131 and the high-order adder 133 can receive two signals output by the improved Wallace tree circuit 12, perform addition operations on the two output signals, and obtain the target operation result of the multiplication operation. Optionally, the above-mentioned AND logic unit 132 can include two receiving ports, one port receives a function mode selection signal, and the other port receives a carry output signal output by the low-order adder 131.

[0124] It should be noted that if the data bit width received by the multiplier is 2N and the currently processable data bit width is 2N, the multiplier can perform a multiplication operation on the 2N-bit data as a whole; if the currently processable data bit width of the multiplier is N, the multiplier can split the 2N-bit data into two groups of data for two synchronous multiplication operations.

[0125] Furthermore, during the multiplication operation, the multiplier can use a low-bit adder 131 and a high-bit adder 133 with different bit widths to perform an addition operation on the carry output signal Carry and the sum output signal Sum output by the improved Wallace tree circuit 12, wherein the bit width of the processable data of the low-bit adder 131 and the high-bit adder 133 can be equal to twice the bit width of the data received by the multiplier. Optionally, each low-bit Wallace tree unit 121 and high-bit Wallace tree unit 123 in the improved Wallace tree circuit 12 can output a carry output signal Carry. i , and a sum output signal Sum i (i=1, ..., 2N, i is the corresponding number of each low-order or high-order improved Wallace tree unit, and the numbering starts from 1). Optionally, the Carry received by the low-order adder 131 and the high-order adder 133 are respectively {[Carry1: Carry N-1 ],0} and {Carry N :Carry 2N-1}; That is, Carry1 to Carry N-1 Corresponding to the carry output signals of the first N-1 low-order Wallace tree units in the improved Wallace tree circuit 12, the lowest bit value in the carry output signal Carry can be replaced by the value 0; N To Carry 2N-1 The corresponding improved Wallace tree circuit 12 has the carry output signals of the last N low-order Wallace tree units.

[0126] For example, if the multiplier currently processes an 8-bit*8-bit fixed-point multiplication operation, the low-order adder 131 and the high-order adder 133 may be 16-bit carry-lookahead adders, such as Figure 6 As shown, Figure 6 In the figure, Wallace_i represents a low-order or high-order Wallace tree unit, i is the number of the low-order and high-order Wallace tree units starting from 0, and the solid line connecting two Wallace tree units indicates that the Wallace tree unit corresponding to the high-order number has a carry output signal, and the dotted line indicates that the Wallace tree unit corresponding to the high-order number has no carry output signal.

[0127] A multiplier provided in this embodiment can perform accumulation operations on two signals output by an improved Wallace tree circuit by means of an improved accumulation circuit to obtain a target operation result. The multiplier can perform multiplication operations on data of various bit widths, thereby improving the versatility of the multiplier and effectively reducing the area occupied by the multiplier on the AI ​​chip. In addition, the multiplier can also effectively reduce the power consumption of the multiplier by performing accumulation operations on partial products after sign bit expansion by means of an improved Wallace tree group circuit.

[0128] Figure 7 A flowchart of a data processing method provided by an embodiment, the method can be Figure 1 and Figure 2 The multiplier shown in FIG. 1 is used for processing. This embodiment relates to the process of performing multiplication operations on data of different bit widths. Figure 7 As shown, the method includes:

[0129] S101. Receive data to be processed and a function mode selection signal, wherein the function mode selection signal is used to indicate a bit width of currently processable data.

[0130] Specifically, the multiplier can receive the data to be processed through the improved regular signed number encoding circuit, and the data to be processed can be the multiplier and the multiplicand in the multiplication operation. During each multiplication operation, the multiplier can also receive different function mode selection signals through the improved regular signed number encoding circuit, the improved Wallace tree circuit, and the improved accumulation circuit; however, during the same operation, the function mode selection signals received by the improved regular signed number encoding circuit, the improved Wallace tree circuit, and the improved accumulation circuit can be the same. If the multiplier receives different function mode selection signals, the multiplier can process data operations with different bit widths.

[0131] It should be noted that if the bit width of the to-be-processed multiplier and the to-be-processed multiplicand received by the improved regular signed number encoding circuit is not equal to the data bit width that can be processed corresponding to the function mode selection signal received by the multiplier, then the multiplier can divide the received data to be processed into multiple groups of data equal to the data bit width that can be processed by the multiplier according to the data bit width that can be processed by the multiplier at present for parallel processing; wherein, the bit width of the to-be-processed data received by the improved regular signed number encoding circuit can be greater than the data bit width that can be processed by the multiplier at present. Optionally, the above parallel processing can be characterized as synchronously processing each group of to-be-processed data after division. If the bit width of the to-be-processed data received by the improved regular signed number encoding circuit is equal to the data bit width that can be processed corresponding to the function mode selection signal received by the multiplier, then the multiplier directly processes the received data to be processed. Optionally, the above data to be processed can include high-order data to be processed and low-order data to be processed. If the bit width of the data to be processed is 2N, the upper N bits of data may be referred to as the high-bit data to be processed, and the lower N bits of data may be referred to as the high-bit data to be processed.

[0132] Optionally, the bit widths of the to-be-processed multiplier and the to-be-processed multiplicand received by the improved regular signed number encoding circuit may be 4 bits, 8 bits, 16 bits, 32 bits, or 64 bits, which are not limited in this embodiment. The bit width of the to-be-processed multiplier may be equal to the bit width of the to-be-processed multiplicand.

[0133] Exemplarily, if the functional mode selection signals received by the improved regular signed number encoding circuit, the improved Wallace tree circuit, and the improved accumulation circuit can be equal to 0 and 1; however, in this embodiment, the mode signal of 0 can represent that the multiplier can currently process 4-bit data operations, and the mode signal of 1 can represent that the multiplier can currently process 8-bit data operations.

[0134] S102: judging whether the data to be processed needs to be split according to the function mode selection signal.

[0135] Specifically, the multiplier can determine the data bit width that can be processed by the current multiplier according to the received function mode selection signal to determine whether the data to be processed needs to be split. The splitting process can be characterized as dividing the data to be processed into multiple groups of data with the same bit width.

[0136] Optionally, the step of determining whether the data to be processed needs to be split according to the functional mode selection signal in the above S102 may include: determining whether the bit width of the data to be processed is equal to the data bit width that can be processed by the multiplier according to the functional mode selection signal.

[0137] It should be noted that the above-mentioned determination of whether the data to be processed needs to be split according to the functional mode selection signal can actually be understood as determining whether the bit width of the data to be processed is equal to the data bit width that can be processed by the multiplier according to the functional mode selection signal; if they are equal, the data to be processed does not need to be split, otherwise, the data to be processed needs to be split.

[0138] S103: If the data to be processed needs to be split, split the data to be processed to obtain split data.

[0139] Optionally, after the step S102 of determining whether the data to be processed needs to be split according to the functional mode selection signal, the method further includes: if the data to be processed does not need to be split, continuing to perform regular signed number encoding processing on the data to be processed to obtain the target code.

[0140] Specifically, if the bit widths of the multiplier and the multiplicand in the multiplication operation received by the improved regular signed number encoding circuit in the multiplier are not equal to the bit width of the data that can be processed corresponding to the function mode selection signal received by the multiplier, then the multiplier can automatically divide the received data to be processed into multiple groups of data equal to the bit width of the data that can be processed by the multiplier according to the bit width of the data that can be processed currently by the multiplier for parallel processing; wherein the bit width of the data to be processed received by the improved regular signed number encoding circuit can be greater than the bit width of the data that can be processed currently by the multiplier. Optionally, the above parallel processing can be characterized as processing each group of divided data to be processed at the same time. If the bit width of the data to be processed received by the improved regular signed number encoding circuit is equal to the bit width of the data that can be processed corresponding to the function mode selection signal received by the multiplier, then the multiplier directly performs subsequent processing on the complete data to be processed, and there is no need to split the data to be processed before subsequent processing.

[0141] It should be noted that if the bit width of the data to be processed received by the multiplier is 2N, and the bit width of the currently processable data is 2N, the regular signed number encoding unit in the multiplier can perform regular signed number encoding processing on the complete 2N-bit data to obtain the corresponding target code. The above-mentioned regular signed number encoding processing can be characterized as a data processing process encoded by the values ​​0, -1 and 1.

[0142] At the same time, if the complete 2N-bit data is directly processed by regular signed number encoding, the high N-bit data can be called high-order data, and the low N-bit data can be called low-order data; in this embodiment, the split data can include the high-order data and the low-order data in the data to be processed.

[0143] S104, performing regular signed number encoding processing on the split data to obtain a target code.

[0144] Optionally, the step of performing regular signed number encoding processing on the split data in the above S104 to obtain a target code may include: converting consecutive l-bit values ​​1 in the split data into (l+1) highest bit value 1, lowest bit value -1, and the remaining bits as values ​​0, to obtain the target code, where l is greater than or equal to 2.

[0145] Specifically, if the bit width of the data to be processed received by the multiplier is 2N, and the bit width of the data that the multiplier can currently process is N, the regular signed number encoding unit in the multiplier can automatically split the 2N-bit data into high-N-bit data and low-N-bit data, and then perform regular signed number encoding processing on the high-N-bit data and the low-N-bit data respectively to obtain the corresponding high-order target code and low-order target code. Optionally, the above-mentioned data to be processed can include high-N-bit data to be processed and low-N-bit data to be processed after splitting. Among them, if the bit width of the data to be processed is 2N, the high N bits can be called the high-order data to be processed, and the low N bits can be called the high-order data to be processed.

[0146] S105. Obtain the partial product after the sign bit is extended according to the functional mode selection signal, the target code and the split data.

[0147] Specifically, if the bit width of the data received by the multiplier is 2N, and the multiplier can currently process data with a width of N bits, the partial product after the sign bit extension may include the corresponding high-order partial product after the sign bit extension obtained by the high N-bit data, and the corresponding low-order partial product after the sign bit extension obtained by the low N-bit data. Optionally, the partial product acquisition branch in the multiplier can obtain the partial product after the sign bit extension corresponding to the functional mode selection signal currently received by the multiplier according to the split multiplicand and the target code; then the multiplier determines the value of the low-order partial product after the sign bit extension and the value of the high-order partial product after the sign bit extension according to the data bit width that can be processed currently corresponding to the functional mode selection signal.

[0148] S106, performing accumulation processing on the partial products after the sign bit extension to obtain a target operation result.

[0149] Specifically, the multiplier can accumulate the partial products after the sign bit is extended by improving the Wallace tree circuit and improving the accumulation circuit to obtain the target operation result.

[0150] The present embodiment provides a data processing method, in which a multiplier can receive data to be processed and a function mode selection signal, and judge whether the data to be processed needs to be split according to the function mode selection signal. If the data to be processed needs to be split, the data to be processed is split to obtain the split data, and the split data is coded with a regular signed number to obtain a target code, and partial products after sign bit extension are obtained according to the function mode selection signal, the target code and the split data, and the partial products after sign bit extension are accumulated to obtain a target operation result. The method can perform multiplication operations on data of various different bit widths according to the function mode selection signal received by the multiplier, thereby improving the versatility of the multiplier and effectively reducing the area of ​​the AI ​​chip occupied by the multiplier. In addition, the method can accumulate the partial products after sign bit extension by improving the Wallace tree group circuit to obtain the target operation result, thereby effectively reducing the power consumption of the multiplier.

[0151] Figure 8 A specific flow chart of obtaining a target code is provided in an embodiment, as shown in FIG. Figure 8 As shown, the step of performing regular signed number encoding processing on the split data in S104 to obtain the target code may specifically include:

[0152] S1041. Perform regular signed number encoding processing on the split data to obtain an intermediate code.

[0153] Specifically, the split data after the regular signed number encoding process can be a multiplier in a multiplication operation.

[0154] S1042. Obtain the target code according to the intermediate code and the functional mode selection signal.

[0155] Specifically, the above-mentioned regular signed number encoding processing method can be characterized in the following manner: for an N-bit multiplier, processing is performed from the lower-order value to the higher-order value. If there are consecutive l (l>=2)-bit values ​​1, the consecutive n-bit values ​​1 can be converted into data "1 (0) l-1(-1)", and the remaining corresponding (Nl)-bit values ​​are combined with the converted (l+1)-bit value to obtain a new data; then the new data is used as the initial data for the next level of conversion processing until there are no continuous l (l>=2)-bit values ​​of 1 in the new data obtained after the conversion processing; wherein, the N-bit multiplier is subjected to regular signed number encoding processing, and the bit width of the obtained target code can be equal to (N+1). Further, during the regular signed number encoding processing, data 11 can be converted to (100-001), that is, data 11 can be equivalently converted to 10(-1); data 111 can be converted to (1000-0001), that is, data 111 can be equivalently converted to 100(-1); and so on, the conversion processing method of other continuous l (l>=2)-bit values ​​of 1 is similar.

[0156] For example, the multiplier received by the regular signed number encoding unit in the multiplier is "001010101101110", and the first new data obtained after the first level conversion processing of the multiplier is "0010101011100(-1)0", and the second new data obtained after the second level conversion processing of the first new data is "0010101100(-1)00(-1)0", and the third new data obtained after the third level conversion processing of the second new data is "0010110(-1)00(-1)00(-1)0", and the fourth level conversion processing of the third new data is performed on the third new data. The fourth new data obtained after the first-level conversion processing is "00110(-1)0(-1)00(-1)00(-1)00(-1)0", and the fifth new data obtained after continuing to perform the fifth-level conversion processing on the fourth new data is "010(-1)0(-1)0(-1)00(-1)00(-1)00(-1)0". There are no consecutive l (l>=2)-bit values ​​1 in the fifth new data. At this time, the fifth new data can be called the initial code, and after a bit-filling processing is performed on the initial code, the intermediate code representing the completion of the regular signed number encoding processing is obtained, wherein the bit width of the initial code can be equal to the bit width of the multiplier. Optionally, after the regular signed number encoding unit performs regular signed number encoding on the multiplier, the new data (i.e., the initial code) obtained, if the highest bit value and the second highest bit value in the new data are "10" or "01", the regular signed number encoding unit can fill the highest bit value of the new data with a single bit value of 0, and obtain the corresponding intermediate code The high three bits are "010" or "001" respectively. Optionally, the bit width of the above intermediate code can be equal to the bit width of the data that the multiplier can currently process plus 1.

[0157] In addition, if the data bit width received by the multiplier is 2N, and it can currently process N-bit data operations, the regular signed number encoding unit in the multiplier can split the 2N-bit data into two groups of N-bit data for separate data operations; at this time, the two groups of (N+1)-bit intermediate codes obtained are combined and can be used as target codes; if the multiplier can currently process 2N-bit data operations, the regular signed number encoding unit in the multiplier can complement the highest bit value of the obtained (2N+1)-bit intermediate code with a single-bit value of 0 (i.e., complement processing) and use the (2N+2)-bit data after complement processing as the target code.

[0158] A data processing method provided in this embodiment performs regular signed number encoding processing on the split data to obtain an intermediate code, and obtains a target code according to the intermediate code and a function mode selection signal; the method can perform multiplication operations on data of various different bit widths, thereby improving the versatility of the multiplier and effectively reducing the area occupied by the multiplier on the AI ​​chip; at the same time, the method can perform regular signed number encoding processing on the received data, reducing the number of effective partial products obtained during the multiplication operation, thereby reducing the complexity of the multiplication operation and improving the operational efficiency of the multiplication operation.

[0159] Fig. 9 A schematic diagram of a specific process of obtaining a partial product after sign bit extension is provided in an embodiment, such as Fig. 9 As shown, the step of obtaining the partial product after the sign bit extension according to the functional mode selection signal, the target code and the split data in the above S105 may specifically include:

[0160] S1051. Obtain a first partial product after sign bit extension according to a low-order target code in the target code and the split data.

[0161] Specifically, the multiplier can obtain the first partial product after the sign bit is extended according to the low-order target code in the target code and the split multiplicand. Optionally, the bit width of the first partial product after the sign bit is extended can be equal to twice the bit width of the split multiplicand.

[0162] S1052. Obtain a first value in the low-order partial product after the sign bit is extended according to the function mode selection signal.

[0163] Specifically, the first value may be located in the low-order partial product after the sign bit is extended, corresponding to the bit value between the (N+1)th bit and the 2Nth bit value, starting from the lowest bit (i.e., the 1st bit) to the highest bit. Optionally, if the function mode selection signal received by the multiplier corresponds to processing 2N-bit data, the first value may be equal to the corresponding bit value in the partial product after the sign bit is extended; if the function mode selection signal received by the multiplier corresponds to processing N-bit data, the first value may be equal to the sign bit value in the partial product after the sign bit is extended, wherein the data bit width received by the multiplier is 2N.

[0164] S1053, performing an AND logic operation on the function mode selection signal and the sign bit value in the first partial product after the sign bit is extended, to obtain a second value in the low-order partial product after the sign bit is extended.

[0165] Specifically, the data bit width received by the multiplier is 2N, and the multiplier performs an AND logic operation on the function mode selection signal through the low-bit AND logic unit, and the sign bit value in the first partial product after the sign bit is extended during the multiplication operation of the multiplier on the 2N-bit data, to obtain the second value in the low-bit partial product after the sign bit is extended. Optionally, the second value can be located in the low-bit partial product after the sign bit is extended, corresponding to the corresponding bit value between the (2N+1)th bit and the 4Nth bit value, starting from the lowest bit (i.e., the first bit) to the highest bit.

[0166] S1054: Combine the value in the first partial product after the sign bit is extended, the first value, and the second value to obtain the low-order partial product after the sign bit is extended.

[0167] Specifically, continuing with the previous example, in the first partial product after the sign bit is extended, starting from the lowest bit (i.e., the 1st bit) to the highest bit, the corresponding bit values ​​between the 1st to the Nth bit values, the corresponding bit values ​​between the (2N+1)th to the 4Nth bit values ​​(i.e., the second value), and the corresponding bit values ​​between the (N+1)th to the 2Nth bit values ​​(i.e., the first value) are combined to obtain the low-order partial product after the sign bit is extended.

[0168] Optionally, the step of obtaining the sign-bit extended partial product according to the functional mode selection signal, the target code and the split data in the above S105 may also include: obtaining the sign-bit extended second partial product according to the high-order target code in the target code and the split data; obtaining a third value in the sign-bit extended high-order partial product according to the functional mode selection signal; performing an AND logic operation on the functional mode selection signal and the sign bit value in the sign-bit extended second partial product to obtain a fourth value in the sign-bit extended high-order partial product; combining the value in the sign-bit extended second partial product, the third value and the fourth value to obtain the sign-bit extended high-order partial product.

[0169] Further, the multiplier can obtain the second partial product after the sign bit is extended according to the high-order target encoding and the split multiplicand. Optionally, the bit width of the second partial product after the sign bit is extended can be equal to twice the bit width of the multiplicand to be processed. Optionally, the above-mentioned third value can be located in the high-order partial product after the sign bit is extended, corresponding to the bit value between the (3N+1)th bit and the 4Nth bit value from the lowest bit (i.e., the first bit) to the highest bit. Optionally, if the functional mode selection signal received by the multiplier corresponds to processing 2N-bit data, the third value can be equal to the sign bit value in the partial product after the sign bit is extended when the multiplier performs a multiplication operation on the 2N-bit data, and can also be equal to the sign bit value in the partial product after the sign bit is extended when the multiplier performs a multiplication operation on the N-bit data, wherein the data bit width received by the multiplier is 2N. Optionally, the data bit width received by the multiplier is 2N, and the multiplier performs an AND logic operation on the function mode selection signal through the high-order AND logic unit, and the sign bit value in the second partial product after the sign bit is extended, obtained in the process of multiplying the 2N-bit data by the multiplier, to obtain a fourth value in the high-order partial product after the sign bit is extended. Optionally, the fourth value can be located in the high-order partial product after the sign bit is extended, corresponding to the corresponding bit value between the 1st to 2N-bit values ​​from the lowest bit (i.e., the 1st bit) to the highest bit. Continuing with the previous example, the corresponding bit value between the (2N+1)th to 3N-bit values, the corresponding bit value between the (3N+1)th to 4N-bit values ​​(i.e., the fourth value), and the corresponding bit value between the 1st to 2N-bit values ​​(i.e., the third value) in the second partial product after the sign bit is extended, corresponding to the lowest bit (i.e., the 1st bit) to the highest bit, is combined to obtain the high-order partial product after the sign bit is extended.

[0170] This embodiment provides a data processing method, which can perform multiplication operations on data of various different bit widths according to a functional mode selection signal received by the multiplier, thereby improving the versatility of the multiplier and effectively reducing the area of ​​the AI ​​chip occupied by the multiplier.

[0171] As one of the embodiments, the step of performing accumulation processing on the partial products after the sign bit extension to obtain the target operation result in the above S106 may specifically include: performing accumulation processing on the column values ​​in the partial products after the sign bit extension through a low-order Wallace tree unit to obtain an accumulation operation result; performing an AND logic operation on the accumulation operation result and the functional mode selection signal through an AND logic unit to obtain a carry input signal; performing accumulation processing on the carry input signal and the column values ​​in the partial products after the sign bit extension through a high-order Wallace tree unit to obtain the target operation result.

[0172] Specifically, if the bit width of the partial product after the sign bit extension can be equal to 2N, the multiplier may include N low-order Wallace tree units and N high-order Wallace tree units; the N low-order Wallace tree units may perform accumulation operations on the low-N columns of data in all the partial products after the sign bit extension to obtain an accumulation operation result; the N high-order Wallace tree units may perform accumulation operations on the high-N columns of data in all the partial products after the sign bit extension to obtain another accumulation operation result; during the operation process, the first high-order Wallace tree unit may perform accumulation operations on the received improved Wallace tree unit. The logic operation result output by the AND logic unit in the Wallace tree circuit is used as the carry input signal, and the (N+1)th column data is accumulated from the lowest column to the highest column in the partial product after all sign bits are expanded; then the multiplier accumulates the output result of the improved Wallace tree circuit through the improved accumulation circuit, and the improved accumulation circuit can perform an AND logic operation with the signal output by the low-order adder according to the received functional mode selection signal, and output the logic operation result to the high-order adder, thereby achieving the target operation result.

[0173] This embodiment provides a data processing method, which can perform multiplication operations on data of multiple different bit widths according to a function selection mode signal received by the multiplier, thereby improving the versatility of the multiplier and effectively reducing the area of ​​the AI ​​chip occupied by the multiplier; at the same time, the multiplier obtains the target operation result by accumulating the partial products after the sign bit is extended through the improved Wallace tree circuit, which can effectively reduce the power consumption of the multiplier.

[0174] The embodiment of the present application also provides a machine learning operation device, which includes one or more multipliers mentioned in the present application, which are used to obtain data to be calculated and control information from other processing devices, perform specified machine learning operations, and pass the execution results to peripheral devices through I / O interfaces. Peripheral devices include cameras, displays, mice, keyboards, network cards, wifi interfaces, and servers. When more than one multiplier is included, the multipliers can be linked and data can be transmitted through a specific structure, for example, through a fast external device interconnect bus to interconnect and transmit data to support larger-scale machine learning operations. At this time, the same control system can be shared, or there can be independent control systems; memory can be shared, or each accelerator can have its own memory. In addition, the interconnection method can be any interconnection topology.

[0175] The machine learning computing device has high compatibility and can be connected to various types of servers through a fast external device interconnection interface.

[0176] The embodiment of the present application also provides a combined processing device, which includes the above-mentioned machine learning computing device, a universal interconnection interface, and other processing devices. The machine learning computing device interacts with other processing devices to jointly complete the operation specified by the user. Fig.10 A schematic diagram of a combined processing device.

[0177] Other processing devices include one or more types of processors such as central processing unit (CPU), graphics processing unit (GPU), neural network processor, and other general / special processors. There is no limit on the number of processors included in other processing devices. Other processing devices serve as interfaces between the machine learning computing device and external data and control, including data handling, to complete basic control of the machine learning computing device such as starting and stopping; other processing devices can also collaborate with the machine learning computing device to complete computing tasks.

[0178] A universal interconnection interface is used to transmit data and control instructions between the machine learning computing device and other processing devices. The machine learning computing device can obtain the required input data from other processing devices and write it into the storage device on the machine learning computing device chip; it can obtain control instructions from other processing devices and write them into the control cache on the machine learning computing device chip; it can also read data in the storage module of the machine learning computing device and transmit it to other processing devices.

[0179] Optionally, the structure is Fig.11As shown, a storage device may also be included, and the storage device is connected to the machine learning operation device and the other processing device respectively. The storage device is used to store data in the machine learning operation device and the other processing device, and is particularly suitable for data that cannot be fully stored in the internal storage of the machine learning operation device or other processing devices.

[0180] The combined processing device can be used as a SOC chip system for mobile phones, robots, drones, video surveillance equipment and other devices, effectively reducing the core area of ​​the control part, improving the processing speed, and reducing the overall power consumption. In this case, the universal interconnection interface of the combined processing device is connected to certain components of the device. Certain components include cameras, displays, mice, keyboards, network cards, and wifi interfaces.

[0181] In some embodiments, a chip is also applied for, which includes the above-mentioned machine learning computing device or combined processing device.

[0182] In some embodiments, a chip packaging structure is applied for, which includes the above-mentioned chip.

[0183] In some embodiments, a board is applied for, which includes the above chip packaging structure. Fig.12 As shown, Fig.12 A board is provided. In addition to the chip 389, the board may also include other supporting components, including but not limited to: a storage device 390, a receiving device 391 and a control device 392;

[0184] The memory device 390 is connected to the chip in the chip package structure via a bus for storing data. The memory device may include multiple groups of storage units 393. Each group of storage units is connected to the chip via a bus. It is understood that each group of storage units may be DDR SDRAM (English: Double Data Rate SDRAM, double rate synchronous dynamic random access memory).

[0185] DDR can double the speed of SDRAM without increasing the clock frequency. DDR allows data to be read out on the rising and falling edges of the clock pulse. The speed of DDR is twice that of standard SDRAM. In one embodiment, the storage device may include 4 groups of storage units. Each group of storage units may include multiple DDR4 particles (chips). In one embodiment, the chip may include 4 72-bit DDR4 controllers, 64 bits of the above 72-bit DDR4 controllers are used to transmit data, and 8 bits are used for ECC verification. It can be understood that when DDR4-3200 particles are used in each group of storage units, the theoretical bandwidth of data transmission can reach 25600MB / s.

[0186] In one embodiment, each group of the storage units includes a plurality of double rate synchronous dynamic random access memories arranged in parallel. DDR can transmit data twice in one clock cycle. A controller for controlling DDR is arranged in the chip to control the data transmission and data storage of each of the storage units.

[0187] The receiving device is electrically connected to the chip in the chip packaging structure. The receiving device is used to realize data transmission between the chip and an external device (such as a server or a computer). For example, in one embodiment, the receiving device can be a standard fast external device interconnection interface. For example, the data to be processed is transmitted to the chip by the server through the standard fast external device interconnection interface to realize data transfer. Preferably, when the fast external device interconnection 3.0X 16 interface is used for transmission, the theoretical bandwidth can reach 16000MB / s. In another embodiment, the receiving device can also be other interfaces. The present application does not limit the specific forms of expression of the above-mentioned other interfaces. The interface unit can realize the switching function. In addition, the calculation results of the chip are still transmitted back to the external device (such as a server) by the receiving device.

[0188] The control device is electrically connected to the chip. The control device is used to monitor the state of the chip. Specifically, the chip and the control device can be electrically connected via an SPI interface. The control device may include a single-chip microcomputer (Micro Controller Unit, MCU). For example, the chip may include multiple processing chips, multiple processing cores or multiple processing circuits, which can drive multiple loads. Therefore, the chip can be in different working states such as multi-load and light load. The control device can realize the regulation of the working states of multiple processing chips, multiple processing and / or multiple processing circuits in the chip.

[0189] In some embodiments, an electronic device is applied for, which includes the above-mentioned board.

[0190] The electronic device may be a multiplier, a robot, a computer, a printer, a scanner, a tablet computer, a smart terminal, a mobile phone, a driving recorder, a navigator, a sensor, a camera, a server, a cloud server, a camera, a camcorder, a projector, a watch, a headset, a mobile storage, a wearable device, a vehicle, a household appliance, and / or a medical device.

[0191] The transportation means include airplanes, ships and / or vehicles; the household appliances include televisions, air conditioners, microwave ovens, refrigerators, rice cookers, humidifiers, washing machines, electric lights, gas stoves, and range hoods; the medical equipment includes magnetic resonance imaging, ultrasound machines and / or electrocardiographs.

[0192] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of circuit combinations, but those skilled in the art should be aware that the present application is not limited by the described circuit combination method, because according to the present application, some circuits can be implemented in other ways or structures. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the devices and modules involved are not necessarily required by the present application.

[0193] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0194] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A multiplier, characterized in that: The multiplier comprises: an improved regular signed number encoding circuit, an improved Wallace tree circuit and an improved accumulation circuit, wherein the improved Wallace tree circuit comprises a 4-2 compressor, and the 4-2 compressor comprises a selection circuit and a full adder; the improved accumulation circuit comprises a low-bit adder, an AND logic unit and a high-bit adder; the output end of the improved regular signed number encoding circuit is connected to the input end of the improved Wallace tree circuit, the output end of the improved Wallace tree circuit is connected to the input end of the low-bit adder, the output end of the low-bit adder is connected to the input end of the AND logic unit, the output end of the AND logic unit is connected to the input end of the high-bit adder, the improved Wallace tree circuit and the improved accumulation circuit both comprise a logic gate unit, the input end of the logic gate unit is used to receive a receiving function mode selection signal, and the function mode selection signal is used to determine the data bit width that can be processed by the multiplier; Among them, the improved regular signed number encoding circuit is used to perform regular signed number encoding processing on the received data to obtain the target code, and obtain the partial product after the sign bit is extended according to the target code; the improved Wallace tree circuit is used to perform accumulation processing on the partial product after the sign bit is extended to obtain the accumulation operation result; the improved accumulation circuit is used to perform accumulation processing on the accumulation operation result to obtain the target operation result.

2. The multiplier according to claim 1, characterized in that The improved regular signed number encoding circuit comprises an encoding processing branch and a partial product acquisition branch; the encoding processing branch is used to perform regular signed number encoding processing on the received data to obtain a target code; The partial product acquisition branch is used to obtain the partial product after sign bit extension according to the target code.

3. The multiplier according to claim 2, characterized in that The encoding processing branch includes a regular signed number encoding unit; The regular signed number encoding unit comprises: a first data input port, a first mode selection signal input port, a low-order target encoding output port and a high-order target encoding output port; the partial product acquisition branch comprises a low-order partial product acquisition unit, a low-order selector group unit, a low-order AND logic unit, a high-order partial product acquisition unit, a high-order selector group unit and a high-order AND logic unit; the first output end of the regular signed number encoding unit is connected to the first input end of the low-order partial product acquisition unit, the output end of the low-order selector group unit is connected to the second input end of the low-order partial product acquisition unit, the output end of the low-order AND logic unit is connected to the third input end of the low-order partial product acquisition unit, the second output end of the regular signed number encoding unit is connected to the first input end of the high-order partial product acquisition unit, the output end of the high-order selector group unit is connected to the second input end of the high-order partial product acquisition unit, and the output end of the high-order AND logic unit is connected to the third input end of the high-order partial product acquisition unit; Wherein, the regular signed number encoding unit is used to determine the bit width of the data that can be processed by the multiplier according to the received functional mode selection signal, and perform regular signed number encoding processing on the received first data to obtain a low-order target code and a high-order target code, the low-order partial product acquisition unit is used to obtain the low-order partial product after the sign bit is extended according to the received low-order target code and the second data, the low-order selector group unit is used to select the first value in the low-order partial product after the sign bit is extended, the low-order AND logic unit is used to perform an AND logic operation according to the received functional mode selection signal to obtain the second value in the low-order partial product after the sign bit is extended, the high-order partial product acquisition unit is used to obtain the high-order partial product after the sign bit is extended according to the received high-order target code and the second data, the high-order selector group unit is used to select the third value in the high-order partial product after the sign bit is extended, and the high-order AND logic unit is used to perform an AND logic operation according to the received functional mode selection signal to obtain the fourth value in the high-order partial product after the sign bit is extended; The first data input port is used to receive the first data, the first mode selection signal input port is used to receive the functional mode selection signal, the low-order target code output port is used to output the low-order target code obtained after regular signed number encoding processing is performed on the first data, and the high-order target code output port is used to output the high-order target code obtained after regular signed number encoding processing is performed on the first data.

4. The multiplier according to claim 3, characterized in that: The low-order partial product acquisition unit includes: a low-order target code input port, a first selection value input port, a second selection value input port, a second data input port and a low-order partial product output port; the low-order target code input port is used to receive the low-order target code, the first selection value input port is used to receive the first value in the low-order partial product after the sign bit is extended and output after the low-order selector group unit is selected, the second selection value input port is used to receive the second value in the low-order partial product after the sign bit is extended and output by the low-order and logic unit, the second data input port is used to receive the second data, and the low-order partial product output port is used to output the low-order partial product after the sign bit is extended.

5. The multiplier according to claim 3 or 4, characterized in that: The low-bit selector group unit comprises: a low-bit selector; the low-bit selector is used to select the first value in the low-bit partial product after the sign bit is extended.

6. The multiplier according to claim 3 or 4, characterized in that: The low-order and logic unit includes: a first mode selection signal input port, a first sign bit value input port and a first result output port; wherein, the first mode selection signal input port is used to receive the functional mode selection signal, the first sign bit value input port is used to receive the first sign bit value in the low-order partial product after the sign bit is extended, and the first result output port is used to output the logic operation result.

7. The multiplier according to claim 3 or 4, characterized in that: The high-order partial product acquisition unit includes: a high-order target code input port, a third selection value input port, a fourth selection value input port, a second data input port and a high-order partial product output port; the high-order partial product acquisition unit is used to receive the high-order target code, the third selection value input port is used to receive the third value in the high-order partial product after the sign bit is extended and output after the high-order selector group unit is selected, the fourth selection value input port is used to receive the fourth value in the high-order partial product after the sign bit is extended and output by the high-order and logic unit, the second data input port is used to receive the second data, and the high-order partial product output port is used to output the high-order partial product after the sign bit is extended.

8. The multiplier according to claim 3 or 4, characterized in that: The high-order selector group unit includes: a high-order selector, and the high-order selector is used to select the third value in the high-order partial product after the sign bit is extended.

9. The multiplier according to claim 3 or 4, characterized in that: The high-order and logic unit includes: a second mode selection signal input port, a second sign bit value input port and a second result output port; wherein, the second mode selection signal input port is used to receive the functional mode selection signal, the second sign bit value input port is used to receive the second sign bit value in the high-order partial product after the sign bit is extended, and the second result output port is used to output the logic operation result.

10. The multiplier according to any one of claims 1 to 4, characterized in that: The improved Wallace tree circuit includes: a low-order Wallace tree unit, an AND logic unit and a high-order Wallace tree unit, wherein the output end of the low-order Wallace tree unit is connected to the input end of the AND logic unit, and the output end of the AND logic unit is connected to the input end of the high-order Wallace tree unit; wherein the low-order Wallace tree unit is used to perform accumulation processing on each column of values ​​in the partial products after all sign bits are extended, the AND logic unit is used to perform an AND logic operation on the received function mode selection signal and the carry output signal output by the low-order Wallace tree unit to obtain the carry input signal received by the high-order Wallace tree unit, and the high-order Wallace tree unit is used to perform accumulation processing on each column of values ​​in the partial products after all sign bits are extended.

11. The multiplier according to claim 10, characterized in that: The low-order Wallace tree unit and the high-order Wallace tree unit both include the 4-2 compressor and a mode selection circuit, wherein the output end of the mode selection circuit is connected to the input end of the 4-2 compressor, and the mode selection circuit includes a first input end for receiving the functional mode selection signal; wherein the 4-2 compressor is used to accumulate the values ​​of each column in all the partial products after sign bit expansion, and the mode selection circuit is used to select the values ​​in the partial products after sign bit expansion received by the 4-2 compressor.

12. The multiplier according to any one of claims 1 to 4, characterized in that: The low-order adder is used to perform accumulation processing on the low-order accumulation operation result, and the AND logic unit is used to perform an AND logic operation on the received functional mode selection signal and the output signal of the low-order adder to obtain the carry input signal of the high-order adder, and the high-order adder is used to perform an accumulation operation based on the carry input signal and the high-order accumulation operation result.

13. A data processing method, characterized in that: Applied to a multiplier as claimed in any one of claims 1 to 12, the method comprising: Receiving data to be processed and a function mode selection signal, wherein the function mode selection signal is used to indicate a bit width of currently processable data; According to the function mode selection signal, determining whether the data to be processed needs to be split and processed; If the data to be processed needs to be split, the data to be processed is split to obtain split data; Performing regular signed number encoding processing on the split data to obtain a target code; Obtaining the partial product after the sign bit extension according to the functional mode selection signal, the target code and the split data; The partial products after the sign bit extension are accumulated to obtain the target operation result.

14. The method according to claim 13, characterized in that The determining, based on the function mode selection signal, whether the data to be processed needs to be split and processed comprises: determining, based on the function mode selection signal, whether the bit width of the data to be processed is equal to the bit width of data that can be processed by the multiplier.

15. The method according to claim 14, characterized in that The method further includes: if the data to be processed does not need to be split, then continuing to perform regular signed number encoding processing on the data to be processed to obtain the target code.

16. The method according to any one of claims 13 to 15, characterized in that The step of performing regular signed number encoding processing on the split data to obtain a target code comprises: converting the consecutive l A bit value of 1 converts to ( l +1) the highest digit value is 1, the lowest digit value is -1, and the remaining digits are 0, the target code is obtained, wherein, l Greater than or equal to 2.

17. The method according to claim 16, characterized in that The step of performing regular signed number encoding processing on the split data to obtain a target code includes: Performing regular signed number encoding processing on the split data to obtain an intermediate code; The target code is obtained according to the intermediate code and the functional mode selection signal.

18. The method according to any one of claims 13 to 15, characterized in that The target code includes a low-order target code and a high-order target code; The step of obtaining the partial product after the sign bit extension according to the function mode selection signal, the target code and the split data comprises: Obtaining a first partial product after sign bit extension according to a low-order target code in the target code and the split data; According to the function mode selection signal, a first value of the low-order partial product after the sign bit is extended is obtained; Performing an AND logic operation on the function mode selection signal and the sign bit value in the first partial product after the sign bit is extended to obtain a second value in the low-order partial product after the sign bit is extended; The value in the first partial product after the sign bit is extended, the first value, and the second value are combined to obtain the low-order partial product after the sign bit is extended.

19. The method according to claim 18, characterized in that The step of obtaining the partial product after the sign bit extension according to the function mode selection signal, the target code and the split data comprises: Obtaining a second partial product after sign bit extension according to a high-order target code in the target code and the split data; Obtaining a third value of the high-order partial product after the sign bit is extended according to the function mode selection signal; Performing an AND logic operation on the function mode selection signal and the sign bit value in the second partial product after the sign bit is extended to obtain a fourth value in the high-order partial product after the sign bit is extended; The value in the second partial product after the sign bit extension, the third value and the fourth value are combined to obtain the high-order partial product after the sign bit extension.

20. The method according to any one of claims 13 to 15, characterized in that: The step of accumulating the partial products after the sign bit extension to obtain a target operation result includes: Performing accumulation processing on the column values ​​in the partial product after the sign bit is extended by using a low-order Wallace tree unit to obtain an accumulation operation result; Performing an AND logic operation on the accumulation operation result and the function mode selection signal through an AND logic unit to obtain a carry input signal; The carry input signal and the column values ​​in the partial product after the sign bit is extended are accumulated through the high-order Wallace tree unit to obtain the target operation result.

21. A machine learning computing device, characterized in that: The machine learning operation device comprises one or more multipliers according to any one of claims 1 to 12, and is used to obtain input data to be operated and control information from other processing devices in the machine learning operation device except the multiplier, and perform specified machine learning operations, and transmit the execution results to other processing devices in the machine learning operation device except the multiplier through an I / O interface; When the machine learning computing device includes a plurality of the multipliers, the plurality of the multipliers are connected via a preset structure and transmit data; Wherein, a plurality of said multipliers are interconnected and transmit data via a PCIE bus to support larger-scale machine learning operations; The plurality of multipliers share the same control system or have their own control systems; the plurality of multipliers share a memory or have their own memory; the interconnection method of the plurality of multipliers is any interconnection topology.

22. A combined processing device, characterized in that: The combined processing device includes the machine learning operation device as claimed in claim 21, a universal interconnection interface and other processing devices in the combined processing device except the machine learning operation device; The machine learning operation device interacts with other processing devices in the combined processing device except the machine learning operation device to jointly complete the calculation operation specified by the user.

23. The combined processing device according to claim 22, characterized in that: The combined processing device also includes: a storage device, which is respectively connected to the machine learning operation device and other processing devices in the combined processing device except the machine learning operation device and the storage device, and is used to save data of the machine learning operation device and other processing devices in the combined processing device except the machine learning operation device and the storage device.

24. A neural network chip, characterized in that: The neural network chip includes the machine learning operation device as described in claim 21 or the combined processing device as described in claim 22 or the combined processing device as described in claim 23.