HALF ADDER:
module half_adder(sum,carry,a,b)
input a,b;
output reg sum,carry;
always@({a,b})
begin
if(a !=b)
sum =1'b1;
else
sum =1'b0;
case({a,b})
2'b11 :carry =1'b1;
default :carry =1'b0;
endcase
end
endmodule
FOR MORE DETAIL CLICK HERE
FIG1. BLOCK DIAGRAM
TRUTH TABLE:
module half_adder(sum,carry,a,b)
input a,b;
output reg sum,carry;
always@({a,b})
begin
if(a !=b)
sum =1'b1;
else
sum =1'b0;
case({a,b})
2'b11 :carry =1'b1;
default :carry =1'b0;
endcase
end
endmodule
FOR MORE DETAIL CLICK HERE
No comments:
Post a Comment