how to create function half adder in matlab
30 views (last 30 days)
Roger Stafford on 2 Apr 2018
If the input bits are numeric scalars or logical values, b1 and b2, then the sum bit, 's', would be:
s = b1 xor b2;
s = (b1&~b2) | (~b1&b2);
These are equivalent. That leaves you with the 'carry' bit to figure out.