A low-cost matrix operation FPGA implementation method based on operator reuse

By implementing operator multiplexing and first-in-first-out memory transmission mechanisms on FPGAs, the problem of high hardware resource consumption of large-scale matrix multiplication is solved, computing efficiency and hardware resource utilization are improved, and implementation costs are reduced.

CN118363923BInactive Publication Date: 2024-11-12HUBEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410492337.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Large-scale matrix multiplication consumes a lot of hardware resources during calculation, resulting in inefficiency in processing large-scale data.

Method used

Using a low-cost matrix operation FPGA implementation method based on operator multiplexing, the MCU microcontroller unit, matrix block storage module and first-in-first-out memory module are used to calculate, and the calculation efficiency and hardware resource utilization are optimized.

Benefits of technology

It improves the efficiency of large-scale matrix computing, reduces hardware resource requirements and implementation costs, enables devices with weak computing capabilities to handle large-scale matrix computing, and simplifies the transmission mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363923B_ABST
    Figure CN118363923B_ABST
Patent Text Reader

Abstract

The invention relates to the field of computer technology, and discloses a low-cost matrix operation FPGA implementation method based on operator reuse, wherein the system comprises an MCU microcontroller unit, a matrix block storage module, a matrix operator module and a first-in-first-out memory module, wherein the MCU microcontroller unit comprises a central processing unit and a storage unit, the matrix block storage module comprises a storage unit and a control unit, the matrix operator module comprises a multiplier, an adder and a storage unit, and the first-in-first-out memory module comprises a first-in-first-out memory. The invention reuses operators on an FPGA, thereby improving the efficiency of large-scale matrix operations and reducing the demand for hardware resources, thereby reducing the implementation cost; the invention also optimizes the computing efficiency and the utilization of hardware resources, so that even a device with a relatively weak computing power can process large-scale matrix operations; the invention can also utilize operator reuse and a first-in-first-out transmission mechanism to make it highly scalable and easy to implement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a low-cost matrix operation FPGA implementation method based on operator multiplexing. Background Art

[0002] In recent years, with the continuous development of mobile Internet, voice, image and other data are growing, and massive data operations have become a new challenge. When operating these complex data, matrix multiplication is usually the key node of the calculation. Matrix multiplication is usually expressed as C = AB, where A and B are input matrices and C is their product. As a basic mathematical operation, the computational complexity of matrix multiplication is closely related to the size of the matrix and the multiplication algorithm. Specifically, as the size of the matrix increases, the calculation time increases exponentially, making the processing of large-scale data extremely hardware-intensive. In this context, the introduction of field programmable gate arrays (FPGAs) for parallel computing has become an effective solution. FPGAs are integrated circuits that can be programmed and configured at the hardware level. Compared with traditional ASICs (application-specific integrated circuits) and CPUs (central processing units), they are highly customizable. By time-division multiplexing operators on FPGAs, the hardware resource utilization of large-scale matrix multiplication can be improved. Summary of the invention

[0003] In view of the problem that large-scale matrix multiplication in the background requires extremely large hardware resources, the present invention proposes a low-cost matrix operation FPGA implementation method based on operator reuse, which improves the computational efficiency of large-scale matrix multiplication and has low implementation cost.

[0004] The technical solution of the present invention to solve the above technical problems is as follows:

[0005] A low-cost matrix operation FPGA implementation method based on operator multiplexing, wherein the system includes an MCU microcontroller unit as a control unit, a matrix block storage module, a matrix operator module and a first-in-first-out memory module, wherein the MCU microcontroller unit includes a central processing unit and a storage unit, the matrix block storage module includes a storage unit and a control unit, the matrix operator module includes a multiplier, an adder and a storage unit, and the first-in-first-out memory module includes a first-in-first-out memory;

[0006] The specific implementation method includes the following three steps:

