Arithmetic unit and method for floating point fusion multiplication and addition
By using a floating-point fused multiply-accumulate unit with a built-in integer-to-floating-point converter, the fused multiply-accumulate operation of integers and floating-point numbers is directly processed, solving the problem of numerous instruction conversions in existing technologies and achieving a more efficient operation and a lower power consumption computing process.
Patent Information
- Application Number
- CN202410933216.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-05
AI Technical Summary
In existing technologies, floating-point arithmetic units require two instruction conversions when handling multiplication and addition operations involving integers and floating-point numbers, which increases computational complexity and reduces efficiency, especially in large-scale data processing.
Design a floating-point fused multiply-accumulate unit with a built-in integer-to-floating-point converter to directly convert integer operands to floating-point numbers and perform fused multiply-accumulate operations, avoiding additional type conversion instructions. The integer operands are converted to floating-point numbers conforming to the IEEE 754 standard through the integer-to-floating-point converter, and the conversion is completed before the fused multiply-accumulate operation.
It improves computational efficiency, reduces instruction execution cycles, lowers programming complexity and energy consumption, and increases the speed of multiplication and addition operations combining integers and floating-point numbers.
Smart Images

Figure CN118897664A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of chip design, and specifically refers to an operation unit and method for floating-point fusion multiplication and addition. Background Art
[0002] With the advancement of science and technology, especially in the field of artificial intelligence, the demand for computing performance and data processing speed is growing. As the basic data type for processing complex mathematical operations and scientific calculations, the computing efficiency of floating-point numbers is crucial to the overall performance of the system.
[0003] However, in the prior art, when the floating-point operation unit needs to process a fused multiplication-addition operation involving both floating-point numbers and integer numbers, it is first necessary to use an integer-to-floating-point conversion instruction to convert the integer operand into a floating-point number, and then send it together with other floating-point operands into the floating-point operation unit for multiplication-addition operation.
[0004] like Figure 1 As shown in the figure, the calculation flow of the fused multiplication and addition operation of the ordinary floating-point unit when the operand contains integer data:
[0005] Assume that there is a floating-point multiplication and addition statement a_f=a_f+b_f*c_i in the program, where a_f and b_f are floating-point data and c_i is integer data. After the statement is compiled into machine code, it should include the following assembly operations:
[0006] Store the integer c_i into the integer register r1, use the integer-floating point conversion instruction to convert the integer c_i stored in register r1 into a floating point number c_f, and store it in the floating point register fr3;
[0007] The floating point numbers a_f and b_f are stored in the floating point registers fr1 and fr2 respectively, and then the floating point data a_f, b_f, c_f stored in fr1, fr2, fr3 are sent as operands to the floating point operation unit for fused multiplication and addition operation;
[0008] The result of the fused multiply-add operation is stored in register fr1 as the output result a_f.
[0009] That is to say, if the operands of the floating-point fused multiplication and addition operation involve two data types, at least two instructions need to be executed to complete one operation, which not only increases the complexity of instruction execution, but also reduces the operation efficiency.
[0010] This performance bottleneck is particularly evident when processing large-scale data and complex algorithms, such as the training and inference process of deep learning models.
[0011] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0012] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0013] The embodiments of the present disclosure provide an operation unit and method for floating-point fused multiplication and addition, which can directly process fused multiplication and addition operations involving integer operands without adding additional conversion steps, thereby significantly improving the operation efficiency and speed.
[0014] In some embodiments, the computing unit includes:
[0015] An input interface: used for receiving at least three input operands, wherein the input operands include a floating point operand and at least one integer operand;
[0016] Integer-floating point converter: built into the unit, used to directly convert the input integer operand into a floating point number that complies with the IEEE 754 standard. The conversion process is completed before the fused multiplication and addition operation;
[0017] Fused multiplication-addition operator: receives floating-point operands converted from integer operands, and directly performs floating-point fused multiplication-addition operations on the converted floating-point operands and the input floating-point operands, that is, first performs fused multiplication-addition operations on the two operands;
[0018] Output interface: used to output the results of fused multiplication and addition operations.
[0019] In some embodiments, the computing method includes:
[0020] Store integer data into integer registers and floating point data into floating point registers respectively;
[0021] Sending the integer data and the floating-point data as operands to the aforementioned operation unit for floating-point fused multiplication and addition to perform fused multiplication and addition operations;
[0022] Store the result of the fused multiply-add operation into a floating-point register as the output result.
[0023] Optionally, the operation unit accepts three operand inputs A, B, and C, corresponding to a fused multiply-add operation R=A+B*C; wherein operands A and B are floating-point numbers, and operand C is a floating-point number or integer data, and the specific data type is specified by the fused multiply-add instruction flag.
[0024] Optionally, if the operand C is a floating point number, the calculation process of the operation unit is as follows:
[0025] Split the floating point numbers A, B, C into the exponent part A_e, B_e, C_e and the mantissa part A_m, B_m, C_m;
[0026] The absolute value of C_m and C, abs(C), is passed to the multiplexer, and the multiplexer output is determined by the fused multiply-add instruction flag bit to be C_m;
[0027] B_m and C_m are passed into the multiplier for multiplication;
[0028] C_e and a fixed constant are passed to the multiplexer, and the multiplexer output is determined by the fused multiply-add instruction flag bit to be C_e;
[0029] B_e and C_e are passed into the exponential shift unit to calculate the exponent after multiplying B and C;
[0030] The exponent after multiplying A_e with the above-calculated B and C is passed to the exponent alignment unit, and the exponent of the incoming A_m is aligned;
[0031] The exponent alignment unit outputs A_am after exponent alignment and B_m*C_m output by the multiplier and inputs it into the adder for addition operation;
[0032] The operation result of the adder and the alignment index R_ue output by the exponent alignment unit are transmitted to the floating point number splicing unit together;
[0033] The floating-point number concatenation unit first normalizes the output result of the adder according to the floating-point number standard, obtains the output mantissa R_m and the normalization shift R_nen, and then calculates the exponent part R_e of the output data according to the alignment exponents R_ue and R_ne, and finally concatenates them into the output data R.
[0034] Optionally, if the operand C is an integer, the calculation process of the fused multiply-add unit is as follows:
[0035] Split the floating point numbers A and B into the exponent part A_e, B_e and the mantissa part A_m, B_m;
[0036] The absolute value abs(C) of C_m and C is passed to the multiplexer, and the multiplexer output is abs(C) determined by the fused multiply-add instruction flag.
[0037] B_m and abs(C) are passed to the multiplier for multiplication;
[0038] C_e and the fixed constant S are passed into the multiplexer. The fused multiplication and addition instruction flag determines that the multiplexer output is a fixed constant. The fixed constant is determined by the number of digits in the mantissa of the floating-point number and is fixed by hardware as the input of the corresponding multiplexer.
[0039] B_e and S are passed into the exponential shift unit to calculate the exponent after multiplying B and C;
[0040] The exponent after multiplying A_e and the calculated B and C is passed to the exponent alignment unit, and the exponent of the incoming A_m is aligned;
[0041] The exponent alignment unit outputs the aligned A_am and the multiplier outputs B_m*abs(C) which are then fed into the adder for addition.
[0042] The operation result of the adder and the alignment index R_ue output by the exponent alignment unit are transmitted to the floating point number splicing unit together;
[0043] The floating-point number concatenation unit first normalizes the output result of the adder according to the floating-point number standard, obtains the output mantissa R_m and the normalization shift R_nen, and then calculates the exponent part R_e of the output data according to the alignment exponents R_ue and R_ne, and finally concatenates them into the output data R.
[0044] Optionally, the setting instruction includes: an instruction operation type ops, indicating that the instruction is a floating-point fused multiply-add instruction supporting integer operands; and a flag flag, indicating a data type of an input operand C of the floating-point fused multiply-add operation.
[0045] Optionally, the setting instruction also includes:
[0046] Input register address rs1, indicating the register address of input operand A of floating-point fused multiply-add operation;
[0047] Input register address rs2, indicating the register address of input operand B of the floating-point fused multiply-add operation;
[0048] Input register address rs3, indicating the register address of input operand C of floating-point fused multiply-add operation;
[0049] The output register address rd indicates the output storage register of the floating-point fused multiply-add operation.
[0050] The operation unit and method for floating-point fusion multiplication and addition provided in the embodiments of the present disclosure can achieve the following technical effects:
[0051] The present invention avoids explicit type conversion instructions before operation by building an integer-floating point converter in the operation unit, reduces the instruction execution cycle, and improves the operation efficiency. When writing a program, the developer does not need to consider the details of data type conversion and can directly use the fused multiply-add instruction, which reduces the programming difficulty and complexity. Since unnecessary instruction execution and data conversion processes are reduced, the floating-point fused multiply-add unit of the present invention can significantly reduce energy consumption during the operation process.
[0052] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0054] Figure 1 It is the calculation flow of the fused multiplication and addition operation of the ordinary floating-point unit when the operands contain integer data;
[0055] Figure 2 It is a schematic diagram of a calculation process of a floating-point fusion multiplication-addition unit provided by an embodiment of the present disclosure;
[0056] Figure 3 is a schematic diagram of a floating-point fused multiply-add unit provided by an embodiment of the present disclosure;
[0057] Figure 4 It is a schematic diagram of the instruction setting of the floating-point fusion multiply-add unit provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0058] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0059] The terms "first", "second", etc. in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0060] Unless otherwise stated, the term "plurality" means two or more.
[0061] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0062] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0063] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0064] The present invention provides an operation unit for floating-point fusion multiplication and addition, the unit comprising the following structure:
[0065] An input interface: used for receiving at least three input operands, wherein the input operands include a floating point operand and at least one integer operand;
[0066] Integer-floating point converter: built into the unit, used to directly convert the input integer operand into a floating point number that complies with the IEEE 754 standard. The conversion process is completed before the fused multiplication and addition operation;
[0067] Fused multiplication-addition operator: receives floating-point operands converted from integer operands, and directly performs floating-point fused multiplication-addition operations on the converted floating-point operands and the input floating-point operands, that is, first performs fused multiplication-addition operations on the two operands;
[0068] Output interface: used to output the results of fused multiply-add operations.
[0069] In some embodiments, the computing method includes:
[0070] Store integer data into integer registers and floating point data into floating point registers respectively;
[0071] Sending the integer data and the floating-point data as operands to the aforementioned operation unit for floating-point fused multiplication and addition to perform fused multiplication and addition operations;
[0072] Store the result of the fused multiply-add operation into a floating-point register as the output result.
[0073] As an example, when the floating-point fusion multiplication-addition unit of the present invention performs a floating-point fusion multiplication-addition operation including integer operands, the specific method steps are as follows:
[0074] Three operands including at least one integer operand are received through an input interface.
[0075] Determine whether there is an integer operand in the operands. If so, use the built-in integer-floating point converter to automatically convert it to floating point type. The conversion process is completed internally without the intervention of external instructions.
[0076] The converted operands or the original floating-point operands are sent to the fused multiply-add operator to perform the fused multiply-add operation.
[0077] The calculation results are output through the output interface.
[0078] Specifically, a floating-point fused multiply-add unit that supports integer operands can compress the above assembly operation process into one step, such as Figure 2 As shown:
[0079] The integer c_i is stored in the integer register r1, and the floating-point numbers a_f and b_f are stored in the floating-point registers fr1 and fr2 respectively. Then, the floating-point data a_f, b_f, and c_i stored in fr1, fr2, and r1 are sent as operands to the floating-point fused multiplication-addition unit that supports integer operands in the floating-point arithmetic unit for fused multiplication-addition operation.
[0080] The result of the fused multiply-add operation is stored in register fr1 as the output result a_f.
[0081] like Figure 3 As shown, the implementation method of the floating-point fused multiply-add unit supporting integer operands.
[0082] The floating-point fused multiply-add unit accepts three operand inputs A, B, and C, corresponding to the fused multiply-add operation R = A + B * C. Operands A and B are floating-point numbers, and operand C is a floating-point number or integer data. The specific data type is specified by the fused multiply-add instruction flag.
[0083] If the operand C is a floating point number, the calculation process of the fused multiply-add unit is as follows:
[0084] Split the floating point numbers A, B, C into the exponent part A_e, B_e, C_e and the mantissa part A_m, B_m, C_m;
[0085] The absolute value of C_m and C, abs(C), is passed to the multiplexer, and the multiplexer output is determined by the fused multiply-add instruction flag bit to be C_m;
[0086] B_m and C_m are passed into the multiplier for multiplication;
[0087] C_e and a fixed constant are passed to the multiplexer, and the multiplexer output is determined by the fused multiply-add instruction flag bit to be C_e;
[0088] B_e and C_e are passed into the exponential shift unit to calculate the exponent after multiplying B and C;
[0089] The exponent after multiplying A_e with the above-calculated B and C is passed to the exponent alignment unit, and the exponent of the incoming A_m is aligned;
[0090] The exponent alignment unit outputs A_am after exponent alignment and B_m*C_m output by the multiplier and inputs it into the adder for addition operation;
[0091] The above-mentioned adder operation result and the alignment index R_ue output by the exponent alignment unit are transmitted to the floating-point number splicing unit together. The floating-point number splicing unit first normalizes the output result of the adder according to the floating-point number standard to obtain the output mantissa R_m and the normalization shift R_nen, and then calculates the exponent part R_e of the output data according to the alignment index R_ue and R_ne, and finally splices them into the output data R.
[0092] If the operand C is an integer, the calculation process of the fused multiply-add unit is as follows:
[0093] Split the floating point numbers A and B into the exponent part A_e, B_e and the mantissa part A_m, B_m;
[0094] The absolute value abs(C) of C_m and C is passed to the multiplexer, and the multiplexer output is abs(C) determined by the fused multiply-add instruction flag.
[0095] B_m and abs(C) are passed to the multiplier for multiplication;
[0096] C_e and the fixed constant S are passed into the multiplexer. The fused multiplication and addition instruction flag determines that the multiplexer output is a fixed constant. The fixed constant is determined by the number of digits in the mantissa of the floating-point number and is fixed by hardware as the input of the corresponding multiplexer.
[0097] B_e and S are passed into the exponential shift unit to calculate the exponent after multiplying B and C;
[0098] The exponent after multiplying A_e with the above-calculated B and C is passed to the exponent alignment unit, and the exponent of the incoming A_m is aligned;
[0099] The exponent alignment unit outputs the aligned A_am and the multiplier outputs B_m*abs(C) which are then fed into the adder for addition.
[0100] The adder operation result and the alignment index R_ue output by the exponent alignment unit are transmitted to the floating-point number splicing unit. The floating-point number splicing unit first normalizes the output result of the adder according to the floating-point number standard to obtain the output mantissa R_m and the normalization shift R_nen, and then calculates the exponent part R_e of the output data according to the alignment index R_ue and R_ne, and finally splices them into the output data R.
[0101] Furthermore, an instruction corresponding to a floating-point fused multiply-add unit supporting integer operands is defined.
[0102] like Figure 4 As shown, the instructions corresponding to the floating-point fusion multiply-add unit supporting integer operands include:
[0103] The instruction operation type ops indicates that the instruction is a floating-point fused multiply-add instruction that supports integer operands;
[0104] Output register address rd, indicating the output storage register of the floating-point fused multiply-add operation;
[0105] Input register address rs1, indicating the register address of input operand A of floating-point fused multiply-add operation;
[0106] Input register address rs2, indicating the register address of input operand B of the floating-point fused multiply-add operation;
[0107] Input register address rs3, indicating the register address of input operand C of floating-point fused multiply-add operation;
[0108] Flag flag indicates the data type of the input operand C of the floating-point fused multiply-add operation.
[0109] The beneficial effects of the present disclosure are as follows:
[0110] Improved operation efficiency: The present invention avoids explicit type conversion instructions before operation by using a built-in integer-floating point converter, reduces instruction execution cycles, and improves operation efficiency.
[0111] Simplify programming complexity: When writing programs, developers do not need to consider the details of data type conversion and can directly use fused multiply-add instructions, which reduces the difficulty and complexity of programming.
[0112] Reduce energy consumption: Since unnecessary instruction execution and data conversion processes are reduced, the floating-point fusion multiply-add unit of the present invention can significantly reduce energy consumption during the operation process.
[0113] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the scope of protection. As used in the description in the text, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0114] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. The technicians may clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0115] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0116] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. An arithmetic unit for floating-point fused multiplication and addition, characterized in that: include: An input interface: used for receiving at least three input operands, wherein the input operands include a floating point operand and at least one integer operand; Integer-floating point converter: built into the unit, used to directly convert the input integer operand into a floating point number that complies with the IEEE754 standard. The conversion process is completed before the fused multiplication and addition operation; Fused multiplication-addition operator: receives floating-point operands converted from integer operands, and directly performs floating-point fused multiplication-addition operations on the converted floating-point operands and the input floating-point operands, that is, first performs fused multiplication-addition operations on the two operands; Output interface: used to output the results of fused multiply-add operations.
2. A method for floating-point fused multiplication and addition, characterized in that: include: Store integer data into integer registers and floating point data into floating point registers respectively; Sending the integer data and the floating-point data as operands to the operation unit for floating-point fused multiplication and addition as claimed in claim 1 to perform fused multiplication and addition operation; Store the result of the fused multiply-add operation into a floating-point register as the output result.
3. The method according to claim 2, characterized in that The arithmetic unit accepts three operand inputs A, B, C, corresponding to the fused multiplication-addition operation R=A+B*C; Operands A and B are floating-point numbers, and operand C is a floating-point number or integer data. The specific data type is specified by the fused multiply-add instruction flag.
4. The method according to claim 3, characterized in that If the operand C is a floating point number, the calculation process of the operation unit is as follows: Split the floating point numbers A, B, C into the exponent part A_e, B_e, C_e and the mantissa part A_m, B_m, C_m; The absolute value of C_m and C, abs(C), is passed to the multiplexer, and the multiplexer output is determined by the fused multiply-add instruction flag bit to be C_m; B_m and C_m are passed into the multiplier for multiplication; C_e and a fixed constant are passed to the multiplexer, and the multiplexer output is determined by the fused multiply-add instruction flag bit to be C_e; B_e and C_e are passed into the exponential shift unit to calculate the exponent after multiplying B and C; The exponent after multiplying A_e with the above-calculated B and C is passed to the exponent alignment unit, and the exponent of the incoming A_m is aligned; The exponent alignment unit outputs A_am after exponent alignment and B_m*C_m output by the multiplier, which are input to the adder for addition operation; The operation result of the adder and the alignment index R_ue output by the exponent alignment unit are transmitted to the floating point number splicing unit together; The floating point number splicing unit first normalizes the output result of the adder according to the floating point number standard, obtains the output mantissa R_m and the normalization shift R_nen, then calculates the exponent part R_e of the output data according to the alignment index R_ue and R_ne, and finally splices them into the output data R.
5. The method according to claim 3, characterized in that: If the operand C is an integer, the calculation process of the fused multiply-add unit is as follows: Split the floating point numbers A and B into the exponent part A_e, B_e and the mantissa part A_m, B_m; The absolute value abs(C) of C_m and C is passed to the multiplexer, and the multiplexer output is abs(C) determined by the fused multiply-add instruction flag. B_m and abs(C) are passed to the multiplier for multiplication; C_e and the fixed constant S are passed into the multiplexer, and the fused multiplication and addition instruction flag determines that the output of the multiplexer is a fixed constant, which is determined by the number of digits in the mantissa of the floating-point number and is fixed by hardware as the input of the corresponding multiplexer; B_e and S are passed into the exponential shift unit to calculate the exponent after multiplying B and C; The exponent after multiplying A_e and the calculated B and C is passed to the exponent alignment unit, and the exponent of the incoming A_m is aligned; The exponent alignment unit outputs A_am after exponent alignment and B_m*abs(C) output by the multiplier and inputs them into the adder for addition operation; The operation result of the adder and the alignment index R_ue output by the exponent alignment unit are transmitted to the floating point number splicing unit together; The floating point number splicing unit first normalizes the output result of the adder according to the floating point number standard, obtains the output mantissa R_m and the normalization shift R_nen, then calculates the exponent part R_e of the output data according to the alignment index R_ue and R_ne, and finally splices them into the output data R.
6. The method according to any one of claims 2 to 5, characterized in that: The setup instructions include: The instruction operation type ops indicates that the instruction is a floating-point fused multiply-add instruction that supports integer operands; Flag flag indicates the data type of the input operand C of the floating-point fused multiply-add operation.
7. The method according to claim 6, characterized in that The setting instruction also includes: Input register address rs1, indicating the register address of input operand A of floating-point fused multiply-add operation; Input register address rs2, indicating the register address of input operand B of the floating-point fused multiply-add operation; Input register address rs3, indicating the register address of input operand C of floating-point fused multiply-add operation; The output register address rd indicates the output storage register of the floating-point fused multiply-add operation.
