A Question About Base 3 Subtruction..

Thread Starter

transgalactic

Joined Apr 29, 2008
74
i cant understand how it works:
i have two bit numbers (x1 x0 ,y1 y0) which are needed to be subtructed

i cant understand why
x1 x0 y1 y0 | B D1 D2
0 0 0 1 | 1 1 0
0 0 1 0 | 1 0 1
0 0 1 1 | X X X


i cant understand these arithmetics
the first one is 0-1=-1
so in base 3 the resolt is should be three but i cant understand what meen Borrow=1
and the resolt 10
i dont understand how did they desided that

and why we have dont cares on the third example
 

Papabravo

Joined Feb 24, 2006
21,159
You're talking about bits (binary digits) and base 3 subtraction. I think the base 3 must be a typo since I don't see any 2's in the truth table. In any case binary subtraction is derived in the same way as binary addition. It is a combinatorial function that has three inputs and two outputs. The inputs are two operand bits and a borrow in bit. The ouputs are a difference bit and a borrow out bit.

If you can do that for a one bit stage then you can easily work out the logic for a two bit stage, and the least significant stage has no borrow in. So you have 4 input bits and three output bits. The inputs are the two 2-bit operands and the outputs are the two difference bits and the borrow out. The truth table should have 16 lines and if there are don't cares it will be obvious from the completed truth table.
 

Mark44

Joined Nov 26, 2007
628
Are you sure the problem is about base-3 numbers? The work you show uses only the digits 0 and 1, which implies a binary (base-2) system.

In a base-3 system there are three digits: 0, 1, and 2. If you have numbers that can be represented with two bits (i.e., two binary digits), you can represent 0 (0 0), 1 (0 1), 2 (1 0), or 3 (1 1).

Instead of subtracting 1 from 0, think about the equivalent problem of what you could add to 1 to get 0, keeping in mind that any carries that happen in the left digit won't affect either of the two digits you have.
 

techroomt

Joined May 19, 2004
198
your truth table, written in binary (base 2) represents a two digit value (y1 y0) being subttracted from another two digit value (x1 x0), resulting in a three digit value b (borrow), and d1 d0. this is not a base 3 value, but 3 binary digits. realize that add/subtract mathematical operations are going to deal with the values being manipulated, as well as the next highest place holder (borrow in your case). and, if i'm correct you have mistakes in the truth table. now if you are truly subtracting base 3 numbers, and just not representing any 2's, forget all i said.
 

Caveman

Joined Apr 15, 2008
471
Okay, I've got it all figured. Here's the deal. To understand, let's rewrite your truth table as base 3 numbers. Here's the examples that you gave:

Rich (BB code):
x1 x0 y1 y0 | B D1 D2
 0   0  0  1  | 1  1   0 
 0   0  1  0  | 1  0   1
 0   0  1  1  | X  X   X
And here it is in base 3
Rich (BB code):
x  y  | B  D
0  1  | 1  2 
0  2  | 1  1
0  3  | X  X        // THIS DOESN'T MAKE SENSE IN BASE 3
First, note that the digit 3 doesn't work in base 3 just like there is no 2 in binary or single digit for 10 in decimal. That is why it is "don't care". Basically, by doing that, you can simplify the logic, since you don't really care what happens with invalid inputs.

Now the others make sense if you understand what a borrow is. Let's take a decimal example.
Rich (BB code):
  21
- 15
----
   6
The right-most digit needs a borrow. So we decrement one from the upper digit (2) and add it to the lower digit(1), but the upper digit is worth 10x's that so we actually add 10. So this is equivalent to 11-5 = 6 for the lower digit. And the upper digits are now both 1, so 1-1 = 0.

In base 3, when we borrow, we add 3. So for the first line, 0 - 1, we will borrow from the upper digit (that isn't shown here) and add 3 to the 0, so the answer is 3-1 = 2.

Does this all make sense?
 

Papabravo

Joined Feb 24, 2006
21,159
I think Caveman has the ticket. Kudos to you and a big Bronx cheer to the OP for such an obscurely constructed post. I certainly was taken in since I was unable to get my arms around the concept of a base three number represented in binary. I would have understood it, if the problem had been formulated with three level logic so that the digits 0, 1, and 2 were evident in the truth table.

I've always said that if you must be obscure, it is best to be obscure CLEARLY!
 
Top