Borrar filtros
Borrar filtros

how to create function half adder in matlab

7 visualizaciones (últimos 30 días)
manaf nehad
manaf nehad el 2 de Abr. de 2018
Respondida: Roger Stafford el 2 de Abr. de 2018
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 comentario
James Tursa
James Tursa el 2 de Abr. de 2018
What is this for? How are the bits passed in? I.e., what are the variable classes involved?

Iniciar sesión para comentar.

Respuesta aceptada

Roger Stafford
Roger Stafford el 2 de Abr. de 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;
or else
s = (b1&~b2) | (~b1&b2);
These are equivalent. That leaves you with the 'carry' bit to figure out.

Más respuestas (0)

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by