[0007] S1: read two large-scale matrices A and B, split and number the two large-scale matrices A and B, and then package and store them. According to the number, a large-scale matrix calculation result expression is constructed. First, the calculation result of the split and numbered matrix blocks is calculated by the matrix operator module, and then the calculation result of the split and numbered matrix blocks is calculated by the large-scale matrix calculation result expression. The calculation result of the product of the two large-scale matrices A and B is calculated;

[0008] S2: Initialize the storage unit, receive the split and numbered matrix blocks of the MCU microcontroller unit and calculate the storage unit depth, input the split and numbered matrix blocks, initialize the storage unit of the matrix operator module, and input a low stop signal to the MCU microcontroller unit;

[0009] S3: Initialize the first-in-first-out memory to an empty state. When the calculation results of the split and numbered matrix blocks are written, the first-in-first-out memory becomes a non-empty state, and then sends a data request signal. At the same time, the writing of the calculation results of the further split and numbered matrix blocks is suspended, and it is determined whether the first-in-first-out memory of the previous level is in an empty state. If the first-in-first-out memory of the previous level is in an empty state, the data transmitted by the first-in-first-out memory of the next level through the result output channel is received. If the first-in-first-out memory of the previous level is not in an empty state, the calculation results of the split and numbered matrix blocks of the first-in-first-out memory of the next level are not received.

[0010] Based on the above technical solution, the present invention can also be improved as follows.

[0011] Preferably, the specific process of splitting the two large-scale matrices A and B in S1 is:

[0012] Two large-scale matrices are read, and then the read large-scale matrices A and B are split into rows and columns according to the matrix sizes of their matrix operators.

[0013] Preferably, the specific process of numbering the split matrix blocks in S1 is:

[0014] The split matrix blocks are numbered in the order of rows and columns starting from 0 and increasing by 1, and the split matrix blocks are packaged and numbered and stored according to the numbers.

[0015] Preferably, the large-scale matrix calculation result expression in S1 is specifically:

[0016]

[0017] Among them, A ik is the submatrix split from matrix A, ik is A ik The row number of B jk is the submatrix split from matrix B, jk is B jk The column number, A ik ×Bjk is the result of the calculation of each matrix operator module, m is the last number of the row element number of matrix A, C ij It is the calculation result expression of the large-scale result matrix C.

[0018] Preferably, the specific process of S2 is:

[0019] S2.1 initializes the storage unit, receives the matrix blocks that have been split and numbered by the MCU microcontroller unit, and calculates the depth of the storage unit;

[0020] S2.2 determines whether the split numbered matrix block is smaller than the storage unit depth;

[0021] S2.2.1 If the split numbered matrix block is smaller than the depth of the storage unit, it is directly stored in the storage unit;

[0022] S2.2.2 If the split numbered matrix block is larger than the depth of the storage unit, it is stored in batches into the storage unit;

[0023] S2.3 determines whether the input request signal of the matrix operator module is at a high level;

[0024] S2.3.1 If the input request signal of the matrix operator module is high, the split numbered matrix blocks are input. After the split numbered matrix blocks are input, the storage unit of the matrix operator module is initialized and the input signal is low to stop the MCU microcontroller unit;

[0025] S2.3.2 If the input request signal of the matrix operator is low level, the split numbered matrix blocks are not input.

[0026] Preferably, the specific process of S3 is:

[0027] S3.1 initializes the FIFO memory. When the FIFO memory is in an empty state, the signal to be written is high. After the calculation results of the split and numbered matrix blocks are written into the FIFO memory, it becomes a non-empty state. The send request signal is high, and the signal to be written is low. Then, after the previous level FIFO memory receives the send request signal high;

[0028] S3.2 determines whether the first-in-first-out storage device of the previous level is in an empty state and whether the corresponding matrix operator calculation is completed;

[0029] S3.2.1 If the first-in-first-out memory of the previous stage is in an empty state and the corresponding matrix operator calculation is not completed, the receiving response signal is high, and the calculated data is sent to the first-in-first-out memory of the previous stage through the result output channel;

