Cheap and Secure Web Hosting Provider : See Now

[Solved]: Creating a logical circuit

, , No Comments
Problem Detail: 

Task: Design a 2 bit comparator.

Input: 2x 2 bit (I take it as 2 2-bit values, let them be unsigned for simplicity) Output: 1 if result input1>input2 is true, 0 otherwise

Develop truth table and derive circuits.

The problem: I'm completely new to this so I have not even a idea where where to look for the lighthouse.

The question: I'M NOT LOOKING FOR COMPLETE SOLUTION, instead I'm looking for a guidance through topics/materials which I should check to be able to solve it myself.

Done so far: I started with understanding logical gates and those seem to be pretty straight forward.

P.S.: Purpose of posting this question is to boost the speed with which I will get to the actual solution.

SOLUTION: f(A,B,C,D) = !AB!C!D + A!C + ABC!D. (! - used for negation or NOR, ABC notations means A AND B AND C). I had three adjacent rectangles two of which were of unit cell size and one of 4 cells size (one cell was actually far away, but there's this toroidally connection property, not sure about terminology). A and B are MSD and LSD of the first number respectfully and B and C are same for second number. As for the circuit image: sorry folks my hand drawing requires strong mental stability.

Asked By : Denys S.

Answered By : Paresh

Well, as the problem asks you to make a truth table, you should first make one (this is generally a good idea even if not asked explicitly). For your question, you can say assign two bits to input1, say $a$ and $b$, and two bits to the input2, say $x$ and $y$. Then you might say that if $a = 1$ and $b = 0$, input 1 is $2$.

Once you have the truth table (4 inputs, one output), you can get the corresponding boolean expression from the truth table in "sum-of-products" form. Basically, suppose for every entry where the output is 1, you form a "min-term" of the inputs. For example, say for 2 inputs $p$ and $q$, if output is $1$ when $p=1$ and $q = 0$, the min-term would be $p\bar{q}$. Get these min-terms for all inputs where the output is 1, and add them/OR-them together. This is because the output is 1 if and only if any one min-terms is true. You can read more here or here or here.

Now, once you have the boolean expression, you might want to minimize it - implement the logic using fewer gates. This is not asked in your question, but you might want to do it anyways. Karnaugh map technique, which you seem to already have read, is one technique. There is another called the Quine-McCluskey algorithm.

Once you have the boolean expression, you can generate the corresponding circuit mechanically. So, for each min-term, implement it using AND gates, and NOT gates. Connect all these to the input of a OR gate. For example, for something like $p\bar{q} + \bar{p}q$, $p\bar{q}$ means $p$ AND (NOT $q$). Do the same for the other min-term, and give them to the input of an OR gate. The above links also provide information and examples about this.

As for speed, you'll get faster with practice!

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/9620

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback