The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:25pm
Pages: 1
Send Topic Print
4-bit adder using pmos and nmos (Read 1918 times)
Claudiu
New Member
*
Offline



Posts: 2
Bucharest
4-bit adder using pmos and nmos
Mar 27th, 2011, 11:41pm
 
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)
Back to top
 
 
View Profile   IP Logged
Claudiu
New Member
*
Offline



Posts: 2
Bucharest
Re: 4-bit adder using pmos and nmos
Reply #1 - Mar 28th, 2011, 1:13am
 
Sorry, my mistake, because of a copy-paste error (I put vss in some places where gnd should have been)
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.