Signed multiplication using unsigned multiplier with dynamic fine-grained operand isolation

An N×N multiplier may include a N/2×N first multiplier, a N/2×N/2 second multiplier, and a N/2×N/2 third multiplier. The N×N multiplier receives two operands to multiply. The first, second and/or third multipliers are selectively disabled if an operand equals zero or has a small value. If the operands are both less than 2N/2, the second or the third multiplier are used to multiply the operands. If one operand is less than 2N/2 and the other operand is equal to or greater than 2N/2, the first multiplier is used or the second and third multipliers are used to multiply the operands. If both operands are equal to or greater than 2N/2, the first, second and third multipliers are used to multiply the operands.

TECHNICAL FIELD

The subject matter disclosed herein generally relates to computational circuits. More specifically, the subject matter disclosed herein relates to an unsigned multiplier that performs signed and unsigned multiplication.

BACKGROUND

Neural-network models typically have many weights that are zeros (e.g., 50%) and many activations are zeros (e.g., 50%-90%). Accordingly, power may be saved by not performing any multiply-by-zero operations. Additionally, the absolute values of the weights and the activations of neural-network models are typically close to zero. For example, typically 95% of non-zero 8-bit multiply operations includes at least one operand having abs (w)≤15 or abs(a)≤15. Power may also be saved by taking advantage of the absolute values of the weights and activations that are close to zero.

SUMMARY

An example embodiment provides a multiplier may include an N-bit×N-bit multiplier and a control circuit. The N-bit×N-bit multiplier may receive a first operand that may include N bits and a second operand that may include N bits, and the N-bit×N-bit multiplier may include a first multiplier and a second multiplier. The first multiplier may include an N/2-bit×N-bit multiplier and the second multiplier may include an N/2-bit×N-bit multiplier. The control circuit may be coupled to the first and second operands and may disable the first and second multipliers if the value of the first operand or the value of the second operand equals zero. The control circuit may further control the second multiplier to multiply the first operand and the second operand if the absolute value of the first operand or the absolute value of the second operand is less than 2N/2. The control circuit may also control the first multiplier and control the second multiplier to multiply the first operand and the second operand if the absolute values of both the first and second operands are equal to or greater than 2N/2. In one embodiment, the second multiplier may include a third multiplier and a fourth multiplier in which the third multiplier may be an N/2-bit×N/2-bit multiplier and the fourth multiplier may be an N/2-bit×N/2-bit multiplier. The control circuit may further control the third multiplier or the fourth multiplier to multiply the first operand and the second operand if the absolute values of the first operand and the second operand are both less than 2N/2, and the control circuit may further control the first multiplier and control the third and fourth multiplier to multiply the first operand and the second operand if the absolute value of one operand of the first and second operands is less than 2N/2and the absolute value of the other operand of the first and second operands is equal to or greater than 2N/2. Furthermore, the smaller multipliers, such as the third or fourth multipliers, may be further recursively subdivided into a pair of multipliers following same steps as above.

Another example embodiment provides a method to multiply a first operand and a second operand that may include: receiving at an N-bit×N-bit multiplier a first operand and a second operand, the first operand comprising N-bits and the second operand comprising N-bits, the N-bit×N-bit multiplier comprising a first multiplier and a second multiplier, the first multiplier comprising an N/2-bit×N-bit multiplier and the second multiplier comprising an N/2-bit×N-bit multiplier; determining whether a value of the first operand equals zero, is less than or equal to 2N/2, or is greater than 2N/2N/2 bits; determining whether a value of the second operand equals zero, is less than or equal to 2N/2, or is greater than 2N/2; disabling the first and second multipliers if the value of the first operand or the value of the second operand equals zero; controlling the second multiplier to multiply the first operand and the second operand if the absolute value of the first operand or the absolute value of the second operand is less than 2N/2; and controlling the first multiplier and the second multiplier to multiply the first operand and the second operand if the absolute values of both the first and second operands are equal to or greater than 2N12.

