help me to understand the equations

Status
Not open for further replies.

lihui002

Newbie level 5
Joined
Nov 4, 2005
Messages
10
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,283
Activity points
1,378
There are two equations for the adder or subtraction a book

s=a^(b^M)^c;
c[i+1]=(a+c)(b^M)+ac;
when M = 0, it is an adder a[i[+b
when M = 1, it is a subtraction a-b
-------------------------------------

I think when M = 1, d=a^b^l, the b should not become the 1's complement,
and l[i+1]=(a^M)(b+l)+bl, a should be the 1's complement, not the b.

please explain the equation in the book.

Thanks
 

because
a-b=a+(~b+1)
maybe you forget add 1
 

but b^1 is ~b, not ~b+1.
please explain more particular, thanks
 

sorry, what I said is not clear,
when excute sub
M=1,at the same time c[0]=1
when excute sub
M=0,at the same time c[0]=0
c[0] must be assigned previously
 

I think M=0 , a+b+c
M=1, a-b-c,
so the c not equal M.
 

I never said c equals M
what i said is c[0] equals M
maybe you can try to check it through simulating the code
 

    lihui002

    Points: 2
    Helpful Answer Positive Rating
I have run the simulation with code, through the simulation result,
s = a ^ b ^ c;
c[i+1] = (a^M)(b+c)+bc;
should can get the correct result.

but arithmetic in the book, the result is not right.

Thanks you suggestion
 

Thanks tarkyss, now I understand your means.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…