Apparatus and method for compute in BRAM for multiply-accumulate operations

The described computational module with a dual-ported BRAM and MAC unit addresses the computational burden in neural networks and digital filters by performing efficient hybrid multiply-and-accumulate operations, enhancing processing speed and accuracy for high-frequency applications.

WO2024197292A2PCT designated stage expired Publication Date: 2024-09-26CORNELL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/US2024/021244
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-23
Filing Date
2024-03-23
Publication Date
2024-09-26

AI Technical Summary

Technical Problem

Current neural network and digital filter implementations face computational burdens due to the need for rapid processing of high-precision multiplications and summations, particularly in real-time applications, where existing technologies often rely on short weight lengths that require significant computation and may overflow or truncate results, necessitating offloading from processors.

Method used

A computational module comprising a dual-ported Block RAM (BRAM) and a multiply-accumulate (MAC) unit, operated by a finite state machine, performs hybrid multiply-and-accumulate operations, allowing for efficient computation of products and sums across varying operand bit lengths, with a smaller register RAM for temporary storage and sign extension to handle multiple operations simultaneously.

Benefits of technology

This approach significantly reduces processor load by enabling rapid, accurate computation of neural network operations and digital filter sums, supporting high-frequency processing with reduced overflow risk and efficient parallelism, thereby enhancing the performance of neural networks and digital filters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US2024021244_26092024_PF_FP
    Figure US2024021244_26092024_PF_FP
Patent Text Reader

Abstract

A computational module has a weight RAM with a first W1 and a second W2 RAM data; and a multiply-and-accumulate (MAC) unit. The MAC unit has DPRAM with fewer rows than the weight RAM. The DPRAM, and MAC unit, operate under control of an FSM for a hybrid MAC operation including at least two multiplies to add W1 times a first operand plus W2 times a second operand to a sum in DPRAM. A method using the module includes: defining a table in DPRAM having zero in a first location; sign extending a first weight into a second location; sign extending a second weight into a third location; storing a sum of first and second weights in a fourth location; and sequentially receiving table indexes having a bit of each of a first operand and a second operand; and left-shifting and summing table content read using the table indexes.
Need to check novelty before this filing date? Find Prior Art

Description

APPARATUS AND METHOD FOR COMPUTE IN BRAM FOR MULTIPLY-ACCUMULATE OPERATIONSRELATED APPLICATIONS

[0001] This application claims priority to US Patent Application Serial Number 63 / 454,275, filed March 23, 2023, which is incorporated herein by reference in its entirety.BACKGROUND

[0002] Several common signal processing and machine-learning functions rely on summing products of an array of weights or coefficients by an array of data. Among these functions are both finite and infinite impulse response (FIR-DF and IIR-DF) digital filters, as illustrated in Fig. 1, where the array of data represents current and delayed input and / or output data, and neural networks as illustrated in Fig. 3 where the array of data includes network inputs or a prior state for each “neurons,” as illustrated in Fig. 2, of one or more other layers of the network.

[0003] Digital filtering often is performed in real time, requiring rapid processing particularly when high frequency signals are involved. Digital filtering often requires input word lengths of at least 8 to 12 bits, corresponding to analog-to-digital converter precision, although multiplications and summing of products may require greater word lengths. While FIR-DF designs are inherently stable, IIR-DF designs may require weights of significant precision to prevent oscillations.

[0004] Of these applications, many neural network designs have used weights of only 2, 4, or 8 bit lengths. These short weights of each “neuron” in a network layer are multiplied by values representing inputs to that layer of the network — typically inputs to the network or outputs of a previous network layer — to produce products. The products associated with each “neuron” are summed. Such designs typically accumulate the products over a longer word length than the weights. Once input-weight products are accumulated or summed over all inputs to a neuron, the result may be limited or even truncated before being passed as an input to the next layer or to a network output. Each layer of a neural network may have hundreds or thousands of “neurons”, thus each “neuron” of a layer may have hundreds or thousands of weights associated with inputs from a previous network layer, requiring a correspondingly large number of multiplications, At run time, previously-trainedneural networks are often executed many times using the same weights with different data requiring considerable computation.