[0030] S3.2.2 If the previous level FIFO memory is not empty and the corresponding matrix operator calculation is not completed, the receive response signal is low;

[0031] S3.2.3 If the first-in-first-out memory of the previous stage is not empty and the corresponding matrix operator calculation is completed, the next stage receiving response signal is low;

[0032] S3.2.4 If the first-in-first-out memory of the previous level is empty and the corresponding matrix operator calculation is completed, the calculation result of the corresponding matrix operator is received first, and the receiving response signal to the first-in-first-out memory of the next level is low.

[0033] Compared with the prior art, the technical solution of this application has the following beneficial technical effects:

[0034] 1. The present invention improves the efficiency of large-scale matrix operations by multiplexing operators on FPGA, while reducing the demand for hardware resources, thereby reducing implementation costs.

[0035] 2. The design of the present invention optimizes computing efficiency and utilization of hardware resources, so that even devices with weaker computing power can handle large-scale matrix operations.

[0036] 3. The present invention utilizes operator multiplexing and first-in-first-out transmission mechanism to make it more scalable and less difficult to implement.

[0037] 4. The present invention utilizes a first-in-first-out memory transmission mechanism, thereby simplifying the transmission mechanism and reducing the number of transmission signal lines. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of the structure of a low-cost matrix operation FPGA implementation method based on multi-operator multiplexing;

[0039] Figure 2 A schematic diagram of the process of processing large-scale matrices by the MCU microcontroller unit;

[0040] Figure 3 A schematic diagram of the execution flow of the matrix block storage module;

[0041] Figure 4 A schematic diagram of a first-in-first-out memory execution flow;

[0042] Figure 5 A schematic diagram of the structure of a low-cost matrix operation FPGA implementation method based on four-operator multiplexing;

[0043] Figure 6 Schematic diagram of the results of matrix splitting and packing storage. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] In the embodiment, Figure 1-6 Provided is a low-cost matrix operation FPGA implementation method based on operator multiplexing, wherein the system includes an MCU microcontroller unit as a control unit, a matrix block storage module, a matrix operator module and a first-in-first-out memory module, wherein the MCU microcontroller unit includes a central processing unit and a storage unit, the matrix block storage module includes a storage unit and a control unit, the matrix operator module includes a multiplier, an adder and a storage unit, and the first-in-first-out memory module includes a first-in-first-out memory;

[0046] The specific implementation method includes the following three steps:

[0047] S1: read two large-scale matrices A and B, split and number the two large-scale matrices A and B, and then package and store them. According to the number, a large-scale matrix calculation result expression is constructed. First, the calculation result of the split and numbered matrix blocks is calculated by the matrix operator module, and then the calculation result of the split and numbered matrix blocks is calculated by the large-scale matrix calculation result expression. The calculation result of the product of the two large-scale matrices A and B is calculated;

[0048] S2: Initialize the storage unit, receive the split and numbered matrix blocks of the MCU microcontroller unit and calculate the storage unit depth, input the split and numbered matrix blocks, initialize the storage unit of the matrix operator module, and input a low stop signal to the MCU microcontroller unit;

[0049] S3: Initialize the first-in-first-out memory to an empty state. When the calculation results of the split and numbered matrix blocks are written, the first-in-first-out memory becomes a non-empty state, and then sends a data request signal. At the same time, the writing of the calculation results of the further split and numbered matrix blocks is suspended, and it is determined whether the first-in-first-out memory of the previous level is in an empty state. If the first-in-first-out memory of the previous level is in an empty state, the data transmitted by the first-in-first-out memory of the next level through the result output channel is received. If the first-in-first-out memory of the previous level is not in an empty state, the calculation results of the split and numbered matrix blocks of the first-in-first-out memory of the next level are not received.

[0050] Reference Figure 1-6 , wherein the specific process of splitting the two large-scale matrices A and B in S1 is:

