HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Is it possible to determine if C=A+B faster than adding A+B in logical circuits

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
thanaddingfasterpossiblecircuitsdeterminelogical

Problem

With an adder circuit where A+B=C, I am trying to have a method to determine when C will be valid based on a change in A or B. I know that it is possible to just determine the longest the circuit would take, but is it possible to determine if the result (C) is equal to A+B. This would speed up the result of the operation as if A and B had a small change, C could be determined faster than a full adder cycle.

In general: If you know A, B, and C, can you determine if A+B=C faster than adding A+B

Solution

Consider computing $\overline{a_{n-1}\ldots a_0}+\overline{b_{n-1}\ldots b_0}=\overline{c_{n-1}\ldots c_0}$. If the last $(k+1)$-bits are correctly computed, then $c_{k+1}$ is correct if and only if
$$\big((a_k\wedge b_k)\vee((a_k\oplus b_k)\wedge \neg c_k)\big)\oplus a_{k+1}\oplus b_{k+1}=c_{k+1}.$$
That is because the first part, $(a_k\wedge b_k)\vee((a_k\oplus b_k)\wedge \neg c_k)$ indicates whether there is a carry-over. So you can check the correctness for each bit in parallel.

However, in theory both questions require $\Omega(\log n)$-depth bounded fan-in circuits. Good thing is, for the checking problem the $\log n$ part in the circuit depth is only for a $n$-bit $\textsf{AND}$, so I think it is a constant boost in the performance.

Context

StackExchange Computer Science Q#66338, answer score: 4

Revisions (0)

No revisions yet.