Still another example embodiment provides a multiplier that may include an N-bit×N-bit multiplier and a controller. The N-bit×N-bit multiplier may receive a first operand comprising N bits and a second operand comprising N bits. The N-bit×N-bit multiplier may include a first multiplier and a second multiplier in which the first multiplier may include a P-bit×N-bit multiplier and the second multiplier that may include a Q-bit×N-bit multiplier in which P and Q are integers, P+Q=N and P> Q. The control circuit may be coupled to the first and second operands, the circuit may disable the first and second multipliers if a value of the first operand or a value of the second operand equals zero. The control circuit may further control the second multiplier to multiply the first operand and the second operand if the absolute value of the first operand or the absolute value of the second operand is less than 2Q. The control circuit may control the first multiplier and may control the second multiplier to multiply the first operand and the second operand if the absolute values of both the first and second operands are equal to or greater than 2Q. In one embodiment, the second multiplier may include a third multiplier and a fourth multiplier in which the third multiplier may include an R-bit×Q-bit multiplier and the fourth multiplier may include an S-bit×Q-bit multiplier in which R and S are integers, R+S=Q and R> S. The control circuit may further control the third multiplier or the fourth multiplier to multiply the first operand and the second operand if the absolute values of the first operand and the second operand are both less than 2S, and the control circuit may further control the first multiplier or may control the third and fourth multiplier to multiply the first operand and the second operand if the absolute value of one operand of the first and second operands is less than 2Sand the absolute value of the other operand of the first and second operands is equal to or greater than 2S.

DETAILED DESCRIPTION

In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the disclosure. It will be understood, however, by those skilled in the art that the disclosed aspects may be practiced without these specific details. In other instances, well-known methods, procedures, components and circuits have not been described in detail not to obscure the subject matter disclosed herein.

Reference throughout this specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment disclosed herein. Thus, the appearances of the phrases “in one embodiment” or “in an embodiment” or “according to one embodiment” (or other phrases having similar import) in various places throughout this specification may not be necessarily all referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments. In this regard, as used herein, the word “exemplary” means “serving as an example, instance, or illustration.” Any embodiment described herein as “exemplary” is not to be construed as necessarily preferred or advantageous over other embodiments. Also, depending on the context of discussion herein, a singular term may include the corresponding plural forms and a plural term may include the corresponding singular form. It is further noted that various figures (including component diagrams) shown and discussed herein are for illustrative purpose only, and are not drawn to scale. Similarly, various waveforms and timing diagrams are shown for illustrative purpose only. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, if considered appropriate, reference numerals have been repeated among the figures to indicate corresponding and/or analogous elements.

The terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting of the claimed subject matter. As used herein, the singular forms “a,” “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. The terms “first,” “second,” etc., as used herein, are used as labels for nouns that they precede, and do not imply any type of ordering (e.g., spatial, temporal, logical, etc.) unless explicitly defined as such. Furthermore, the same reference numerals may be used across two or more figures to refer to parts, components, blocks, circuits, units, or modules having the same or similar functionality. Such usage is, however, for simplicity of illustration and ease of discussion only; it does not imply that the construction or architectural details of such components or units are the same across all embodiments or such commonly-referenced parts/modules are the only way to implement the teachings of particular embodiments disclosed herein.

The term “module,” as used herein, refers to any combination of software, firmware and/or hardware configured to provide the functionality described herein in connection with a module. The software may be embodied as a software package, code and/or instruction set or instructions, and the term “hardware,” as used in any implementation described herein, may include, for example, singly or in any combination, hardwired circuitry, programmable circuitry, state machine circuitry, and/or firmware that stores instructions executed by programmable circuitry. The modules may, collectively or individually, be embodied as circuitry that forms part of a larger system, for example, but not limited to, an integrated circuit (IC), system on-chip (SoC) and so forth.

The subject matter disclosed herein provides an unsigned multiplier to perform signed and unsigned multiplication. Additionally, the subject matter disclosed herein provides a multiplier in which sections of the multiplier may be disabled or powered down if a multiply-by-a-small number condition or a multiply-by-zero condition is detected, thereby reducing the amount of power used during a multiply operation. Thus, the subject matter disclosed herein may take advantage of the fact that the weights and activations of a neural network may be small or zero in order to reduce the power used by a multiplier when multiplying the weights and activations.

Although some multiplier embodiments disclosed herein are configured as N×N multipliers, the subject matter disclosed herein is not so limited. Some multiplier embodiments according to the subject matter disclosed herein may be configured as N×M multipliers in which N=M or N≠M.