[0051] Read two large-scale matrices, and then split the read large-scale matrices A and B into rows and columns according to the matrix size of their matrix operators;

[0052] Reference Figure 1-6 , wherein the specific process of numbering the split matrix blocks in S1 is:

[0053] The split matrix blocks are numbered in the order of increasing by 1 from row to column starting from 0, and the split matrix blocks are packaged and numbered and stored according to the numbers;

[0054] Reference Figure 1-6 , wherein the expression of the large-scale matrix calculation result in S1 is specifically:

[0055]

[0056] Among them, A ik is the submatrix split from matrix A, ik is A ik The row number of B jk is the submatrix split from matrix B, jk is B jk The column number, A ik ×B jk is the result of the calculation of each matrix operator module, m is the last number of the row element number of matrix A, C ij It is the calculation result expression of the large-scale result matrix C.

[0057] Reference Figure 1-6 , wherein the specific process of S2 is:

[0058] S2.1 initializes the storage unit, receives the matrix blocks that have been split and numbered by the MCU microcontroller unit, and calculates the depth of the storage unit;

[0059] S2.2 determines whether the split numbered matrix block is smaller than the storage unit depth;

[0060] S2.2.1 If the split numbered matrix block is smaller than the depth of the storage unit, it is directly stored in the storage unit;

[0061] S2.2.2 If the split numbered matrix block is larger than the depth of the storage unit, it is stored in batches into the storage unit;

[0062] S2.3 determines whether the input request signal of the matrix operator module is at a high level;

[0063] S2.3.1 If the input request signal of the matrix operator module is high, the split numbered matrix blocks are input. After the split numbered matrix blocks are input, the storage unit of the matrix operator module is initialized and the input signal is low to stop the MCU microcontroller unit;

[0064] S2.3.2 If the input request signal of the matrix operator is low, the split numbered matrix block is not input;

[0065] Reference Figure 1-6 , wherein the specific process of S3 is:

[0066] S3.1 initializes the FIFO memory. When the FIFO memory is in an empty state, the signal to be written is high. After the calculation results of the split and numbered matrix blocks are written into the FIFO memory, it becomes a non-empty state. The send request signal is high, and the signal to be written is low. Then, after the previous level FIFO memory receives the send request signal high;

[0067] S3.2 determines whether the first-in-first-out storage device of the previous level is in an empty state and whether the corresponding matrix operator calculation is completed;

[0068] S3.2.1 If the first-in-first-out memory of the previous stage is in an empty state and the corresponding matrix operator calculation is not completed, the receiving response signal is high, and the calculated data is sent to the first-in-first-out memory of the previous stage through the result output channel;

[0069] S3.2.2 If the previous level FIFO memory is not empty and the corresponding matrix operator calculation is not completed, the receive response signal is low;

[0070] S3.2.3 If the first-in-first-out memory of the previous stage is not empty and the corresponding matrix operator calculation is completed, the next stage receiving response signal is low;

[0071] S3.2.4 If the first-in-first-out memory of the previous level is empty and the corresponding matrix operator calculation is completed, the calculation result of the corresponding matrix operator is received first, and the receiving response signal to the first-in-first-out memory of the next level is low.

[0072] Example

[0073] Now we need to calculate the matrix C=AB. It mainly includes a matrix block storage module, a matrix operator module, a first-in-first-out memory module and several signal lines (the overall block diagram of the low-cost matrix operation FPGA implementation method based on operator reuse proposed by the present invention is as follows Figure 5 shown).