[0005] Given the processor burden required for these sums of products functions, it can be desirable to offload these computations from a processor.

[0006] A BRAM is a block RAM frequently found as a component of a field- programmable gate array. FPGAs often offer single and dual-port implementations of BRAM.SUMMARY

[0007] In a first embodiment, a computational module includes: a first RAM having at least a first data port providing first data according to a first address, the RAM data comprising a first RAM data (W 1), and a second RAM data (W2); and a first multiply-and- accumulate (MAC) unit coupled to receive at least two RAM-data including the first RAM data and the second RAM. The first MAC unit includes: a second RAM of dual-ported type wherein the second RAM has fewer rows than the first RAM; and the second RAM, and the first MAC unit, are configured to operate under control of a finite state machine (FSM) to compute a hybrid multiply-and-accumulate operation comprising at least two multiply-and- accumulate (MAC) operations resulting in adding W 1 times a first operand plus W2 times a second operand to a sum in the second RAM.

[0008] In some embodiments, the computational module is used in a Digital Neural Network (DNN) accelerator.

[0009] In another embodiment, a method of executing digital neural networks (DNN) includes: placing at least a first weight word and a second weight word in a primary random-access memory (RAM); defining a table in a second memory having zero in a first location; reading and sign extending at least a first weight from the first weight word from the primary RAM into a second location of the table; reading and sign extending at least a second weight from the second weight word from the primary RAM into a third location of the table; storing a sum of the first weight and the second weight in a fourth location of the table; receiving a first table index comprising at least one bit of each of a first operand and a second operand; using the first table index to determine a selected location of the table, add the selected location of the table to a sum; receiving a second table index comprising at least one bit of each of the first operand and the second operand; and using the second index to determine a second selected location of the table, left-shift the second selected location of the table and add the left-shifted second location of the table to the sum. In this embodiment, thefirst and second operands are inputs to neurons of a layer of the DNN, the weights represent synapse weights of the DNN, and the sum becomes a sum of at least the first operand times the first weight plus the second operand times the second weight.BRIEF DESCRIPTION OF THE FIGURES

[0010] Fig. 1 is a block diagram of a common type of PRIOR ART digital filter, showing delay, multiply, and add (summation) units.

[0011] Fig. 2 is a block diagram of a “neuron” function of a common type of PRIOR ART neural network, showing multiply and add units.

[0012] Fig. 3 is a block diagram of a common type of PRIOR ART neural network using the neuron of Fig. 2.

[0013] Fig. 4 is a block diagram of a Bram Processing Element (BPE) attachable to a Block Random Access Memory (BRAM) unit of a Field Programmable Gate Array (FPGA) or a similar single or dual port Random Access Memory (RAM) of an Application-Specific Integrated Circuit (ASIC).

[0014] Fig. 5 and Fig. 6 are block diagrams of embodiments of BRAMAC units having single BPEs of Fig. 4 with single or dual-ported BRAM.

[0015] Fig. 7 is a block diagram of an embodiment of BRAMAC having two independent BPEs, with one BPE coupled to each of two ports of a BRAM.

[0016] Fig. 8 is a block diagram of a multiprocessing BRAMAC unit having four BPEs coupled to a port of a BRAM.

[0017] Fig. 9 is a block diagram of a system showing how multiple BRAMAC units may cooperate with Digital Signal Processing (DSP) units while executing a large neural network.

[0018] Fig. 10 is a flowchart representing tasks performed by a BPE in execution of a digital neural network (DNN).DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] We describe a fast, memory based, computational module that includes at least one multiply accumulate (MAC) unit also known herein as a BRAMAC unit; the module may be copied multiple times on FPGAs or other application-specific integrated circuits (ASICs). The BRAMAC includes a primary RAM, such as a BRAM of an FPGA, and a smaller register RAM that serves as an array of accumulators with a hard-coded zero row.