FIG. 1depicts a functional block diagram of an example embodiment of a multiplier100according to the subject matter disclosed herein. The multiplier100computes product po of ain and bin in which ain may be signed or unsigned, bin may be signed or unsigned and the product po may be signed or unsigned. The output po is signed if the resulting product is negative. The multiplier100includes an input converter101, an 8-bit×8-bit unsigned multiplier102and an output converter103. The input converter101receives two 8-bit operands ain[7:0] and bin[7:0] and a 1-bit type signal for each operand. If an operand is an unsigned operand, the 1-bit type signal equals 0, and if an operand is a signed operand, the 1-bit type signal represents the sign of the operand. The input converter101outputs the two operands as unsigned ai[7:0]:=abs(ain[7:0]) and unsigned bi[7:0]:=abs(bin[7:0]) to the unsigned multiplier102. The input converter101also outputs a p_sign signal that indicates the sign of the resulting product: p_sign:=sign(ain) xor sign(bin). Sign(ain) is 1 if ain is signed and negative and 0 otherwise. Sign(bin) is 1 if bin is signed and negative and 0 otherwise. The unsigned multiplier102multiplies the two unsigned input operands ai[7:0] and bi[7:0] and outputs a 16-bit product signal p[15:0]. The output converter103converts the 16-bit unsigned product signal p[15:0] to an output signal po[15:0] that can be signed or unsigned, depending on the p_sign signal. Specifically, po:=−p if p_sign==1, otherwise po:=p.

In one embodiment, the input converter101, the multiplier102and/or the output converter103may be or may include one or more modules that provide the functionality of the device. For example, in one embodiment, the input converter101, the multiplier102and/or the output converter103may include hardware logic circuits to perform some or all of the functionality of the device. As another example, another embodiment may include a processor (not shown) that executes software and/or firmware that may provide the functionality provided by the converter101, the multiplier102and/or the converter103.

Although the multiplier102is depicted as an 8-bit×8-bit multiplier, the subject matter disclosed herein is not limited to 8-bit×8-bit multipliers. In other embodiments, the multiplier102may be embodied as a signed or an unsigned 16-bit×16-bit multiplier, as a signed or an unsigned 16-bit×8-bit multiplier, as a signed or an unsigned 8-bit×8-bit multiplier that may use multi-cycling, i.e., using multiple clock cycles to generate and accumulate partial products, such as two clock cycles to complete a 16-bit×8-bit or 8-bit×16-bit signed or unsigned multiplication or four clock cycles to complete a 16-bit×16-bit signed or unsigned multiplication. In one embodiment, the multiplier102may be configured to be two 4-bit×8-bit multipliers in which one of the 4-bit×8-bit multipliers may be configured to be two 4-bit×4-bit multipliers. In still another embodiment, the multiplier102may be subdivided recursively into halves, for example, a 16-bit×16-bit multiplier may be divided into two 16-bit×8-bit multipliers in which one 16-bit×8-bit multiplier may be further divided into two 8-bit×8-bit multipliers, in which one of the 8-bit×8-bit multipliers may be divided into two 4-bit×4-bit multipliers. Further, a multiplier may be divided in an uneven manner to form, for example, an 8-bit×5-bit multiplier and an 8-bit×3-bit multiplier from an 8-bit×8-bit multiplier.

FIG. 2depicts an example embodiment of the multiplier102configured as two 4-bit×8-bit multipliers201and202according to the subject matter disclosed herein. Additionally, the multiplier202may be configured as two 4-bit×4-bit multipliers203and204. The configuration depicted inFIG. 2allows the multiplier102to receive and perform a multiply operation using two 8-bit operands. If one of the 8-bit operands has absolute value that is less than or equal to 15, it can be treated as a 4-bit operand and the 8-bit other operand has its absolute value that is greater than 15 and is treated as an 8-bit operand, then the multiplier201may be controlled to receive the two operands and perform a 4-bit×8-bit multiply. In such a situation, the multiplier202(i.e., multipliers203and204) may be disabled by, for example, fixing, or “freezing,” the inputs to the multiplier(s) to prevent the logic of the multiplier from toggling or by powering down the multiplier(s), thereby reducing the amount of power used during the multiply operation. In an alternative configuration, the multiplier202may be used to perform the 4-bit×8-bit multiply operation, while the multiplier201may be powered down or made non-operative during the multiply operation. In still another embodiment, each of the multiplier201and the multiplier202may be formed from two 4-bit×4-bit multipliers.

If both of the operands are 4-bit operands—that is absolute values of both 8-bit inputs are less than or equal to 15—then one of the 4-bit×4-bit multipliers203or204may be controlled to receive the operands while the unused 4-bit×4-bit multiplier and the multiplier201may be powered down or made non-operative during the multiply operation.