[0074] 1) MCU microcontroller unit processes the matrix results such as Figure 6As shown: Since the size of matrix A is 4*4 and the size of matrix B is 4*5, the size of the final result matrix C is 4*5, because each operator is composed of a 1*2 matrix and a 2*1 matrix. Among them, matrix A can get 0-3 according to the numbering of each row element, where each row has 4 elements, and the operator row element is 2, so 4 / 2=2...0. It can be concluded that the row elements of matrix A are numbered 0-1. Similarly, matrix B can get 0-4 according to the numbering of each column, where each column has 4 elements, so it can be numbered 0-1. (If the size of the row or column element cannot be divided by the size of the matrix operator, the row or column element number is equal to the row or column element divided by the size of the matrix operator plus 1, and the missing element of the last number is filled with 0). After the matrices A and B are split and numbered, we package and store the data results according to {row element, row number, column element, column number} (the row number is used for the multiplier matrix and consists of two parts: the first part indicates the number of rows of the multiplier matrix; the second part indicates the number of row elements. The column number is used for the multiplied matrix and also consists of two parts: the first part indicates the number of columns of the multiplied matrix; the second part indicates the number of column elements.) At the same time, we know that the calculation result of matrix C is:

[0075] C 00 ={calculation result, row number, column number}+{calculation result, row number, column number}={calculation result, 00, 00}+{calculation result, 01, 01};

[0076] C 01 ={calculation result, row number, column number}+{calculation result, row number, column number}={calculation result, 00, 10}+{calculation result, 01, 11}; ...

[0077] C 34 ={calculation result, row number, column number}+{calculation result, row number, column number}={calculation result, 30, 40}+{calculation result, 31, 41};

[0078] 2) After the large-scale matrix is ​​split and packaged for storage, the split and packaged stored data is input to the matrix block storage module through the matrix input channel. At the same time, the four matrix operator modules are in a non-calculation state, so the input request_1, input request_2, input request_3 and input request_4 are all high. At this time, according to the input request signal, the stored split and packaged data is synchronously input to the matrix operator module through the input_1, input_2, input_3 and input_4 channels.

[0079] 3) Matrix operator module 1 receives the data [1,2,0,0,1,5,0,0], matrix operator module 2 receives the data [3,4,0,1,6,13,0,1], matrix operator module 3 receives the data [1,2,0,0,2,6,1,0], and matrix operator 4 receives the data [3,4,0,1,10,14,1,1]. Then each matrix operator extracts the row elements and column elements in the data for calculation. The calculation result is the addition of the corresponding multiple results. At the same time, the row number and column number in the data are extracted and written into the data structure of the packaged calculation result {calculation result, row number, column number}. After extracting the data, matrix operator module 1 parses out matrix [1,2] and matrix [1,5]T, matrix operator module 2 parses out matrix [3,4] and matrix [6,13]T, matrix operator module 3 parses out matrix [1,2] and matrix [2,6]T, matrix operator module 4 parses out matrix [3,4] and matrix [10,14]T, and then each matrix operator module performs matrix operations to obtain the result of matrix operator module 1, which is 1*1+2*5= 11, the result of the packed data is {11, 0, 0, 0, 0}, the result of the operation of the matrix operator module 2 is 3*6+4*13=70, the result of the packed data is {70, 0, 1, 0, 1}, the result of the operation of the matrix operator module 3 is 1*2+2*6=14, the result of the packed data is {14, 0, 0, 1, 0}, the result of the operation of the matrix operator module 4 is 3*10+4*14=86, the result of the packed data is {86, 0, 1, 1, 1}. Since the computing power of each matrix operator is the same, but the element sizes of each input matrix are different, the matrix operator 1 completes the calculation and packing first, the matrix operator module 3 completes the calculation and packing second, the matrix operator module 2 completes the calculation and packing third, and the matrix operator module 4 completes the calculation and packing last. Since the first-in-first-out memory corresponding to each matrix operator module has not written the calculation result of the matrix operator module, the to-be-written signal of each first-in-first-out module is high. At this time, each matrix operator module writes the calculation results into the corresponding first-in-first-out memory according to its own calculation completion speed. After writing is completed, the matrix operator module performs a new round of calculation, and the corresponding input request signal is high.