[0020] The BRAMAC may be implemented using a single-ported or dual-ported primary random-access memory (RAM) for most ASICs or using a dual-ported Block RAM (BRAM) as often provided for FPGAs. A smaller register RAM (also known as a “dummy BRAM” or as a MAC-Cache) is provided in the MAC unit to provide storage for partial products, products, and sums of products, as well as temporary storage for operands. In embodiments, the register RAM or MAC-Cache has fewer rows than the primary RAM thus having 20%, 10%, 8%, or 7% of the capacity or rows of the primary RAM.

[0021] In some systems, dual-ported RAM may be simulated using two cycles for each pair of operations in a single port RAM.

[0022] We define a BRAM Processing Unit, Fig. 4, which performs processing functions and is directly coupled to a BRAM, such as Intel ® (Trademark of Intel Corporation, Santa Clara, CA) M20K BRAM blocks, or an equivalent BRAM of a XILINX FPGA. The BRAMAC includes at least one BPE and the BRAM or equivalent memory itself.

[0023] The computational module is intended for use in digital neural network (DNN) systems where each layer has multiple “neurons” 200 each of which produce products of weights 202, 204, times inputs 206, 208, and sum or accumulate 210 those products as illustrated in Fig. 2; each neural network combines multiple neurons in a network 300 as illustrated in Fig. 3. There is typically an input layer of neurons, one or more hidden layers, and an output layer of neurons; in recurrent neural networks outputs of one or more neurons 320 of any one or more layers are fed back to inputs of neurons of the same or any previous layer, recurrent networks have advantage in that they can respond not only to patterns of inputs to the array, but can detect and respond to changes in input patterns.

[0024] The BRAMAC may also be used in digital filters 100 such as finite impulse response filters of the type illustrated in Fig. 1 where outputs are sums of coefficients times variously delayed input signals, in infinite impulse response filters which include a feedback section 102 where delayed outputs may be fed back into the summing unit, and in other applications requiring rapid computation of sums of products.

[0025] Prior to computing a sum of products, a selected accumulator SUMI in the register RAM is cleared, in a particular embodiment by copying a hard-coded zero in the first location of the register RAM into it, this hard-coded zero may also be a first location of a table. Weight data, including a first and second weight word, is stored 1002 (Fig. 10) in a primary weight BRAM associated with the BPE. The BPE 402 (Fig. 4) receives weight data from a word of a primary weight RAM 406, implemented as a BRAM if built on an FPGA, into a weight selection multiplexor 404. The primary weight RAM 406 is external to the BPEitself, but part of the BRAMAC. Each word from the primary weight RAM 406 may be packed to contain more than one weight or group of weights, the weight selection multiplexor 404 selects which weight or group of weights from each word is in use for a particular operation. A first selected weight from weight selection multiplexor 404 is then sign- extended to a longer word length in sign extender 408, the sign-extended result operand has length compatible with a length of a portion of an adder 414 used to accumulate products. Sign extender 408 is programmable at run time or, in FPGA embodiments at compile time, to accept and extend weights of 2, 4, 8, or in other embodiments 12 or 16 bit precision. In an alternative embodiment, sign extender 408 may receive, and sign extend, weights of mixed bit precisions — such as but not limited to simultaneously sign extending a 2 bit weight to be compatible with a first portion of adder 414, a 4 bit weight to be compatible with a second portion of adder 414, and a 6-bit weight to be sign extended to be compatible with a third portion of adder 414.

[0026] Once extended, the selected weight may be written 1006 into the dual-ported register RAM 410 as a first weight (Wl) in a second location of the table through a first port, Port A, of the register RAM. A second selected weight may also be read from the primary weight register and may be written 1008 into the dual -ported register RAM 410 as a second weight (W2) in a third location of the table through the first port, Port A, of the register RAM.

