how to create function half adder in matlab

4 次查看(过去 30 天)
halfAdder : it accepts 2 bits as input arguments. It adds these bits and returns 2 bits as output arguments: the sum and the output carry
  1 个评论
James Tursa
James Tursa 2018-4-2
What is this for? How are the bits passed in? I.e., what are the variable classes involved?

请先登录,再进行评论。

采纳的回答

Roger Stafford
Roger Stafford 2018-4-2
If the input bits are numeric scalars or logical values, b1 and b2, then the sum bit, 's', would be:
s = b1 xor b2;
or else
s = (b1&~b2) | (~b1&b2);
These are equivalent. That leaves you with the 'carry' bit to figure out.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Properties 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by