0
\$\begingroup\$

I have two numbers both with four bits (a3 to a0 and b3 to b0 reading from left to right) and I would like to find out if a is bigger than b. I have drawn a solution of mine and a short mathematical explanation of it, it would be amazing if somebody can tell me if this is correct. So my idea is to to use full adders (which are named VA), where I have a, b and the carry from before as inputs. The carry from the current adder and q_{i} are outputs of it. I negate all of my bits of b,setting C0 to one to add one so I have a two's complement and than I add both numbers. One of my sources say's, that a>b when sign=0 and z=0. Z is 1 when all q_{i} are zero. And sign means (concerning my sources), that q3 is zero. So in the end I came up combining it like the way I did on the photo.

Am I right with this? Why is there no use of c3? enter image description here

\$\endgroup\$
7
  • \$\begingroup\$ Negating all of your bits is not two complement. \$\endgroup\$
    – DonFusili
    Commented Sep 5, 2018 at 8:02
  • 2
    \$\begingroup\$ @DonFusil note C0 = 1. He is achieving twos complement by inverting and adding one although this is not explained. \$\endgroup\$
    – RoyC
    Commented Sep 5, 2018 at 9:07
  • \$\begingroup\$ @RoyC Ah, that'll teach me to assume the text and diagram explain and show the same, my bad. \$\endgroup\$
    – DonFusili
    Commented Sep 5, 2018 at 9:16
  • \$\begingroup\$ @RoyC Thanks for saying this, sorry I forgot to talk about this. Is that the correct twos complement then? \$\endgroup\$
    – Hemmelig
    Commented Sep 5, 2018 at 9:23
  • \$\begingroup\$ Yes that is good. \$\endgroup\$
    – RoyC
    Commented Sep 5, 2018 at 9:24

2 Answers 2

1
\$\begingroup\$

The fundamental error with this and why you are not using c3 is that you need to represent the twos complement input and output with the range 15 to -15 as a five bit quantity. This means that c3 is q4 of the output and the sign bit.

\$\endgroup\$
2
  • \$\begingroup\$ So do you mean the function would be correct, if I would put q3 to OR as well and move the current q3 to the carry with c3? \$\endgroup\$
    – Hemmelig
    Commented Sep 5, 2018 at 9:24
  • \$\begingroup\$ That is correct. \$\endgroup\$
    – RoyC
    Commented Sep 5, 2018 at 9:26
0
\$\begingroup\$

Search for 4-bit comparator 3-bit comparator

enter image description here

4-bit comparator :

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ @RoyC I agree with you, I am so sorry. I will add the links where I got those circuits. Take it as an example, unfortunatelly the bad one. \$\endgroup\$ Commented Sep 5, 2018 at 15:43
  • \$\begingroup\$ @RoyC I did change the exaple with better one. \$\endgroup\$ Commented Sep 5, 2018 at 15:47

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.