0
\$\begingroup\$

The following task is from an old exam and because the new exam will be similar to this one, I'm trying to understand it. Unfortunately there are no solutions or hints given and I got nothing to understand it really (I can provide source that this is really from an old exam and NOT homework.)

Task:

Given is a comparator that compares 4-bit binary numbers A[3...0] and B[3...0] (aka A_3, A_2, A_1, A_0 ..). The result is the output signal C_i which has the value 1 if A > B.

The arithmetic-circuit is supposed to be made up by connecting 4 identical 1-bit arithmetic-modules. Each of these 1-bit modules have the inputs A_i, B_i and C_i-1 and the output C_i with i= 0, 1, 2, 3. So, the carry outputs will be taken of the less significant digit i-1.

Given is A=0100 and B=0010. Fill the following table whereby C_-1-bit is supposed to be chosen by you in a reasonable way. The carry C_i is 1 exactly when A > B

I have filled the table as good as I could but I have no idea how to do it with C_i-1. The fields I have filled, are they correct at all?

I also hope I have explained clear enough please do tell me if I did not. You guys are really my last chance, got no one and nothing else to understand this I'm totally serious : /

enter image description here

**Edit: I would fill C(i-1) in table like that: 0 0 1 0 it's right now?

\$\endgroup\$
  • 1
    \$\begingroup\$ So A_3 is an input as well as an output? \$\endgroup\$ – Andy aka Sep 23 '16 at 17:45
  • \$\begingroup\$ Oh, it's only an input, corrected, ty! \$\endgroup\$ – cnmesr Sep 23 '16 at 18:01
  • \$\begingroup\$ Isn't the C(i-1) row just the C(i) row shifted left by one? \$\endgroup\$ – C. Towne Springer Sep 23 '16 at 18:16
  • \$\begingroup\$ If you understand why you need C(i-1) you will see how to fill it in. \$\endgroup\$ – Brian Drummond Sep 23 '16 at 18:17
  • 1
    \$\begingroup\$ Sorry for removing my comment, i'v figured out that i was totally wrong, i`m posting an answer right now \$\endgroup\$ – Elbehery Sep 23 '16 at 20:19
2
\$\begingroup\$

Based on the facts you mentioned, we are given an module of inputs A,B,C and output Y such that the output Y is high if A>B we want to build a bigger module that compares 3-bit such that if A bit string is bigger than B the output will be 1.

My approach for solving this problem was as the following

enter image description here In this combination if A > B or A==B the first OR gate output will be 1 while if A < B the first OR gate output will be 0, the OR output is connected to the second comparator C_i input, so basicly i`m using the C_i input as if it was a confimation that the previous A was not smaller than B.

So as long as the input C for any of those single bit comparators is 1 the comparator output will be 1 or 0 based on which is bigger A or B, while if this input C is 0, the comparator output will always be 0!

Lets do some test cases

A=010
B=001

The first comparator [The one of the LEFT] has inputs A=0, B=0, C=1 the output of this comparator is 0 since A2 is not bigger than B2 while the XNOR gate [XOR followed by a not gate] output is 1 since A is equal to B this means that the second comparator will work and we still not sure if A is bigger than B or not

The second comparator now has inputs A=1, B=0, C=1 the output of this comparator is now 1 since A3 > B3 both the inputs of the second OR gate are 1

The third comparator now has inputs A=0, B=1, C=1 the output of this comparator is now 0 since A[0]

The final result is taken by a big OR gate that checks if any of the comparators output was equal to one

Now your back to filling your table assuming the same values of A and B your table should look like this

enter image description here

You can play around the values of A and B and check out the values of C_i using this simple Python Script

I hope this answer is not confusing and please if you think i am missing anything let me know

EDITED

What is meant by "big comparator output"?

I mean the whole circuit, in the image above its the 3-bit comparator which is made from 3x 1bit comparators and its output is the last or gate output

enter image description here

what is C(i-1) in your description?

based on what you mentioned above

Each of these 1-bit modules have the inputs A_i, B_i and C_i-1

So in my case its the carry input for any of the comparators which should be 1 if A > B or A=B enter image description here

Seems like your question requires comparing the numbers from right to left [based on the less significant digit] while my answer compares the numbers from left to right [based on the last significant digit] which means that this answer is not what you are looking for.

If this answer is not the proper answer for your question please let me know in the comments, I`ll delete it asap

\$\endgroup\$
  • \$\begingroup\$ Omg thank you so much for your time to make this for me. I need sleep tomorrow I read everything and will understand it hopefully. Thank a lot very much appreciated man! \$\endgroup\$ – cnmesr Sep 23 '16 at 22:31
  • \$\begingroup\$ What is meant by "big comparator output"? and what is C(i-1) in your description? \$\endgroup\$ – cnmesr Sep 24 '16 at 9:40
  • \$\begingroup\$ Following your description, I did my table correctly, right? But still no idea how to fill C(i-1) \$\endgroup\$ – cnmesr Sep 24 '16 at 10:06
  • \$\begingroup\$ Edited, please let me know if this is not the proper answer for your question, if so i`ll delete it asap \$\endgroup\$ – Elbehery Sep 24 '16 at 14:43

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.