[0027] Weight W 1 and weight W2 are read simultaneously from the dual-ported register RAM 410 into adder 414 and written 1010, through a second register RAM port B, back into the register RAM as a sum of weights W2+W1 in a fourth table location, this forms a table in a first 4 words of register RAM 410 of zero, weight Wl, weight W2, and a sum of weight W 1 plus weight W2. Adder 414 and sign extender 408 may be partitioned into multiple shorter units during the addition of W1+W2 to permit several simultaneous multiply-and-add operations over shorter word lengths than the full length of adder 414.

[0028] In some embodiments, adder 414 can also perform subtraction, thereby allowing use with negative activations.

[0029] Next, a pair of activations 412 or operands Al and A2 is received 1012 as a serial sequence of bit pairs, one bit from each activation, into address logic 415 where these two bits are used to select an entry of the table in the first 4 words of the register RAM corresponding to a partial product of a bit of activation Al times weight Wl plus a partial product of a bit of activation A2 times weight W2, and brought into a first port of adder 414. Meanwhile, a selected accumulator location of register RAM containing an initial SUMA(ISUMA) is read into a second port of adder 414 and a sum of the partial products and the initial accumulator location SUMA is written 1014 back to the accumulator location SUMA. This process is repeated for subsequent bits of the activations, receiving 1016, additional table indexes and fetching table contents for addition 1018 to the accumulator SUMA, however a barrel shifter 417 provides appropriate left-shifts of the selected table entry corresponding to which bits of a 4, 6, 8, or 10-bit activation are being processed in that cycle and it is the left-shift of the selected table entry that is added to SUMA; this process continues 1020 until all bits of the activations have been processed. The result is SUMA = ISUMA + W1 * Al + W2 * A2. The process repeats 1021 for any remaining weights and activations associated with the same neuron.

[0030] The process or reading a weight, sign extending it, setting the Wl, W2, and W2+W 1 locations in register RAM, and adding partial products of bits of the activations by the weight results in the weight times the activation being added to the contents of SUMI; this process is controlled by a BPE finite state machine 420. Further, the process of reading the register RAM, shifting the selected table entry, and adding the shifted table entry to a second, accumulator, register RAM location occurs in a single clock cycle.

[0031] This process may be repeated without clearing the accumulator SUMA for subsequent weights and activations of a particular neuron until all weights and activations for the particular neuron of the neural network have been processed.

[0032] Once all weights and activations for a particular neuron of the DNN are processed, the sum SUMA may be read by a DSP and processed by thresholding or limiting as necessary to prepare an input for neurons of further layers of the DNN, or as necessary to prepare an output of the DNN.

[0033] In some embodiments, the sign extender 408 and adder 414 may be split into multiple shorter adders, thus if weights are short and sums of products are unlikely to overflow a short accumulator, the BPE can perform multiple pairs of multiply and accumulate operations simultaneously. In a particular embodiment, register RAM 410 has width 160 bits and both sign extender 408 and adder 414 can be divided into 5 sections of 32 bits, or 4 sections of 40 bits. With this embodiment, if 5 or 4 weights are packed into each of Wl and W2 and adder divided into a corresponding 5 or 4 sections, the BPE can effectively perform 8 or 10 multiplications and summations simultaneously. Similarly, in an alternate embodiment register RAM 410 has width 32 bits and both sign extender 408 and adder 414 can be divided into 2 sections of 16 bit or four sections of 8 bits; in this alternativeembodiment the BPE can effectively perform 4 or 8 multiplications and summations simultaneously. Similarly, a 64-bit wide BPE could be split to 4 16-bit sections.

[0034] The BPE is also equipped with an output multiplexor 422 that allows reading of selected register RAM locations, such as SUMI, or of primary weight RAM 406 contents, to a DSP core, through an optional buffer memory and serializer 424, to a subsequent layer of neurons in a network. In a typical embodiment, a DSP core may limit a sum to be within a predetermined minimum and maximum range before sending this sum to a further layer within the network.

[0035] A single BPE may be used with a single port of a primary weight RAM as illustrated in Fig. 5 and 6.

