module ha( a, b, cout, sum); input a, b; output cout, sum; assign cout = a & b; assign sum = a ^ b; // xor g1 (sum, a, b); // and g2 (cout, a, b); endmodule `timescale 1ns / 1ns module ha_tb; reg a, b; wire cout, sum; ha u1 ( a, b, cout, sum ); initial begin {a, b} = 2'b00; #10 {a, b} = 2'b01; #10 {a, b} = 2'b10; #10 {a, b} = 2'b11; #10 $stop; end initial $monitor($time, "ns, a=%b, b=%b, cout=%b, sum=%b", a, b, cout, sum); endmodule