[0080] 4) Since matrix operator 1 completes calculation and packaging first, matrix operator module 3 completes calculation and packaging second, matrix operator module 2 completes calculation and packaging third, and matrix operator module 4 completes calculation and packaging last. FIFO memory 1 is first written with data and becomes non-empty. At this time, the FIFO memory sends request_1 signal is high, and the waiting to be written_1 signal is low. After the MCU micro-control unit receives the sending request_1 signal as high, it receives the response_0 as high. FIFO memory 1 sends the written data of matrix operator module 1 to the MCU micro-control unit through the result output_1 channel, and becomes empty again. The waiting to be written_1 signal is high again, and the sending request_1 signal is low again. After a period of time, after matrix operator module 3 completes calculation, it writes data into FIFO memory 3. At this time, FIFO memory 3 becomes non-empty, waiting to be written_3 is low, and sending request_3 is high. Assuming that the calculation result of matrix operator module 2 is completed at this time, FIFO memory 2 will give priority to writing the result of matrix operator module 2, and will not receive the response signal as high. Since the FIFO memory 1 of the previous level is in an empty state, after receiving the initiation request_2 of the FIFO memory 2 as high, it returns a high reception response_1, and then the data of the FIFO memory 2 is sent to the FIFO memory through the result output 2 channel, and then becomes empty. At this time, after receiving the transmission request_3 of the FIFO memory 3 as high, it returns the reception response_2 as a high signal, and the data of the FIFO memory 3 is sent to the FIFO memory 2. Assume that at this time, the matrix operator module 4 has completed the calculation and packaging, and writes the result into the FIFO memory 4. Each FIFO memory completes the data transmission at each level by sending requests and receiving responses.

[0081] 5) After the MCU microcontroller receives the data input by the FIFO memory module through the result input 1 channel, it obtains the calculation result data {11, 0, 0, 0, 0}, {70, 0, 1, 0, 1}, {14, 0, 0, 1, 0}, {86, 0, 1, 1, 1} of the matrix operator module. By analyzing the calculation results and their row and column numbers in the data, the final calculation result C can be obtained. 00 ={11,00,00}+{70,01,01}=81; C 01 ={14,00,10}+{86,01,11}=100.

[0082] Repeat steps 2)-5) until all split and stored elements are calculated. Through the cooperation of the MCU microcontroller unit module, the matrix block storage module, the matrix operator module and the first-in-first-out memory module, this method can be used to improve the computing efficiency of devices with weak computing power when facing large-scale matrix operations.

[0083] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0084] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A low-cost matrix operation FPGA implementation method based on operator multiplexing, characterized in that: The system includes an MCU microcontroller as a control unit, a matrix block storage module, a matrix operator module and a first-in-first-out memory module. The MCU microcontroller includes a central processing unit and a storage unit. The matrix block storage module includes a storage unit and a control unit. The matrix operator module includes a multiplier, an adder and a storage unit. The first-in-first-out memory module includes a first-in-first-out memory. The specific implementation method includes the following three steps: S1: read two large-scale matrices A and B, split and number the two large-scale matrices A and B, and then package and store them. According to the numbers, construct the large-scale matrix calculation result expression. First, the matrix operator module calculates the calculation results of the split and numbered matrix blocks, and then calculates the calculation result of the product of the two large-scale matrices A and B based on the calculation results. S2: Initialize the storage unit, receive the split and numbered matrix blocks of the MCU microcontroller unit and calculate the depth of the storage unit, input the split and numbered matrix blocks, and initialize the storage unit of the matrix operator module; S3: Initialize the first-in-first-out memory to an empty state. When the calculation results of the split and numbered matrix blocks are written, the first-in-first-out memory becomes a non-empty state, and then sends a data request signal. At the same time, the writing of the calculation results of the further split and numbered matrix blocks is suspended, and it is determined whether the first-in-first-out memory of the previous level is in an empty state. If the first-in-first-out memory of the previous level is in an empty state, the data transmitted by the first-in-first-out memory of the next level through the result output channel is received. If the first-in-first-out memory of the previous level is not in an empty state, the calculation results of the split and numbered matrix blocks of the first-in-first-out memory of the next level are not received. Among them, after the matrices A and B are split and numbered, they are packed and stored according to {row element, row number, column element, column number}. The row number is used for the multiplier matrix and consists of two parts: the first part represents the number of rows of the multiplier matrix, and the second part represents the number of row elements. The column number is used for the multiplied matrix and also consists of two parts: the first part represents the number of columns of the multiplied matrix, and the second part represents the number of column elements. Then each matrix operator extracts the row elements and column elements in the packed storage data for calculation. After the calculation of each matrix operator is completed, the calculation result and the corresponding row number and column number are written into the data structure of the packed calculation result {calculation result, row number, column number}. The final matrix calculation result is the addition of multiple corresponding packed calculation results.

