What is wrong with the following code for a half adder that must add if add signal

Question:

What is wrong with the following code for a half adder that must add if add signal equals 1?
always @(x)
begin
if (add == 1)
begin
sum = x ^ y;
carry = x & y;
end
else
begin
sum = 0;
carry = 0;
end
end

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Digital Systems Design Using Verilog

ISBN: 978-1285051079

1st edition

Authors: Charles Roth, Lizy K. John, Byeong Kil Lee

Question Posted: