0% found this document useful (0 votes)
27 views4 pages

CMOS Logic Gates and Test Benches

Uploaded by

2910kirtana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

CMOS Logic Gates and Test Benches

Uploaded by

2910kirtana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CMOS INV :

module cmos_inv_03(f,x);
input x;
output f;
supply1 vdd;
supply0 gnd;
pmos p1(f,vdd,x);
nmos n1(f,gnd,x);
endmodule

TEST BENCH :

module inv03_tb_v;
reg x;
wire f;
cmos_inv_03 uut (
.f(f),
.x(x)
);

initial begin
x = 0;
#100;
x=1;
#100;
end
endmodule

OUTPUT :

Total memory usage is 150804 kilobytes

Number of errors : 2 ( 0 filtered)


Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)
CMOS NAND :

module cmos_nand_03(z,x,y);
input x,y;
output z;
supply1 vdd;
supply0 gnd;
wire a;
pmos p1(z,vdd,x);
pmos p2(z,vdd,y);
nmos n1(z,a,x);
nmos n2(a,gnd,y);
endmodule

TEST BENCH :

module nand03_tb_v;
reg x;
reg y;
wire z;
cmos_nand_03 uut (
.z(z),
.x(x),
.y(y));
initial begin
x = 0; x=0; x=1; x=1;
y = 0; y=1; y=0; y=1;
#100; #100 #100 #100
end
endmodule

OUTPUT :

Total memory usage is 151636 kilobytes

Number of errors : 4 ( 0 filtered)


Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)
CMOS NOR :

module cmos_nor_03(z,x,y);
input x,y;
output z;
wire a;
supply1 vdd;
supply0 gnd;
pmos p1(a,vdd,y);
pmos p2(z,a,x);
nmos n1(z,gnd,x);
nmos n2(z,gnd,y);
endmodule

TEST BENCH :

module nor03_tb_v;
reg x;
reg y;
wire z;
cmos_nor_03 uut (
.z(z),
.x(x),
.y(y));
initial begin
x = 0; y = 0; #100;
x=0; y=1; #100;
x=1; y=1; #100;
x=1; y=0; #100;
end
endmodule

OUTPUT :

Total memory usage is 151188 kilobytes

Number of errors : 4 ( 0 filtered)


Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)
COMS MUX :

module cmos_mux_03(out,s,i0,i1);
input s,i0,i1;
output out;
wire sbar;
not(sbar,s);
cmos(out,i0,sbar,s);
cmos(out,i1,s,sbar);
endmodule

TEST BENCH :
module mux_03tb_v;
reg s;
reg i0;
reg i1;
wire out;
cmos_mux_03 uut (
.out(out),
.s(s),
.i0(i0),
.i1(i1));
initial begin
s = 0; i0 = 0; i1 = 0; #100;
s = 0; i0 = 0; i1 = 1; #100;
s = 0; i0 = 1; i1 = 0; #100;
s = 0; i0 = 1; i1 = 1; #100;
s = 1; i0 = 0; i1 = 0; #100;
s = 1; i0 = 0; i1 = 1; #100;
s = 1; i0 = 1; i1 = 0; #100;
s = 1; i0 = 1; i1 = 1; #100;
end
endmodule

OUTPUT :

Total memory usage is 151572 kilobytes

Number of errors : 2 ( 0 filtered)


Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)

You might also like