Hello,
I have to implement a 4-bit adder using only nmos and pmos...I am combining 3 NANDs and 3 invertors for this, but I am not allowed to put them in different modules. Here's the code I wrote:
Code:module andmod4(in1, in2, in3, in4, out);
input in1;
input in2;
input in3;
input in4;
output out;
supply1 vdd;
supply0 gnd;
//nand(in1, in2, w1);
pmos(w1, vdd, in1);
pmos(w1, vdd, in2);
nmos(w1, i1, in1);
nmos(i1, gnd, in2);
//inv(w1, w2);
pmos(w2,vdd,w1);
nmos(w2,vss,w1);
//nand(w2, in3, w3);
pmos(w3, vdd, w2);
pmos(w3, vdd, in3);
nmos(w3, i2, w2);
nmos(i2, gnd, in3);
//inv(w3, w4);
pmos(w4,vdd,w3);
nmos(w4,vss,w3);
//nand(w4, in4, w5);
pmos(w5, vdd, w4);
pmos(w5, vdd, in4);
nmos(w5, i3, w4);
nmos(i3, gnd, in4);
//inv(w5, out);
pmos(out,vdd,w5);
nmos(out,vss,w5);
endmodule
, but when I test it I get nothing but x and z at the output (except for the case when all inputs are 1 -> I get 1 at output).
Any ideas why this doesn't work?
Thanks,
Claudiu
Edit: the module works for only 2 bits, so I don't think NAND or the inversor is the problem, but the wiring between them (or some other aspect of Verilog that I'm not aware of)