// addsub4_sim.v
// addsub4 simulation module
module addsub4_sim;
    reg [3:0]  i1, i2;
    reg        c;
    wire [3:0] o;
    wire       co;

    addsub4 a1(.a(i1), .b(i2), .cin(c), .s(o), .cout(co));

    initial begin
		c  <= 4'h0;
		i1 <= 4'h0;
		i2 <= 4'h0;
		#100
		i1 <= 4'h1;
		i2 <= 4'h9;
		#100
		i1 <= 4'h7;
		i2 <= 4'h8;
		#100
		i1 <= 4'ha;
		i2 <= 4'hd;
		#100
		c  <= 1'b1;
		#100
		i1 <= 4'h2;
		i2 <= 4'h4;
		#100
		i1 <= 4'hc;
		i2 <= 4'h3;
		#100
		i1 <= 4'h4;
		i2 <= 4'h4;
		#100
		$finish;
    end

    initial
        $monitor($time,,,"cin=%b a=%x b=%x -> s=%x cout=%b",
                 c, i1, i2, o, co); 	
endmodule