[0036] Many neural networks have multiple neurons in a layer that have the same sets of input activations from another layer, but with different weights for each input and neuron combination. This provides an opportunity for single-instruction, multiple-data, (SIMD) parallelism. In the embodiment 800 of Fig. 8, each word of primary weight BRAM 802 contains weights for each of four neurons, this word is provided through a duplication shuffler 804 to four BPE units, BPE- A, BPE-B, BPE-C, and BPE-D, these units operate under control of a finite state machine 806 and are coupled through an output multiplexor and DSP interface 808 to other layers or other circuitry of the system. Activations are provided through activation circuitry 810 to the four BPE units. In a particular embodiment, the activations are different for each BPE unit. In another particular embodiment, useful for neural networks having multiple neurons coupled to the same inputs with different weights, the activations are the same for all four BPEs. When BPE’s have their sign extenders and adders split as described above, four 32-bit BPEs split to 16 bit adders could effectively perform 32 multiplications simultaneously.

[0037] A dual-ported primary weight BRAM may feed BPEs through both ports. In the embodiment 700 of Fig. 7, a first port of dual-ported primary weight BRAM 702 feeds through a first set of column multiplexors or a duplication shuffler 704 to one or more BPEs 706, while a second port of dual-ported primary weight BRAM 702 feeds through a second set of column multiplexors or a duplication shuffler 708 to one or more BPEs 710. If more than one BPE is provided on each side of the dual-ported primary weight BRAM may operate as described with reference to Fig. 8 to provide simultaneous execution of multiply and add operations under control of finite state machine 712. The proposed approach is thereby extended to support N MAC units (i.e. BRAMACx N blocks. In this case, Nx BRAMACs and receive the same RAM data from the first RAM, But the multiple BRAMACs computeon different operands. E.g., BRAMAC-1 computes Si = Pi + P2 = Wi*Ii + W2*l2. BRAMAC-2 computes S2 = P3 + P4 = Wi*h + W2*l4 . . . BRAMAC-N computes SN = P2N-1 + P2N = Wl*l2N-l + W2*l2N.

[0038] In an embodiment, the first MAC unit and register RAM are clocked with 2x the frequency of the first or primary DPRAM. In another particular embodiment the number of rows in the small dummy RAM is fixed to 7.

[0039] When executing part or all of a neural network layer, weights for neurons of the layer may be placed in the primary RAM and either network inputs or outputs of a previous layer, known herein as activations, are fed in sequence to a data input of the BRAMAC unit. These activations are multiplied by weights to produce products and the weights are accumulated with sums of products stored temporarily in the register RAM. In an example 900 (Fig. 9) of a system for rapid execution of large neural networks, a first DSP 902 and one or more BRAMAC units 904, 906 serve to execute an input layer of the neural network. Outputs from BRAMAC units 904, 906 are limited by the DSP 902 and feed through in some embodiments an optional buffer RAM 908 and a serializer 910 to another one or more BRAMAC units 912 operating in conjunction with a DSP 914 that executes a hidden layer of the neural network; multiple BRAMAC units of multiple layers may be supported by each DSP. Outputs from the hidden BRAMAC units 912 feed through an optional buffer RAM 918 and serializer 916; some of these outputs may optionally feed back to BRAMAC units 912 to support recurrent neural networks or to reuse the same BRAMAC units 912 for another hidden layer of the neural network, or may couple to another set of BRAMAC units (not shown) for additional one or more hidden layers. Finally, outputs of the BRAMAC unit executing the last hidden layer of the neural network feed to a BRAMAC 920 that executes an output layer of the neural network; accumulator results are read by the DSP 922 and used to determine outputs of the system.Combinations

[0040] Various features herein described may be combined in different ways. Among combinations anticipated by the inventors are:

[0041] A computational module designated A including: a first RAM having at least a first data port providing first data according to a first address wherein the first RAM is a primary RAM configured to store at least two RAM data comprising a first RAM data (W 1), and a second RAM data (W2); and a first multiply-and-accumulate (MAC) unit coupled to receive at least two RAM-data including the first RAM data and the second RAM data. Thefirst MAC unit includes: a second RAM of dual -ported type wherein the second RAM has fewer rows than the first RAM; and the second RAM, and the first MAC unit, are configured to operate under control of a finite state machine (FSM) to compute a hybrid multiply-and- accumulate operation comprising at least two multiply-and-accumulate (MAC) operations resulting in adding W 1 times a first operand plus W2 times a second operand to a sum in the second RAM.

[0042] A computational module designated AA including the computational module designated A, where the first MAC unit is run-time configurable to operate in a plurality of operand bit lengths including a long operand bit length and a short operand bit length, the operations to form the first sum and / or the second sum and writing the second RAM forming a first set of operations.

[0043] A computational module designated AB including the computational module designated A or AA where the first MAC unit is, if configured to operate in the short operand bit length, run-time configurable to perform at least a first and a second set of operations simultaneously using different fields within the operand.

[0044] A computational module designated ABA including the computational module designated AB where the long operand length is at least 32 bits, and the short operand bit length is less than or equal to 16 bits.

[0045] A computational module designated ABB including the computational module designated ABA where the short operand bit length is 8 bits.

[0046] A computational module designated AC including the computational module designated A, AA, AB, ABA, or ABB implemented as a configurable unit of a field programmable gate array (FPGA) integrated circuit.

[0047] A computational module designated AD including the computational module designated A, AA, AB, ABA, ABB, or AC further comprising a control logic comprising at least one finite state machine (FSM).

[0048] A computational module designated AE including the computational module designated A, AA, AB, ABA, ABB, AC, or AD wherein hybrid multiply and accumulate operation comprises a plurality of addition operations, and where the first MAC unit is configured to read the second RAM and perform an addition of the plurality of addition operations in one clock cycle.

[0049] A computational module designated AF including the computational module designated A, AA, AB, ABA, ABB, AC, AD, or AE wherein the first random access memory is a dual-ported RAM (DPRAM) having a second data port providing a second RAM dataaccording to a second address, and further including at least a second MAC unit coupled to receive at least a second RAM-data from the second data port; and the second MAC unit includes: a third RAM, the third RAM of DPRAM type to receive a third RAM-data and a fourth RAM-data from the second data port; and a second multiply-and-add (MAD) unit coupled to the first and / or the third RAM; and wherein the second RAM, the first MAD unit, and a finite state machine (FSM) are configured to receive at least two RAM data comprising the first RAM data (e.g. Wl), the second RAM data (e.g. W2) and compute a hybrid multiply-and-accumulate operation comprising at least two multiply-and-accumulate (MAC) operations.

[0050] A computational module designated AG including the computational module designated A, AA, AB, ABA, ABB, AC, AD, AE, or AF further comprising a second MAC unit coupled to receive at least a third and fourth RAM-data from the first data port. In this embodiment, the second MAC unit includes a third RAM, the third RAM of DPRAM type, to receive a third RAM-data and a fourth RAM-data from the first data port; a third random access memory (RAM) having at least two data ports; and a second multiply-and- add (MAD) unit coupled to the third RAM; and wherein the third RAM, the first MAD unit, and a finite state machine (FSM) are configured to receive at least two RAM data comprising the third RAM data and the fourth RAM data and compute a hybrid multiply-and-accumulate operation comprising at least two multiply-and-accumulate (MAC) operations therefrom.

[0051] A computational module designated AH including the computational module designated A, AA, AB, ABA, ABB, AC, AD, AE, AF, or AG, wherein the first RAM is a primary RAM having a first RAM array with at least 64 physical rows (e.g. 128 rows) and the second RAM is a dummy RAM having a second RAM array with less than 20 physical rows.

[0052] A Digital Neural Network (DNN) accelerator designated B comprising at least one computational module designate A, AA, AB, ABA, ABB, AC, AD, AE, AF, AG, or AH.

[0053] A DNN accelerator including the DNN accelerator designated B wherein there are at least two computational modules.

[0054] A method designated C of executing digital neural networks (DNN) includes: placing at least a first weight word and a second weight word in a primary randomaccess memory (RAM); defining a table in a second memory having zero in a first location; reading and sign extending at least a first weight from the first weight word from the primary RAM into a second location of the table; reading and sign extending at least a second weightfrom the second weight word from the primary RAM into a third location of the table; storing a sum of the first weight and the second weight in a fourth location of the table; receiving a first table index comprising at least one bit of each of a first operand and a second operand; using the first table index to determine a selected location of the table, add the selected location of the table to a sum; receiving a second table index comprising at least one bit of each of the first operand and the second operand; and using the second index to determine a second selected location of the table, left-shift the second selected location of the table and add the left-shifted second location of the table to the sum. In this embodiment, the first and second operands are inputs to neurons of a layer of the DNN, the weights represent synapse weights of the DNN, and the sum becomes a sum of at least the first operand times the first weight plus the second operand times the second weight.

[0055] A method of evaluating a DNN including the method designated C wherein the first and second weight word each comprise a plurality of weights, and where each location of the table stores a plurality of weights.

[0056] A method of evaluating a DNN including the method designated C or CA further including: placing at least a third weight word and a fourth weight word in a primary random-access memory (RAM); defining a second table in a third memory having zero in a first location; reading and sign extending at least a third weight from the third weight word from the primary RAM into a second location of the table; reading and sign extending at least a fourth weight from the fourth weight word from the primary RAM into a third location of the table; storing a sum of the third weight and the fourth weight in a fourth location of the table; receiving a third table index comprising at least one bit of each of a third operand and a fourth operand simultaneously with receiving the first table index; using the third table index to determine a second selected location of the table, add the second selected location of the table to a second sum; receiving a fourth table index comprising at least one bit of each of the third operand and the fourth operand; and using the fourth index to determine a fourth selected location of the table, left-shift the fourth selected location of the table and add the left-shifted fourth location of the table to the second sum.

[0057] Changes may be made in the above systems and methods without departing from the scope hereof. It should thus be noted that the matter contained in the above description and shown in the accompanying drawings should be interpreted as illustrative and not in a limiting sense. The following claims are intended to cover generic and specific features described herein, as well as all statements of the scope of the present systems and methods, which, as a matter of language, might be said to fall therebetween.

Claims

CLAIMSWhat is claimed is:

1. A computational module comprising: a first random-access memory (RAM) having at least a first data port wherein the first RAM is a primary RAM configured to store at least a first RAM data (Wi), and a second RAM data (W2); a first multiply-and-accumulate (MAC) unit coupled to receive RAM-data including at least the first RAM data and the second RAM data, the first MAC unit comprising: a second RAM, the second RAM being a dual-ported random access memory (DPRAM); wherein the second RAM has fewer rows than the first RAM; and an adder; wherein the second RAM, and the first MAC unit, are configured to compute a hybrid multiply-and-accumulate operation comprising at least two multiply-and- accumulate (MAC) operations resulting in adding W 1 times a first operand plus W2 times a second operand to a sum in the second RAM.

2. The computational module of claim 1, where the first MAC unit is run-time configurable to operate in a plurality of operand bit lengths including a long operand bit length and a short operand bit length, the operations to form the first sum and / or the second sum and writing the second RAM forming a first set of operations.

3. The computational module of claim 2 where the first MAC unit is, if configured to operate in the short operand bit length, run-time configurable to perform at least a first and a second set of operations simultaneously using different fields within the operand.

4. The computational module of claim 3 where the long operand length is at least 32 bits, and the short operand bit length is less than or equal to 16 bits.

5. The computational module of claim 4 where the short operand bit length is 8 bits.

6. The computational module of claim 3 implemented as a configurable unit of a field programmable gate array (FPGA) integrated circuit.

7. The computational module of claim 3, further comprising a control logic comprising at least one finite state machine (FSM) configured to control the computational module.

8. The computational module of claim 3 wherein hybrid multiply and accumulate operation comprises a plurality of addition operations, and where the first MAC unit is configured to read the second RAM and perform an addition of the plurality of addition operations in one clock cycle.

9. The computational module of any one of claims 1-8 wherein the first random access memory is a dual-ported RAM (DPRAM) having a second data port providing a second RAM data according to a second address, and further comprising a second MAC unit coupled to receive at least a second RAM-data from the second data port; the second MAC unit comprising: a third RAM, the third RAM being a dual-ported random access memory (DPRAM), to receive a third RAM-data and a fourth RAM-data from the second data port using two memory read cycles; wherein the third RAM, the second MAC unit, and a finite state machine (FSM) are configured to receive at least two RAM data comprising the third RAM data, the fourth RAM data and compute a hybrid multiply-and- accumulate operation comprising at least two multiply-and-accumulate (MAC) operations.

10. The computational module of any one of claims 1-8, further comprising a second MAC unit coupled to receive at least a second RAM-data from the first data port; the second MAC unit comprising: a third RAM, the third RAM of DPRAM type, to receive a third RAM-data and a fourth RAM-data from the first data port; a third random access memory (RAM) having at least two data ports; and a second multiply-and-add (MAD) unit coupled to the third RAM; and wherein the third RAM, the first MAD unit, and a finite state machine (FSM) are configured to receive at least two RAM data comprising the third RAM data and the fourth RAM data and compute a hybrid multiply-and-accumulate operation comprising at least two multiply-and-accumulate (MAC) operations therefrom.

11. The computational module of claims 10, wherein the first RAM is a primary RAM having a first RAM array with at least 64 physical rows (e.g. 128 rows) and the second RAM is a dummy RAM having a second RAM array with less than 20 physical rows.

12. A Digital Neural Network (DNN) accelerator comprising at least one computational module of any one of claims 1-8.

13. The DNN accelerator of claim 12 wherein there are at least two computational modules.

14. A method of executing digital neural networks (DNN) comprising: placing at least a first weight word and a second weight word in a primary randomaccess memory (RAM); defining a table in a second memory having zero in a first location; reading and sign extending at least a first weight from the first weight word from the primary RAM into a second location of the table; reading and sign extending at least a second weight from the second weight word from the primary RAM into a third location of the table; storing a sum of the first weight and the second weight in a fourth location of the table; receiving a first table index comprising at least one bit of each of a first operand and a second operand; using the first table index to determine a selected location of the table, add the selected location of the table to a sum; receiving a second table index comprising at least one bit of each of the first operand and the second operand; and using the second index to determine a second selected location of the table, left-shift the second selected location of the table and add the left-shifted second location of the table to the sum; wherein the first and second operands are inputs to neurons of a layer of the DNN, the weights represent synapse weights of the DNN, and the sum becomes a sum of at least the first operand times the first weight plus the second operand times the second weight.

15. The method of claim 14 wherein the first and second weight word each comprise a plurality of weights, and where each location of the table stores a plurality of weights.

16. The method of claim 15 or 14 further comprising: placing at least a third weight word and a fourth weight word in a primary randomaccess memory (RAM); defining a second table in a third memory having zero in a first location; reading and sign extending at least a third weight from the third weight word from the primary RAM into a second location of the table; reading and sign extending at least a fourth weight from the fourth weight word from the primary RAM into a third location of the table; storing a sum of the third weight and the fourth weight in a fourth location of the table; receiving a third table index comprising at least one bit of each of a third operand and a fourth operand simultaneously with receiving the first table index; using the third table index to determine a second selected location of the table, add the second selected location of the table to a second sum; receiving a fourth table index comprising at least one bit of each of the third operand and the fourth operand; and using the fourth index to determine a fourth selected location of the table, left-shift the fourth selected location of the table and add the left-shifted fourth location of the table to the second sum.