0
\$\begingroup\$

I am designing a block that performs addition and subtraction with the IC74283. In short, it receives three inputs: \$A\$, \$B\$ and \$subtract\$. When \$subtract\$ is 1, the block performs \$A - B\$ (in 2's complement), otherwise, it will just do \$A + B\$. The outputs are the result of the operation, \$R\$, and \$C_{out}\$.

But I'm still struggling to understand the meaning of \$C_{out}\$ in this context, I can't found a pattern to identify when \$C_{out}\$ is 0 or 1 and what information it gives about the operation/result. Is it just an overflow indication, or does it give me a hint about the sign of the result?

\$\endgroup\$
  • \$\begingroup\$ You are wrong about the function of the 74283. It's not a "subtract" input you have there but a carry input \$C_{in}\$. For subtraction, it has to be set in the lowest stage to produce a correct result. In higher stages, it has to be connected to \$C_{out}\$ of the previous stage. For the most significant stage, \$C_{out}\$ indeed denotes an overflow. \$\endgroup\$ – Janka Mar 17 '17 at 22:29
  • \$\begingroup\$ Yes, I just gave a name to it. There is a block that does the 1's complement of \$B\$ and the \$subtract\$ is connected to \$C_{in}\$, so I can get the 2's complement. \$\endgroup\$ – Vinícius Lopes Simões Mar 17 '17 at 22:44
3
\$\begingroup\$

In 2's-complement (signed) arithmetic, the MSB of each number is its sign (1 indicates negative values).

Therefore, you have four possibilities for the result of an addition (or subtraction) operation:

  • Cout = 0, MSB = 0 — normal positive result (no overflow)
  • Cout = 0, MSB = 1 — positive overflow
  • Cout = 1, MSB = 1 — normal negative result (no overflow)
  • Cout = 1, MSB = 0 — negative overflow

In other words, as long as Cout and the MSB match, you have a good result, no overflow. Whenever they don't match, you experienced an overflow.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.