as01d2.v
1.12 KB
module as01d2 (s, co, b, add, a, ci);
input b, add, a, ci;
output s, co;
`ifdef SYNTH
reg is, ico;
buf (s,is);
buf (co,ico);
always @(a or b or add or ci)
case (add)
1'b0: {ico,is} = a - b - ~ci; // subtract - c should be high
1'b1: {ico,is} = a + b + ci; // add
endcase
`else
nand G2(N2, N16, N17);
or G5(co, N6, N8);
and G6(N6, a, N13),
G8(N8, ci, N12);
nand G9(N9, add, b),
G10(N10, N24, N25);
or G12(N12, a, N2);
nand G13(N13, N26, N9);
or G16(N16, add, b);
nand G17(N17, add, b);
or G18(N18, N23, ci);
nand G19(N19, N23, ci);
and G20(s, N18, N19);
or G21(N21, a, N10);
nand G22(N22, a, N10);
and G23(N23, N21, N22);
or G24(N24, add, b);
nand G25(N25, add, b);
or G26(N26, add, b);
`endif
endmodule