2. A low-cost matrix operation FPGA implementation method based on operator multiplexing according to claim 1, characterized in that: The specific process of splitting the two large-scale matrices A and B in S1 is: Two large-scale matrices are read, and then the read large-scale matrices A and B are split into rows and columns according to the matrix sizes of their matrix operators.

3. A low-cost matrix operation FPGA implementation method based on operator multiplexing according to claim 2, characterized in that: The specific process of numbering the split matrix blocks in S1 is: The split matrix blocks are numbered in the order of rows and columns starting from 0 and increasing by 1, and the split matrix blocks are packaged and numbered and stored according to the numbers.

4. The low-cost matrix operation FPGA implementation method based on operator multiplexing according to claim 1 is characterized in that: The specific process of S2 is: S2.1 initializes the storage unit, receives the matrix blocks that have been split and numbered by the MCU microcontroller unit, and calculates the depth of the storage unit; S2.2 determines whether the split numbered matrix block is smaller than the storage unit depth; S2.2.1 If the split numbered matrix block is smaller than the depth of the storage unit, it is directly stored in the storage unit; S2.2.2 If the split numbered matrix block is larger than the depth of the storage unit, it is stored in batches into the storage unit; S2.3 determines whether the input request signal of the matrix operator module is at a high level; S2.3.1 If the input request signal of the matrix operator module is high, the split numbered matrix blocks are input. After the split numbered matrix blocks are input, the storage unit of the matrix operator module is initialized and the input signal is low to stop the MCU microcontroller unit; S2.3.2 If the input request signal of the matrix operator is low level, the split numbered matrix blocks are not input.

5. The low-cost matrix operation FPGA implementation method based on operator multiplexing according to claim 1 is characterized in that: The specific process of S3 is as follows: S3.1 initializes the FIFO memory. When the FIFO memory is in an empty state, the signal to be written is high. After the calculation results of the split and numbered matrix blocks are written into the FIFO memory, it becomes a non-empty state. The send request signal is high, and the signal to be written is low. Then, after the previous level FIFO memory receives the send request signal high; S3.2 determines whether the first-in-first-out storage device of the previous level is in an empty state and whether the corresponding matrix operator calculation is completed; S3.2.1 If the first-in-first-out memory of the previous stage is in an empty state and the corresponding matrix operator calculation is not completed, the receiving response signal is high, and the calculated data is sent to the first-in-first-out memory of the previous stage through the result output channel; S3.2.2 If the previous level FIFO memory is not empty and the corresponding matrix operator calculation is not completed, the receive response signal is low; S3.2.3 If the first-in-first-out memory of the previous stage is not empty and the corresponding matrix operator calculation is completed, the next stage receiving response signal is low; S3.2.4 If the first-in-first-out memory of the previous level is empty and the corresponding matrix operator calculation is completed, the calculation result of the corresponding matrix operator is received first, and the receiving response signal to the first-in-first-out memory of the next level is low.