0
\$\begingroup\$

Making an ALU I want a signal that signals whenever an addition or subtraction changes the binary number from - to +. Each number u and v is 4-bits and therefore is marked by 0, 1, 2, 3 where 3 is the most significant bit. c3 in this case is the carry in from the previous addition. z3 is the result and c4 is the potential carry out from the addition. I am using 2s complement, the list below explains how it works.

$$ 1000\hspace{1cm} -8\\ 1001\hspace{1cm} -7\\ 1010\hspace{1cm} -6\\ 1011\hspace{1cm} -5\\ 1100\hspace{1cm} -4\\ 1101\hspace{1cm} -3\\ 1110\hspace{1cm} -2\\ 1111\hspace{1cm} -1\\ 0000 \hspace{1.5cm} 0\\ 0001\hspace{1.5cm} 1\\ 0010\hspace{1.5cm} 2\\ 0011\hspace{1.5cm} 3\\ 0100\hspace{1.5cm} 4\\ 0101\hspace{1.5cm} 5\\ 0110\hspace{1.5cm} 6\\ 0111\hspace{1.5cm} 7\\ $$

As one can see here when adding for example 6 + 6. $$0110 + 0110$$ The result is 1100 i.e -4. Since that isn't correct the signal OF (overflow) will turn one signaling this. As you can see below in the completed truth table, OF = 1 only when u3 and v3 are the same and the carry signals have alternate values. When adding 0110 + 0110 u3 and v3 is 0, c3 will be 1 since u2 and v2 will have a result of 0 and a carry out of 1.

enter image description here

Now I wanna express the OF signal as a function. When trying I get this expression. $$OF = u_3´v_3´c_3c_4´z_3 \vee (u_3´v_3´c_3c_4´z_3)´$$ This expression will always be equal to 1 since $$A \vee A´ = 1$$ Therefore I'm a bit lost in how to express OF as a function.

\$\endgroup\$
0

1 Answer 1

0
\$\begingroup\$

Judging by your truth table for OF, it looks like you meant to write

$$OF = {u_3}' \, {v_3}' \, c_3 \, {c_4}' \, z_3 \vee u_3 \, v_3 \, {c_3}' \, c_4 \, {z_3}'$$

Remember that \$({u_3}' \, {v_3}' \, c_3 \, {c_4}' \, z_3)'\$ is not the same thing as \$u_3 \, v_3 \, {c_3}' \, c_4 \, {z_3}'\$.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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