Field of the Invention
The present invention relates generally to full-adder circuits.
Background
Prior art microprocessors commonly implement a y-bit full-adder ("FA") as part of an execution unit to generate a y-bit branch address during an address branch instruction operation. Additionally, the execution unit also includes a y-bit incrementer to operate as a program counter ("PC") for generating a next y-bit PC address as a next execution address. For example, as illustrated in FIG. 1, a 44-bit FA 20 receives an input 44-bit current PC 31, Current.sub.-- PC 43 . . . 0!, which is added to a 44-bit sign extended offset 22, Ext.sub.-- Offset 43 . . . 0!, to generate an output 44-bit branch address 24, Branch.sub.-- Addr 43 . . . 0!. An adder carryout bit 23, Addr.sub.-- CO, is also provided as an output of the FA 20 to provide overflow information. Sign extended offset 22 typically comprises a 16-bit word offset portion comprising input bits Ext.sub.-- Offset 15 . . . 0!, and a 28bit word sign extended portion comprising Ext.sub.-- Offset 43 . . . 16! . The remaining 28 bits, Ext.sub.-- Offset 43 . . . 16!, are typically set to correspond to a logical value of bit Ext.sub.-- Offset <15>, such that, e.g., if Ext.sub.-- Offset<15>is equivalent to a logical "1", every bit of the set of bits Ext.sub.-- Offset 43 . . . 16! is set equivalent to a logical "1", and if Ext.sub.-- Offset<15>is equivalent to a logical "0", every bit of the set of bits Ext.sub.-- Offset 43 . . . 16! is set equivalent to a logical "0"to thereby provide a full 44-bit word to an input of the 44-bit FA 20. Incrementer 30 operates as a 44-bit program counter to increment a 44-bit input PC 31, Current.sub.-- PC 43 . . . 0!, and to provide a 44-bit output PC 32, Next.sub.-- PC 43 . . . 0!, together with an output increment carryout bit 33.
A y-bit full adder, a y-bit incrementer (and a y-bit decrementer) are well known basic circuits commonly used in the art of circuit design, and it is also well known that, of these circuits, the full adders are slower and more complicated and thus require more real estate to implement on an integrated circuit than a basic incrementer or a decrementer circuit. However, because advanced microprocessor are increasingly designed with more functions, while still required to minimize real estate, there is therefore a need to provide an efficient means to include the functionality of both the full-adder circuit and the incrementer, while reducing the real estate consumption to provide these combined functions.
Summary of the Invention
A compact dual function adder circuit is provided which couples an incrementer circuit with a combined adder circuit to generate an addition operation for adding an input m-bit word to an input n-bit word, wherein m<n, and an increment operation for incrementing the input n-bit word. The dual function adder comprises a n-bit incrementer circuit, the n-bit incrementer including a first m-bit incrementer and a second n-m)-bit incrementer to provide a n-bit incrementer output sum. The n-bit incrementer output sum comprises an m-bit incrementer output sum from the m-bit incrementer and a n-m)-bit incrementer output sum from the (n-m)-bit incrementer. The dual function adder also comprises a combined adder circuit, the combined adder comprising a first m-bit full-adder, a (n-m)-bit decrementer, and an adder select logic circuit, wherein the adder select logic receives an adder carryout bit from the m-bit full-adder and a bit<15>of the input m-bit word to control an operation of the adder select logic to generate either an increment operation, a decrement operation, or a bypass operation.
Brief Description of the Figures
FIG. 1 illustrates a typical block diagram of a program counter incrementer and an address branch full adder;
FIG. 2 illustrates a block diagram of a dual function adder provided in accordance with the principles of this invention;
FIGS. 3 illustrates a detailed block diagram of the preferred embodiment of a dual function adder provided in accordance with the principles of this invention;
FIGS. 4a-4c illustrate more detailed schematic diagrams of a typical full-adder implementation of FIG. 3;
FIGS. 5a-5c illustrate more detailed schematic diagrams of a typical incrementer implementation of FIG. 3; and
FIGS. 6a-6c illustrate a more detailed schematic diagrams of a typical decrementer implementation of FIG. 3.
Detailed Description of the Preferred Embodiments.
FIG. 2 illustrates a compact dual function adder provided in accordance with the principles of this invention to generate both an addition operation for adding an input m-bit word to an input n-bit word, wherein m<n, and an increment operation for incrementing the input n-bit word. Dual function adder 100 comprises a n-bit incrementer 110, wherein n is equivalent to the n number of bits of an n-bit input PC 123, PC (n-1) . . . 0!, and a combined adder 120 which receives an input m-bit offset word 124, Offset (m-1) . . . 0!, with m being less than n. N-bit incrementer 110 includes a first m-bit incrementer 140, which receives input bits PC (m-1) . . . 0!of PC address 123 and generates an m-increment output sum 141, mInc.sub.-- Sum (m-1) . . . 0! and an m-increment output carryout bit 142, mInc.sub.-- Co. N-bit incrementer 110 also includes a n-m)-bit incrementer 143, which receives Input bits PC (n-1) . . . m! of Input PC address 123 and generates a n-m)-bit increment output sum 144, nInc.sub.-- Sum (n-1) . . . m!, and a n-increment carryout bit 148, nInc.sub.-- Co. A multiplexor ("MUX")145 is provided which is coupled to receive bits PC (n-1) . . . m! and n-m)-bit increment output sum 144, wherein MUX 145 is also coupled to receive the m-increment output carryout bit 142 from m-bit incrementer 140 to selectively control MUX 145. Thus, during an increment operation of compact dual adder 100, if carryout bit 142 is a logical "1", an increment operation is thereby selected to provide a first multiplexor input comprising n-m)-bit increment output sum 144 at an n-m)-bit MUX output 146. If carryout bit 142 is a logical "0", no overflow occurred and a bypass operation is selected to thereby provide input bits PC (n-1) . . . m! from input PC address 123 as n-m)-bit MUX output 146.
The combined adder 120 of dual adder 100 includes an m-bit full-adder 122, which receives input bits PC (m-1) . . . 0! of n-bit PC address 123 and adds to these bits the m-bit input offset word 124, Offset (m-1) . . . 0!. M-bit adder 122 generates an m-bit adder sum 125, Add.sub.-- Sum (m-1) . . . 0! and an adder carryout bit 126, Add.sub.-- Co. Combined adder 120 also comprises a (n-m)-bit decrementer 130, which receives the input bits PC (n-1) . . . m! of input PC address 123 and generates a (n-m-bit decrement output sum 131, Dec.sub.-- Sum (n-1) . . . m! and a decrementer carryout bit 132, DecCo.
In the preferred embodiment, combined adder 120 comprises an operation select circuit 136 which includes an XOR gate 128. XOR gate 128 is coupled to m-bit adder 122 to receive adder carryout bit 126, Add.sub.-- Co, and Offset<m-1>of m-bit offset 124, which together controls a MUX 134 to provide either a (m-n)-bit increment operation, a (m-n)-bit decrement operation, or a bypass operation, wherein bits PC n-1) . . . m! is provided as output of MUX 134.
In a normal addition operation of n-bit PC address 123 to m-bit Offset 124, wherein m<n, Offset<m-1>indicates whether input offset 124 would be sign extended to comprise either all "0's" or all "1's", which indicates respectively either a positive or a negative signed m-bit offset. Thus, if Offset<m-1> is a logical "0" and adder carryout bit 126 is also a logical "0", a bypass operation is selected to provide input bits PC (n-1) . . . m!to a n-m)-bit adder MUX output 135, which together with adder output sum 125 generates a n-bit combined output word 137. If while Offset<m-1> is a logical "0" and adder carryout bit 126 is a logical "1", a n-m)-bit increment operation is selected to provide n-m)-bit increment sum 144 to n-m)-bit adder MUX output 135. If, however, Offset<m-1> is a logical "1", a negative offset number is indicated, and if adder carryout bit 126 is a logical "0", a decrement operation is selected to thereby provide n-m)-bit decrement sum 131 to n-m)-bit adder MUX output 135. If both Offset<m1> and adder carryout bit 126 are both logical "1's", a bypass operation with a carryout is selected to thereby provide bits PC n-1) . . . m! at adder MUX output 135, with decrement carryout bit 132 comprising a logical "1". Table 1 thus summarizes the relationship of bits Add.sub.-- Co and Offset<m-1> to generate either a (m-n)-bit increment operation, a (m-n)-bit decrement operation, or a bypass operation.
In the preferred embodiment, adder MUX 134 comprises a first adder MUX 134-1 and a second adder MUX 134-2. Adder MUX 134-1 is coupled to n-m)-bit incrementer 143 to receive n-m)-bit increment output sum 144 and to n-m)-bit decrementer 130 to receive n-m)-bit decrement output sum 131. Adder carryout bit 126 is coupled to MUX 134-1 to selectively provide either n-m)-bit increment output sum 144, an increment operation, or n-m)-bit decrement output sum 131, a decrement operation, at a first n-m)-bit adder MUX output 133. Adder MUX 134-2 is coupled to MUX 134-1 to receive first n-m)-bit adder MUX output 133 and input bits PC (n-1) . . . m! of input PC address 123. MUX 134-2 is also coupled to XOR gate 128 to receive XOR output bit 129, wherein XOR output bit 129 is used to selectively control MUX 134-2 to provide at a second adder MUX output 135 either an incremented sum 144 or a decremented sum 13 1 as provided by n-m)-bit MUX output word 133, or bits PC (n-1) . . . m!. In an alternative embodiment, it is envisioned that MUX 134 comprises a 3-input multiplexor for selectively providing an increment sum 144, a decrement sum 13 1, or bits PC n-1) . . . m! as MUX output word 135.
FIG. 3 illustrates a detailed preferred embodiment of a compact dual function adder 200, wherein, for example, n-bit input PC 123 comprises 44 bits and m-bit input offset 124 comprises 16 bits. Combined adder 200 operates similarly to as described in FIG. 2, wherein variables n=44 and m =16, and full-adder 122 may comprise any typical 16bit full-adder circuit generally known in the art, such as, for example, 16bit full-adder 222 shown in FIG. 4.
It is envisioned that a y-bit full-adder, such as FA 122 described in FIG. 2 and FIG. 3, may comprise any conventional full-adder, such as comprising a general 16bit full-adder 300 shown in FIG. 4a, or such typical full-adders modified in a commonly known manner to accommodate m-bit full addition operation. FIGS. 4b-4c illustrate more detailed circuit implementation of typical full-adder 300, wherein FIG. 4b is a more detailed block diagram of a 4-bit full-adder unit 301 shown in FIG. 4a, and FIG. 4c illustrates a more detailed circuit schematic of a full-adder unit 302 shown in FIG. 4b
Likewise, a y-bit incrementer, such as incrementers 140 and 143, of FIGS. 2 and 3 may comprise any conventional incrementer, such as a 4-bit incrementer 400 illustrated in FIG. 5a. FIG. 5b illustrates a more detailed schematic of an active-low input and active-high output incrementer unit 402 of FIG. 4a, and FIG. 5c illustrates a more detailed schematic of an active-high input and active-low output incrementer unit 401 of FIG. 5a. Incrementer 400 may also be modified in a commonly known manner to accommodate any number of input bits as is needed.
Similarly, a y-bit decrementer, such as incrementers 130 of FIGS. 2 and 3, may comprise any conventional decrementer, such as a 4-bit decrementer 500 illustrated in FIG. 6a. FIG. 5b illustrates a more detailed schematic of an active-low input and active-high output decrementer unit 502 of FIG. 6a, and FIG. 6c illustrates a more detailed schematic of an active-high input and active-low output incrementer unit 501 of FIG. 6a. Decrementer 500 may also be modified in a commonly known manner to accommodate any number of input bits as is needed.
Compact dual function adder 100 therefore provides an efficient circuit for providing both an addition operation needed to generate the next PC and an increment operation needed to generate the next branch address by sharing a common n-m)-bit incrementer to thereby minimize real estate required for such implementation. Conceivably, compact dual function adder 100 can also be used generally with any two input words, wherein the first word is a n-bit input word and a second word is an m-bit input word, and m is typically a sign-extended word and m<n.
Although the invention has been described with respect to specific embodiments, it is envisioned that numerous variations may be made within the scope of the concepts taught in accordance with the inventions.