How do I do binary X*Y and X/Y?

  • arcadiagiulio
    21st Aug 2011 Member 0 Permalink
    Hello everybody. I'm building a binary calculator, and I'd like to implement the 4 operations. I found a way to add or substract (over the positive integers) with NOT, AND and XOR gates, but I can't understand how to make multiplication or division.

    Please explain this way:

    (e.g. sum; result_1 = first digit [from the right] of the result)
    (A_1=1 and A_2=1) implies Result_1=0; Result_2=1
    (A_1=1 xor A_2=1) implies Result_1=1
    (A_1=0 and A_2=0) implies Result_1=0
  • jalfor
    21st Aug 2011 Member 0 Permalink
    @arcadiagiulio (View Post)
    Division...don't know, though multiplication you can do my way. A bit shift each time you go one more over then add them all up. e.g. '1' in the hundreds bit would be '100'. Oh, and just so you know, doing subtraction and letting it output negative numbers is easy, just put an overflow checker on the full adder/subtractor(look up how to do that if you don't know). If there is overflow, invert everything and you have the negative answer :)
  • arcadiagiulio
    21st Aug 2011 Member 0 Permalink
    OK, division's too hard because can give rational, non-natural numbers, however I didn't understand the multiplication. Can you attach a save?