If both of the operands are 0, then the multiplier102may be disabled or powered down during the multiply operation, as described in more detail below.

FIG. 3depicts a functional block diagram of an example embodiment of the multiplier102when configured and operated as an 8-bit×8-bit multiplier using two 4-bit×8-bit multipliers (FIG. 2) according to the subject matter disclosed herein. The 4-bit×8-bit multiplier201and the 4-bit×8-bit multiplier202respectively receive a first 8-bit operand ai[7:0] and a second 8-bit operand bi[7:0]. The multiplier201also receives lower 4 bits ai[3:0] of input ai[7:0], while multiplier202also receives upper 4 bits of ai[7:4] or input ai[7:0]. The operand ai[7:0] may, for example, represent the value of a weight, and the operand bi[7:0] may represent the value of an activation. The multiplier201outputs a product p1[11:0] and the multiplier202outputs a product p2[11:0]. The product p2[11:0] is shifted up by 4 bits (i.e., shifted by 4 bits to the left) by a shift circuit301. An adder302adds the output of multiplier201and the output of the shift circuit301to form an output p[15:0]. The output p[15:0] may correspond to the p[15:0] output inFIG. 1.

In a situation in which ain has a small value that can be represented by a 4-bit unsigned number (i.e., ai≤15) and bin has a large value (i.e., bi≥15), multiplier201alone is sufficient to compute the product, while multiplier202can be disabled and its output set to zero. Such a situation may occur if a neural network uses the Rectified Linear Unit (ReLU) activation function.

In a situation in which bin has a small value that can be represented by a 4-bit unsigned number (i.e., bi≤15) and a weight has a large value (i.e., ai≥15), the operands may be swapped so that the small-value bin operand is again input to the 4-bit input of the multiplier201, while multiplier202is kept disabled and its output set to zero. Such a situation may occur if a neural network uses a tan h( ) activation function instead of a Rectified Linear Unit (ReLU) activation function.

FIG. 4depicts a functional block diagram of an example embodiment of the multiplier102when one operand is small and the other operand is large according to the subject matter disclosed herein. As depicted inFIG. 4, the multiplier102includes a swap-operand circuit400. The swap-operand circuit400includes a first multiplexer401, a second multiplexer402and a swap-operand detection circuit403. The swap-operand detection circuit403receives the input operands ai[7:0] and bi[7:0] and detects whether two operands should be swapped based on their magnitudes.

If, for example, an activation input bi[7:0] has a small value that fits into 4 bits (i.e., bi≤15), and a weight input ai[7:0] has a large value (i.e., ai>15), the swap-operand detection circuit403controls the first and second multiplexers401and402so that the activation input bi[7:0] is output from the first multiplexer401as a[7:0] and so the weight input ai[7:0] is output from the second multiplexer402as b[7:0]. The multiplier201multiplies the activation a[3:0] and the weight b[7:0]. One input to the multiplier202is an operand that equals 0 (i.e., a[7:4]=0), so the multiplier202may be controlled to be disabled or powered down, as described in more detail below.

As another example, if a weight input ai[7:0] is small, and an activation bi[7:0] is large, the swap-operand detection circuit403controls the first and second multiplexers401and402so that the weight input ai[7:0] is output from the first multiplexer401as a[7:0] and so the activation input bi[7:0] is output from the second multiplexer402as b[7:0]. The multiplier201multiplies the weight a[3:0] and the activation b[7:0]. One input to the multiplier202is an operand that equals 0 (i.e., a[7:4]=0), so the multiplier202may be controlled to be disabled or powered down, as described in more detail below.

Table 1 sets forth a truth table that may be used by the swap-operand detection circuit400, in which “x” means “don't care” and “!” means “not.” In one embodiment, when Swap Operands=0 or 1 (not x), power may be saved by disabling multiplier202and setting its output to zero. When Swap Operands=x, it is recommended to keep Swap Operands value from the previous clock cycle to reduce power consumption.

When the multiplier202has been disabled, or idled, and its output is set to zero, the adder302performs a trivial operation of adding a zero. The multiplier102may be configured to utilize the adder302to perform a 5-bit×8-bit multiplication as opposed to 4-bit×8-bit multiplication. Additionally, the logic of the swap-operand circuit400may be configured to not swap the operands if the operand a is effectively 5 bits or less, as opposed to 4 bits or less.

