14

I'm trying to design a parallel prefix adder for a negabinary based adder. Negabinary is base \$-2\$ instead of the familiar base \$2\$ binary. Each 1 bit adder generates a sum and two (instead of one in binary) carries that go to the next adder.

To make the adder faster, I want to use a parallel prefix structure, like the Ladner-Fischer structure given below. I'm familiar with the functionality of the purple cell in the binary system, but I'm unsure how I could get the same functionality in the negabinary system.

The reason I'm doing this is just for fun, I haven't found any uses for negabinary yet.

Formulas for calculating the sum and carries:

\$s_i = a_i \oplus b_i \oplus (c_i^+ + c_i^-) \$

\$ c_{i+1}^+ = \overline{a_i}\overline{b_i}\overline{c_i^+}c_i^- \$

\$ c_{i+1}^- = a_ib_i\overline{c_i^-}+a_i c_i^+ \overline{c_i^-}+b_i c_i^+ \overline{c_i^-} \$

Ladner-fischer carry tree structure:

enter image description here

If anything is unclear, please don't hesitate to ask.

gilianzz
  • 575
  • 2
  • 6
  • 23
  • While this may be an interesting question, it doesn't seem to be an electrical question, and you may have better luck taking it to the math SE. – Redja May 23 '17 at 12:52
  • 3
    I put it here because I think EE people have more experience with carry logic, designing adders etc. – gilianzz May 23 '17 at 13:29
  • This is totally an EE question – Voltage Spike May 24 '17 at 18:59
  • Seems like you need more than two outputs per carry. Don't you need generate and propagate for both carry and borrow? – stark May 26 '17 at 18:35
  • I'm assuming you're talking about the Ladner-fischer structure. It was just an example to show off a parallel prefix tree. Each 1 bit negabinary adder outputs a sum, a positive and a negative carry. I'm unsure if we can use the concepts of generate and propagate with negabinary. – gilianzz May 26 '17 at 20:01
  • conversion from negbinary to binary is adding 1010101010101010 and then xor with 101010101010101010, that may be useful. – Jasen Слава Україні Aug 08 '17 at 20:08
  • I’m afraid there’s something wrong with your formulas. As I understand it, with base \$-2\$, the sum at position \$i\$ needs 2 carry bits: 1 at position \$i+1\$ and 1 at position \$i+2\$. With 4 input bits at a given position, the mathematical sum may be 0, 1, 2, 3 or 4, which is written, in base \$-2\$, 000, 001, 110, 111 or 100. You might want to design a 5-input “full-adder-like” cell that still has 3 ouputs, to ease the design of your adder. – user2233709 May 18 '18 at 22:03

1 Answers1

1

I have probably spent more time on this question than I should've, but here are my findings.

I cannot find any example of a "pure" parallel prefix adder for negabinary numbers. I also think it's an open problem, as I haven't seen any proof that it isn't possible.

The closest I can get you is by using a two-step negative negabinary addition (commonly abbreviated n.n.b.a. in literature). It is based on the following property:

Let \$f(x) = \overline{x_{n-1}}x_{n-2}...\overline{x_1}x_0\$ and \$g(x) = x_{n-1}\overline{x_{n-2}}...x_1\overline{x_0}\$. These are basically an XOR-operation with 0xAA...AA and 0x55...55 respectively. You can then prove that

$$-(a +_{nb} b) = g\left(f(a) + f(b) + 1\right)$$

Where the left side is the negabinary sum \$+_{nb}\$, while the \$+\$ on the right side is a normal binary sum.

The negative sum can then simply be inverted using the same property but with a zero operand:

$$-x = g\left(f(x) + f(0) + 1\right)$$

So in order to find the sum using parallel prefix adders, you can:

  1. Compute \$f(a)\$ and \$f(b)\$, ie. by inverting every odd bit of the negabinary numbers
  2. Compute the regular binary sum while setting the carry bit for the LSB (the \$+1\$), leading to a first intermediary sum \$s_1\$.
  3. Invert all bits of \$s_1\$ (this is \$f(g(s_1))\$). This is the finish of the first sum, while also starting the inversion.
  4. Increment the result by 0xAA...AB (\$=f(0)+1\$) using a parallel prefix adder, yielding the second intermediary sum \$s_2\$
  5. Compute \$g(s_2)\$ (inverting each even bit) to find the final negabinary sum.

I have actually tried to find a "pure" parallel prefix adder, but I considered it too complex for the time I was willing to spend on it. Here's why:

The whole point of parallel prefix adders is to find some operation of \$\{0,1\}^n \times \{0,1\}^n \rightarrow \{0,1\}^n\$ that allows you to easily calculate the (in this case 2) carries from these bits. As an added constraint, the operation needs to be associative to be computed in parallel. For example, this basically excludes any NOT operator (that is not part of a double negation). For example: \$a \circ b=a\cdot \bar b\$ is not an associative operator, because

$$\begin{align} (a\circ b)\circ c &= a\cdot \bar b \cdot \bar c\\ a\circ (b \circ c) &= a\cdot \overline{b \cdot \bar c} \end{align}$$

Note that the boolean operator for the carries in your question includes the mixed terms \$c_i^+\overline{c_i^-}\$ and \$c_i^-\overline{c_i^+}\$, making it impossible to use it as-is. For a single carry in normal binary addition, it became quite obvious how to construct this operator when thinking about it in terms of generation and propagation, but it seems to be not so obvious for negabinary carries.

Sven B
  • 5,072
  • 8
  • 24
  • My current understanding is that it is in fact impossible to construct this "pure" parallel prefix adder. It would seem that a parallel prefix adder can get an efficiency of O(log(N)), whereas a negabinary equivalent seems to always have complexity O(2*log(N)) (2x n.n.b.a). – gilianzz Jun 15 '18 at 21:11
  • I didn't find any literature proving or stating that it was *impossible*. I'd be happy to be proven wrong either way though. But the 2-step n.n.b.a. does seem to be the standard currently for negabinary addition as far as I can tell. – Sven B Jun 16 '18 at 11:10