Half Adder and Full Adder (Dataflow Modeling)
Half Adder (Dataflow Modeling):
module halfadder(
input a,
input b,
output sum,
output carry );
assign sum=a ^ b ;
assign carry=a & b;
endmodule
Full Adder (Dataflow Modeling):
module fulladder(
input a,
input b,
input cin,
output sum,
output carry );
assign x=a ^ b;
assign sum=x^cin;
assign y=x & cin;
assign z=a & b;
assign carry= y | z;
endmodule
No comments:
Post a Comment