This application claims the benefit of Taiwan application Serial No. 99109254, filed Mar. 26, 2010, the subject matter of which is incorporated herein by reference.
1. Field of the Invention
The invention relates in general to an adder circuit and a Xiu-accumulator circuit using the same.
2. Description of the Related Art
Average computing is widely used in digital signal processing and other applications. Currently, averaging can be achieved through accumulation. Accumulation computing normally includes integer accumulation and non-integer (such as decimal or fraction) accumulation. In general, accumulation can be done by an adder.
As the bit number grows (I or (I+r) having more bit number), the computing speed of the adder becomes slower, circuit area as well as power consumption will increase significantly. For some specific applications, in order to achieve average computing, the decimal portion can even have 64 bits. It is very expensive for such a huge adder to achieve GHz-order computing speed, and the cost (involving circuit area and power consumption) is very high. In general, only in very high performance and large volume designs (such as a general purpose CPU), such a large size adder can be afforded.
As the bit number of the processor bus grows and the processor speed increases, the design of the adder (which could be the core of complicated computing circuits) becomes very difficult. Therefore, an adder and an accumulator which resolve the shortcomings encountered in prior art are greatly needed.
Embodiments of the invention are directed to an adder circuit and a Xiu-accumulator circuit using the same. The carry-in information of a previous stage adder is not propagated to a next stage adder until the next clock cycle. Despite the fact that the addition result is not necessarily correct at each clock cycle, the number of carry-in occurrences is always correct.
An adder circuit is provided according to an embodiment of the invention. The adder circuit includes a first adder. The first adder includes a first addition unit, a first register coupled to the first addition unit and a second register coupled to the first addition unit. At a first clock cycle, the first addition unit adds up an augend signal, an addend signal and a first signal to generate a first addition result signal and a first carry-in signal. The first register stores the first addition result signal and the second register stores the first carry-in signal.
An adder circuit including N cascaded adders is provided according to another embodiment of the invention. Each of the N cascaded adders includes a first register and a second register, wherein the first registers store an addition result information, and the second registers store a carry-in information. The carry-in information outputted from a previous stage adder is fed to a next stage adder at a next clock cycle, and after N clock cycles, the carry-in information outputted from the first stage adder is fed to the last stage adder, N being a natural number.
An accumulator circuit including a first adder is provided according to yet another embodiment of the invention. The first adder includes a first addition unit, a first register coupled to the first addition unit, and a second register coupled to the first addition unit. At a first clock cycle, the first addition unit accumulates a variable and an output of the first register to generate a first addition result signal and a first carry-in signal. The first register stores the first addition result signal and the second register stores the first carry-in signal.
An accumulator circuit including N cascaded adders is provided in still yet another embodiment of the invention. Each adder includes two registers, wherein one register stores an addition result information, and the other register stores a carry-in information. Respective addition result information from respective adder is further fed back to itself for accumulation. The carry-in information outputted from a previous stage adder is fed to a next stage adder at a next clock cycle. After N clock cycles, the carry-in information outputted from the first stage adder is fed to the last stage adder.
The invention will become apparent from the following detailed description of the preferred but non-limiting embodiments. The following description is made with reference to the accompanying drawings.
Referring to
Thus, a new adder and a Xiu-accumulator using the same are provided according to an embodiment of the invention.
Mathematical Proof:
In the embodiment of the invention, within a period of time, firstly, the number of the occurrence of the carry-in caused by the decimal portion of the accumulation result is useful (the decimal portion itself is not important); secondly, the timing of the occurrence of carry-in does not affect the long term result; thirdly, the sequence of the occurrence of carry-in does not affect the long term result either.
In the long term, the prior accumulator and the accumulator according to the embodiment of the invention generate the same number of carry-in bits.
Suppose r is a decimal number, wherein 0<r<1. Let the b-based m-bit system be taken for example, r can be expressed as follows:
r=r
1
b
−1
+r
2
b
−2
+r
3
b
−3
+ . . . r
m
b
−m (1)
After bm clock cycles, the accumulation result of the decimal portion can be expressed as follows:
S
1
=b
m
r=r
1
b
m-1
+r
2
b
m-2
+r
3
b
m-3
+ . . . r
m
b (2)
As indicated in equation (2), after bm clock cycles, all decimal portions will be propagated to the integer portion, and bmr denotes the total number of carry-in generated during the bm clock cycles.
Besides, r can further be expressed as follows:
Some designations in equation (3) are defined as follows:
The accumulation of R1˜Rm can be performed by the accumulator of
Since the m 1-bit full adders are serially connected (as indicated in
As indicated in equation (6), after bm clock cycles, the accumulation result of the decimal portion generated according to the prior art and the accumulation result of the decimal portion generated according to the embodiment of the invention are the same.
Simulation:
As indicated in
As indicated in
The adder and the Xiu-accumulator using the same disclosed in the above embodiments of the invention have many advantages exemplified below:
(1) Speed Advantage:
Table 1 shows a comparison of computing time (i.e. computing speed) between the prior art and the embodiment of the invention. In the prior art, the computing speed is significantly and negatively affected by the increase in the bit number of the adder. In other words, during the process of accumulation, as the bit number of the decimal portion grows, the computing speed according to the prior art significantly slows down. As for the embodiment of the invention, even in the cases of the bit number of the decimal portion in accumulation grows significantly, the speed of the accumulator still can be regarded as the same as the speed of a 1-bit full adder. In other words, in the embodiment of the invention, the speed of the accumulator is determined by the bit number of the integer portion of the adder. This is because in the embodiment of the invention, the computing result of the decimal portion is not important and what really matters is the number of carry-in bits of the decimal portion. In general, during the process of accumulation, the bit number of the integer portion is smaller than that of the decimal portion. In Table 1, the integer portion is fixed as 3 bits. As indicated in Table 1, as the bit number of the decimal portion grows, the computing time according to the prior art becomes significantly longer, but the computing time according to the embodiment of the invention is almost not affected by the increase in the bit number of the decimal portion.
(2) Comparison of Circuit Area:
Table 2 shows a comparison of circuit area between the prior art and the embodiment of the invention. As indicated in Table 2, as the bit number increases, the circuit area of the prior art becomes significantly larger, but the increase in the circuit area according to the embodiment of the invention is not as large.
In Table 2, the circuit area is in unit of NAND logic gates. For example, when the adder is a 24-bit adder, the Xiu-accumulator (such as the structure of
As indicated in Table 2, the 1-bit full adder according to the prior art only requires 1 register (for storing an addition result S), but the 1-bit full adder according to the embodiment of the invention requires 2 registers (for storing an addition result S and a carry bit CO). However, the circuit area according to the embodiment of the invention is far smaller than that according to the prior art.
(3) Comparison of Power Consumption:
Table 3 shows a comparison of power consumption between the prior art and the embodiment of the invention. As indicated in Table 3, as the bit number grows, the power consumption according to the prior art increases significantly, but the increase in power consumption according to the embodiment of the invention is smaller. As indicated in Table 3, the power consumption according to the embodiment of the invention is about a half of that according to the prior art.
While the invention has been described by way of example and in terms of a preferred embodiment, it is to be understood that the invention is not limited thereto. On the contrary, it is intended to cover various modifications and similar arrangements and procedures, and the scope of the appended claims therefore should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements and procedures.
Number | Date | Country | Kind |
---|---|---|---|
099109254 | Mar 2010 | TW | national |