FIG. 5depicts a functional block diagram of an example embodiment of the multiplier201that has been configured to operate as a 5-bit×8-bit multiplier according to the subject matter disclosed herein. As depicted inFIG. 5, a multiplexer501and an NAND gate502may be added to the multiplier201. One input to the multiplexer501is 11 bits in which the four most significant bits are Os and the eight least significant bits (LSBs) are b[7:0]. The other input to the multiplexer501is the output of the multiplier202. Bit a[4] is applied to one input of the NAND gate502and the other input of the NAND gate502receives an isIdle signal that may be output from the multiplier202when the multiplier202has been disabled, or idle. In an alternative embodiment, the isIdle signal may be generated elsewhere if the multiplier202has been disabled. The isIdle signal is 1 when multiplier202is expected to perform a multiply-by-zero operation, that is when a[7:5]=0 or b[7:0]=0.

When the operand a[7:0] has a five-bit value (i.e., a[4]=1 and a[7:5]=0), the multiplier202is disabled because the operand a[7:5]=0, the NAND gate502controls the multiplexer501to select the 11-bit input {0000,b[7:0]}. If the operand a[7:5]≠0, then the multiplier is not disabled and the output of the multiplier202is selected by the multiplexer501.

If the operand a[7:0] is nonzero, but includes LSBs that are equal to zero, the operand may be shifted down, or to the right, so that the operands may be multiplied using the 5-bit×8-bit multiplier configuration depicted inFIG. 5. For example, if a[7:0]=“01010100”, a[7:5]≠0 and 5-bit by 8-bit multiplication shown inFIG. 5cannot be used. However, a[7:0] can be shifted 2 bits down to value of “00010101”, multiplied using 5-bit by 8-bit multiplier and the resulting product can be shifted back up 2 bits to compensate for the input shift. In this case, the multiplier201may be used while idling multiplier202to compute the product in some cases even when input a is larger than 5 bits (i.e. a>31).

FIG. 6depicts a functional block diagram of an example embodiment of the multiplier201when configured to shift the bits of the operand a[7:0] down, or to the right, so that the operands may be multiplied by a 5-bit×8-bit multiplier according to the subject matter disclosed herein. As depicted inFIG. 6, a shift-detect circuit601, a shift-down circuit602and a shift-up circuit603are added to the multiplier201. The shift-detect circuit601detects whether the LSBs of the operand a[7:0] are zeros. In one embodiment, a maximum of four LSBs may be detected as being zero, however, because values with large absolute magnitude tend to be rare in neural network computations, the amount of input down-shift can be limited to 1 or 2 bits to decrease hardware area without significant loss of power efficiency. The shift-detect circuit601controls the shift-down circuit602and the shift-up circuit603to be operable if LSBs of the operand a[7:0] are detected to be zeros. The bit a[4] of the shifted operand a is input to the NAND gate502. The isIdle signal in multiplier202will be additionally active when a[7:5]=0 and the amount of shift is 1 bit or a[7:6]=0 and the amount of shift is 2 bits or a[7]=0 and the amount of shift is 3 bits and 1 if the amount of shift is 4 bits.

In one embodiment, a 4-bit×8-bit multiplier (i.e., multiplier201and/or multiplier202inFIG. 3) may be further subdivided and configured as two halves, each being a 4-bit×4-bit multiplier in a manner similar to how 8-bit×8-bit multiplier was subdivided into two halves, each being a 4-bit×8-bit multiplier. For example, the 4-bit×8-bit multiplier201may be configured as two 4-bit×4-bit multipliers.

FIG. 7depicts a functional block diagram of an example embodiment of the multiplier201when configured and operated as two 4-bit×4-bit multipliers701and702according to the subject matter disclosed herein. As depicted inFIG. 7, the multiplier201receives a 4-bit operand ai[3:0] and an 8-bit operand bi[7:0]. The operand ai[3:0] may, for example, represent a weight, and the operand bi[7:0] may represent an activation. The multiplier701outputs a product p1[7:0] and the multiplier702outputs a product p2[7:0]. The product p2[11:0] is shifted up by 4 bits by a shift circuit703, and an adder704adds the output of the multiplier701and the output of the shift circuit703to form an output p[ 11:0]. It should be understood that in an alternative embodiment, the multiplier202(FIG. 2) may be configured as the two 4-bit×4-bit multipliers701and702.

The multiplier configuration depicted inFIG. 7may be configured to operate as a 4-bit×5-bit multiplier, while one of the 4-bit×4-bit multipliers is kept idle for power reduction purposes.

FIG. 8depicts a functional block diagram of an example embodiment of the multiplier201when configured to operate as a 4-bit×5-bit multiplier according to the subject matter disclosed herein. As depicted inFIG. 8, a multiplexer801and an NAND gate802may be added to the multiplier201. One input to the multiplexer801is 8 bits in which the four most significant bits are Os and the four least significant bits (LSBs) are operand a[3:0]. The other input to the multiplexer801is the output of the multiplier702. Bit b[4] is applied to one input of the NAND gate802and the other input of the NAND gate802receives an isIdle signal that is output from the multiplier702when the multiplier702has been made non-operative, or idle. In an alternative embodiment, the isIdle signal may be generated elsewhere. The isIdle signal is 1 when multiplier702is expected to perform a multiply-by-zero operation, that is when a[3:1]=0 or b[7:4]=0.

If the operand b[7:0] is nonzero, but includes LSBs that are equal to zero, the operand may be shifted down, or to the right, so that the operands may be multiplied using the 4-bit×5-bit multiplier configuration depicted inFIG. 8, while partial product p1is shifted up to compensate for the input downshift and multiplier702stays idle.

FIG. 9depicts a functional block diagram of an example embodiment of the multiplier201when configured to shift the bits of the operand b[7:0] down, or to the right, so that the operands may be multiplied by a 4-bit×5-bit multiplier according to the subject matter disclosed herein. As depicted inFIG. 9, a shift-detect circuit901, a shift-down circuit902and a shift-up circuit903are added to the multiplier201. The shift-detect circuit901detects whether the LSBs of the operand b[7:0] are zeros. In one embodiment, a maximum of four LSBs may be detected as being zero, however, because values with large absolute magnitude tend to be rare in neural network computations, the amount of input down-shift can be limited to 1 or 2 bits to decrease hardware area without significant loss of power efficiency. The shift-detect circuit901controls the shift-down circuit902and the shift-up circuit903to be operable if LSBs of the operand b[7:0] are detected to be zeros. The bit b[4] of the shifted operand b is input to the NAND gate502. The isIdle signal in multiplier702will be additionally active when bd[7:5]=0 and the amount of shift is 1 bit or bd[7:6]=0 and the amount of shift is 2 bits or bd[7]=0 and the amount of shift is 3 bits and 1 if the amount of shift is 4 bits.

FIG. 10depicts a functional block diagram of an example embodiment of an operand-isolation-enabled (OI) multiplier such as102,201-204,701and701with a zero-detect circuit1000that may be used to control a multiplier MULT to be disabled if an operand that is input to the multiplier is detected to be zero according to the subject matter disclosed herein. The multiplier MULT may be any of the various architectures known in the art.

The zero-detect circuit1000may include three NOR gates1001-1003, an AND gate1004, three registers1005-1007, and an output AND gate1008. All of the bits of a first operand a are input to a first NOR gate1001and to an input of a first register1005. All of the bits of a second operand b are input to a second NOR gate1002and to an input of a second register1006. As depicted inFIG. 10, the first operand a and the second operand b each represent the entire operand, i.e., all of the bits of the operand. If the operand a is equal to zero, the first NOR gate1001outputs a logic high signal. Similarly, if the operand b is equal to zero, the second NOR gage1002outputs a logic high signal. The outputs of the first and second NOR gates1001and1002are input to the third NOR gate1003. The output of the third NOR gate1003is a logic low if either the operand a or the operand b is equal to zero. A logic low output from the third NOR gate1003forces the ce signal low thus disabling the first operand a and the second operand b from respectively registering in the first and second registers1005and1006.

If one or both of the operands a and b are equal to zero, the outputs of the first and second registers1005and1006do not change and the inputs to the multiplier MULT are fixed, or frozen and thus do not consume dynamic power. The register1007also registers that a logic low has been output from the third NOR gate1003, which disables an output from the AND gate1008. Thus, the logic of the multiplier MULT has been disabled from toggling, thereby reducing the amount of power used during the multiply operation. In another embodiment, the zero-detect circuit1000alternatively or additionally control power applied to the multiplier MULT.

If both the first operand a and the second operand b are not equal to zero, the AND gate1004allows the ce signal to respectively enable registering the first and second operands into the first and second registers1005and1006. The multiplier MULT performs a multiply operation using the first operand a and the second operand b. The register1007also registers that a logic high has been output from the third NOR gate1003, thereby enabling the AND gate1008to pass the output from the multiplier MULT.