Vlsi Lab Manual: Department of Information Technology
Vlsi Lab Manual: Department of Information Technology
----------------------------------------------------------------------------------------------------------------
1
VLSI LAB DCET TANVEER SULTANA
2
VLSI LAB DCET TANVEER SULTANA
INTRODUCTION
3
VLSI LAB DCET TANVEER SULTANA
18 Four inputs and gate using two inputs cmos nand2 & nor using mixed
level modeling
19 Decoder 2:4 using 2 inputs cmos and2 gate using mixed level modeling
BEHAVIORAL MODELING
24 MOORE FSM
4
VLSI LAB DCET TANVEER SULTANA
HDL -> Hardware description language allows us to specify the components that makeup
instead of having to use a pictorial representation like a block or logic diagram. Every
component is defined by its input and output part logic function. It performs and timing
characteristics such as delay and clocking. An entire digital system can described in text
format using prescribed set of roles and keywords (reserved words).
5
VLSI LAB DCET TANVEER SULTANA
6
VLSI LAB DCET TANVEER SULTANA
7
VLSI LAB DCET TANVEER SULTANA
8
VLSI LAB DCET TANVEER SULTANA
9
VLSI LAB DCET TANVEER SULTANA
10
VLSI LAB DCET TANVEER SULTANA
10. Give the input and output parameters. Then click on [Next].
11
VLSI LAB DCET TANVEER SULTANA
12
VLSI LAB DCET TANVEER SULTANA
14. Run ‘Check Syntax’ to check the syntax of the written verilog code.
13
VLSI LAB DCET TANVEER SULTANA
15. Goto ‘Simulation’ in view pane. Then right click again in ‘Hierarchy’ and select ‘New
Source...’.
16. Select ‘Verilog Test Fixture’ and give a name to the file. Then click on [Next].
14
VLSI LAB DCET TANVEER SULTANA
17. Select the Verilog code module that was created before and click on [Next].
15
VLSI LAB DCET TANVEER SULTANA
20. Run the ‘Behavioral Check Syntax’ and ‘Simulate Behavioral Model’.
16
VLSI LAB DCET TANVEER SULTANA
17
VLSI LAB DCET TANVEER SULTANA
AIM: To design NOT logic gate in switch level modeling using verilog code
Description: The NOT or INVERT function is often considered the simplest Boolean
operation.
➔ NOT logic gate Cmos is built using one PFET and one NFET. Gate input ‘a’ is given
common to both FETS and o/p ‘f’ is drawn connecting both FETS in series.
➔ If gate i/p a=0 then PFET mp is ON and NFET mn is off. This connect the o/p node
‘f’ to power supply voltage VDD (i/p) giving an o/p f=1
➔ If the gate i/p a=1 then NFET mn is on and PFET mp is off. This connect the o/p node
f to ground (i/p).
Expression for o/p:
f = 𝑎̅ . 1 + a . 0 = 𝑎̅
f = NOT ( a ) = 𝑎̅
NOT GATE:
Symbol:
CMOS Diagram:
18
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE:
INPUT OUTPUT
a f
0 1
1 0
//Verilog code:
module cmosnot(x,y);
input x;
output y;
Supply1 vdd;
Supply2 gnd;
pmos p1(y,vdd,x);
nmos n1(y,gnd,x);
endmodule
///test bench
module tbcmosnot;
reg x;
wire y;
cmosnot cl(y,x);
initial begin
a=0;
#50; a=1;
end
initial
$monitor($time,”x=%b y=%b”,x,y);
endmodule
19
VLSI LAB DCET TANVEER SULTANA
Description: NAND gate is called as universal gate. NAND2 logic gate Cmos circuit is built
using 2 parallel connected PFET and 2 series connected NFET.
➔ If gate inputs a = b = 1 then PFET are off [p1 & p2] and NFET [n1 & n2] are ON.
This connecting ground (i/p) to o/p node f = 0.
➔ If either of gate inputs is zero then o/p node f=1.
➔ NAND gate is complement of NOR gate.
➔ NAND function is negation of ‘and’ function.
Expression for o/p:
f (a , b)= 𝑎̅ . 1 + 𝑏̅ . 1+ a . b . 0
f = ̅𝑎 + 𝑏̅ =𝑎. 𝑏
f = 𝑎 .𝑏
SYMBOL:
CMOS DIAGRAM:
20
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE:
INPUT OUTPUT
a b f
0 0 1
0 1 1
1 0 1
1 1 0
//Verilog code:
module cmosnand2 (
input a,
input b,
output f
);
wire wn;
supply1 vdd;
supply0 gnd;
pmos p1(f,vdd,a);
pmos p2(f,vdd,b);
nmos n1(f,wn,a);
nmos n2(wn,gnd,b);
endmodule
//Test bench
module tbcmosnand2;
reg a,b;
wire f;
cmosnand2 n3(f,a,b);
initial begin
21
VLSI LAB DCET TANVEER SULTANA
{a,b}=2’b00;
#50 {a,b}=2’b01;
#50 {a,b}=2’b10;
#50 {a,b}=2’b11;
end
initial
$monitor($time,”a=%b b=%b f=%b”,a,b,f);
Endmodule
22
VLSI LAB DCET TANVEER SULTANA
AIM:- To design NOR logic gate in Switch level modeling using verilog code.
NOR2 logic gate CMOS circuit is built using two series PFET (p1&p2) and two parallel
connected NFET (n1&n2).
If both inputs a=b=0 then PFET p1&p2 are ON and NFETS (n1&n2) are off. This connects
the VDD input to output node f=1
f(a,b)= . =
f=
SYMBOL:
CMOS DIAGRAM:
23
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE:
INPUT OUTPUT
a b f
0 0 1
0 1 0
1 0 0
1 1 0
//Verilog code:
module NOR2(
input a,
input b,
output f
);
wire wp;
supply1 vdd;
supply0 gnd;
pmos p1(wp,vdd,a);
pmos p2(f,wp,b);
nmos n1(f,gnd,a);
nmos n2(f,gnd,b);
endmodule
//Test bench
module tbcmosnor2;
24
VLSI LAB DCET TANVEER SULTANA
reg a,b;
wire f;
cmosnor2 n3(f,a,b);
initial begin
{a,b}=2’b00;
#50 {a,b}=2’b01;
#50 {a,b}=2’b10;
#50 {a,b}=2’b11;
end
initial
$monitor($time,”a=%b b=%b f=%b”,a,b,f);
Endmodule
25
VLSI LAB DCET TANVEER SULTANA
26
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE(AOI)
INPUT OUTPUT
a b c d f
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 1 1 0
0 1 1 0 1
0 1 1 1 0
1 0 0 0 1
27
VLSI LAB DCET TANVEER SULTANA
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
//Verilog code:
module oai(
input a,
input b,
input c,
input d,
output f
);
wire wp,wn2,wn1;
supply1 vdd;
supply0 gnd;
pmos p1(wp,vdd,a);
pmos p2(fwp,vdd,b);
pmos p3(f,wp,c);
pmos p4(f,wp,d);
nmos n1(f,wn1,a);
nmos n2(wn1,gnd,b);
nmos n3(f,wn2,c);
28
VLSI LAB DCET TANVEER SULTANA
nmos n4(wn2,gnd,d);
endmodule
Test bench
module tbaoi;
// Inputs
reg a;
reg b;
reg c;
reg d;
// Outputs
wire f;
aoi uut (
.a(a),
.b(b),
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
{a,b,c,d}=4'b0000;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
#50 {a,b,c,d}=4'b0011;
29
VLSI LAB DCET TANVEER SULTANA
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
30
VLSI LAB DCET TANVEER SULTANA
AIM:-To design OAI gate in Switch level modeling using verilog code.
DESCRIPTION:- CMOS inverting nature allows to construct logic circuit for OAI
function
OAI is complement of AOI.
OAI function performs the operation in order OR->AND->INVERTER.
OAI is also called as inverted POS (Product Of Sum).
OAI CMOS circuit is built using Series-Parallel connected FETS.
p1.p2, p3.p4, p5.p6 are connected in series.
f= (a+b).(a+c).(b+d)
TRUTH TABLE(OAI)
31
VLSI LAB DCET TANVEER SULTANA
INPUT OUTPUT
A b c d F
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 0
0 1 1 1 0
1 0 0 0 1
1 0 0 1 0
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
//Verilog code:
32
VLSI LAB DCET TANVEER SULTANA
module oai(
input a,
input b,
input c,
input d,
output f
);
wire wp1,wp2,wn;
supply1 vdd;
supply0 gnd;
pmos p1(wp1,vdd,a);
pmos p2(f,wp1,b);
pmos p3(wp2,vdd,c);
pmos p4(f,wp2,d);
nmos n1(f,wn,a);
nmos n2(f,wn,b);
nmos n3(wn,gnd,c);
nmos n4(wn,gnd,d);
endmodule
Test bench
module tboai;
// Inputs
reg a;
reg b;
reg c;
reg d;
33
VLSI LAB DCET TANVEER SULTANA
// Outputs
wire f;
oai uut (
.a(a),
.b(b),
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
{a,b,c,d}=4'b0000;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
34
VLSI LAB DCET TANVEER SULTANA
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
35
VLSI LAB DCET TANVEER SULTANA
Thus the transmission gate acts as a “closed” switch when VC = 1, while the gate acts
as an “open” switch when VC = 0 operating as a voltage-controlled switch. The
bubble of the symbol indicating the gate of the PMOS FET.
36
VLSI LAB DCET TANVEER SULTANA
// Verilog code:
module cmostg(
input x,
input s,
output y
);
supply1 vdd;
supply0 gnd;
pmos p1(y,x,~s);
nmos n1(y,x,s);
endmodule
test bench
module tbcmostg;
// Inputs
reg x;
reg s;
// Outputs
wire y;
cmostg uut (
.x(x),
.s(s),
.y(y)
);
initial begin
37
VLSI LAB DCET TANVEER SULTANA
// Initialize Inputs
{s,x}=2'b00;
#50 {s,x}=2'b01;
#50 {s,x}=2'b10;
#50 {s,x}=2'b11;
end
initial
Endmodule
38
VLSI LAB DCET TANVEER SULTANA
A transmission gate is constructed from a normally open switch (NMOS transistor) wired in
parallel with a normally closed switch (PMOS transistor), with complementary control signals.
A transmission gate is constructed from a normally open switch (NMOS transistor) wired in
parallel with a normally closed switch (PMOS transistor), with complementary control signals.
The two transmission gates work in tandem to realize a selector operation. Depending on the
state of the A input, either Input B or the inverted version of input B appears at the f (XOR)
output.
CIRCUIT DIAGRAM
TRUTH TABLE
39
VLSI LAB DCET TANVEER SULTANA
//verilog code
module xor2tg(
input a,
input b,
output f
);
wire a1=~a,b1=~b;
pmos p1(f,a,b);
pmos p2(f,a1,b1);
nmos n1(f,a,b1);
nmos n1(f,a1,b);
endmodule
40
VLSI LAB DCET TANVEER SULTANA
test bench
module tbxor2tg;
// Inputs
reg a;
reg b;
// Outputs
wire f;
xor2tg uut (
.a(a),
.b(b),
.f(f)
);
initial begin
// Initialize Inputs
{a,b}=2'b00;
#50 {a,b}=2'b01;
#50 {a,b}=2'b10;
#50 {a,b}=2'b11;
end
initial
endmodule
41
VLSI LAB DCET TANVEER SULTANA
8. CMOS complex logic gate implementation of function f= d’+a’b’c’ using switch level
modeling
Logic gates can be built up into chains of logical decisions. Some logic gates may have more
than two inputs. The diagram below shows a complex logic gate combining three simple
gates.
CIRCUIT SYMBOL
TRUTH TABLE
42
VLSI LAB DCET TANVEER SULTANA
//Verilog code
module cmoscl(
input a,
input b,
input c,
input d,
output f
);
wire wp1,wp2,wn;
supply1 vdd;
supply0 gnd;
pmos p1(wp1,vdd,a);
pmos p2(wp2,wp1,b);
pmos p3(f,wp2,c);
pmos p4(f,vdd,d);
nmos n1(f,wn,d);
nmos n2(wn,gnd,a);
nmos n3(wn,gnd,b);
nmos n4(wn,gnd,c);
endmodule
//test bench
module tbcmoscl;
// Inputs
reg a;
reg b;
reg c;
43
VLSI LAB DCET TANVEER SULTANA
reg d;
// Outputs
wire f;
cmoscl uut (
.a(a),
.b(b),
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
{a,b,c,d}=4'b0000;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
44
VLSI LAB DCET TANVEER SULTANA
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
45
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION: A half adder is a logical circuit that performs an addition on two binary
digits as inputs and produces an two binary digits outputs as Sum and Carryout.
➔ Half adder would be used to add the least Significant bits in ripple carry adder, as this
addition can have no carry input.
➔ It is significantly less complex than full adder.
➔ It saves on hardware in the situation where carry input is not needed.
Drawback:
➔ Half adder cannot be used for multi bit addition since it cannot include a carry input.
Equations or formula:
Sumout = a b
Carryout = Cout = a . b
Where a &b are inputs to half adder circuit and Sumout and Carryout are outputs.
SYMBOL:
46
VLSI LAB DCET TANVEER SULTANA
CIRCUIT DIAGRAM:
//Verilog code
module halfadd(
input a,
input b,
output s,
output c
);
xor(s,a,b);
and(c,a,b);
endmodule
// test bench
module tbhalfadd;
// Inputs
reg a;
reg b;
// Outputs
wire s;
wire c;
47
VLSI LAB DCET TANVEER SULTANA
halfadd uut (
.a(a),
.b(b),
.s(s),
.c(c)
);
initial begin
// Initialize Inputs
{a,b}=2'b00;
#50 {a,b}=2'b01;
#50 {a,b}=2'b10;
#50 {a,b}=2'b11;
end
initial
endmodule
48
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION: The 3-bit full adder circuit adds 3- one.bit binary number Cin, a, b as
inputs and produces an output two one bit numbers as Sumout and Carryout(Cout).
➔ Full adder is simply 2 half adders joined by an OR gate. The o/p of XOR gate is
called Sumout and o/p of AND gate is carry [ w2 & w3].
Advantages:
Sumout = a b Cin
SYMBOL:
49
VLSI LAB DCET TANVEER SULTANA
CIRCUIT DIAGRAM:
verilog code
module fulladder(
input a,
input b,
input ci,
output s,
output co
);
wire w1,w2,w3;
xor a1(s,a,b,ci);
and a2(w1,a,b);
and a3(w2,b,ci);
and a4(w3,ci,a);
or a5(co,w1,w2,w3);
endmodule
50
VLSI LAB DCET TANVEER SULTANA
test bench
module tbfulladder;
// Inputs
reg a;
reg b;
reg ci;
// Outputs
wire s;
wire co;
fulladder uut (
.a(a),
.b(b),
.ci(ci),
.s(s),
.co(co)
);
initial begin
// Initialize Inputs
{a,b,ci}=3'b000;
#50{a,b,ci}=3'b001;
#50{a,b,ci}=3'b010;
51
VLSI LAB DCET TANVEER SULTANA
#50{a,b,ci}=3'b011;
#50{a,b,ci}=3'b100;
#50{a,b,ci}=3'b101;
#50{a,b,ci}=3'b110;
#50{a,b,ci}=3'b111;
end
initial
endmodule
52
VLSI LAB DCET TANVEER SULTANA
AND-OR-Invert (AOI) logic and AOI gates are two-level compound (or complex) logic
functions constructed from the combination of one or more AND gates followed by a NOR
gate. Construction of AOI cells is particularly efficient using CMOS technology where the
total number of transistor gates can be compared to the same construction using NAND
logic or NOR logic. The complement of AOI Logic is OR-AND-Invert (OAI) logic where the
OR gates precede a NAND gate.
CIRCUIT SYMBOL
53
VLSI LAB DCET TANVEER SULTANA
//Verilog code
module aoigate(
input a,
input b,
input c,
input d,
output f
);
wire w1,w2;
and a1(w1,a,b);
and a2(w2,c,d);
nor a3(f,w1,w2);
endmodule
// test bench:
module tbaoigate;
// Inputs
reg a;
reg b;
reg c;
reg d;
// Outputs
wire f;
aoigate uut (
.a(a),
.b(b),
54
VLSI LAB DCET TANVEER SULTANA
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
55
VLSI LAB DCET TANVEER SULTANA
//Verilog code
module aoidelay(
input a,
input b,
input c,
input d,
output f
);
wire w1,w2;
56
VLSI LAB DCET TANVEER SULTANA
endmodule
//test bench
module tbaoidelay;
// Inputs
reg a;
reg b;
reg c;
reg d;
// Outputs
wire f;
aoidelay uut (
.a(a),
.b(b),
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
{a,b,c,d}=4'b0000;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
57
VLSI LAB DCET TANVEER SULTANA
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
58
VLSI LAB DCET TANVEER SULTANA
59
VLSI LAB DCET TANVEER SULTANA
//Verilog code
module oaigate(
input a,
input b,
input c,
input d,
output f
);
wire w1,w2;
or r1(w1,a,b);
or r2(w2,c,d);
nand r3(f,w1,w2);
endmodule
//test bench
module tboaigate;
// Inputs
reg a;
reg b;
reg c;
reg d;
// Outputs
wire f;
oaigate uut (
.a(a),
60
VLSI LAB DCET TANVEER SULTANA
.b(b),
.c(c),
.d(d),
.f(f)
);
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
61
VLSI LAB DCET TANVEER SULTANA
//Verilog code:
module oaidelay(
input a,
input b,
input c,
input d,
output f
);
wire w1,w2;
or #50 r1(w1,a,b);
62
VLSI LAB DCET TANVEER SULTANA
or #50 r2(w2,c,d);
endmodule
//Test bench:
module tboaidelay;
// Inputs
reg a;
reg b;
reg c;
reg d;
// Outputs
wire f;
oaidelay uut (
.a(a),
.b(b),
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
{a,b,c,d}=4'b0000;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
63
VLSI LAB DCET TANVEER SULTANA
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
endmodule
64
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION: Multiplier can be considered as multiple inputs and single output switch.
2:1 mux have 2 inputs and produces a single output depending upon the select input [s]
2:1 mux is designed using 2 buffers that is active low buffer and active high buffer
EXPRESSION :
out = 𝑝0 . 𝑠 + 𝑝1 . s
CIRCUIT DIAGRAM:
65
VLSI LAB DCET TANVEER SULTANA
INPUTS OUTPUT
P0 P1 S Out
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 1
//Verilog code
module mux21(
input a,
input b,
input s,
output f
);
bufif0 b1(f,a,s);
bufif1 b2(f,b,s);
endmodule
//test bench
module tbmux21;
// Inputs
reg a;
reg b;
66
VLSI LAB DCET TANVEER SULTANA
reg s;
// Outputs
wire f;
mux21 uut (
.a(a),
.b(b),
.s(s),
.f(f)
);
initial begin
// Initialize Inputs
{s,a}=2'b00;
#50 {s,a}=2'b01;
#50 {s,a}=2'b10;
#50 {s,a}=2'b11;
end
initial
endmodule
67
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION: SR Latch circuit is built making use of 2 NOR gate that are cross coupled
[i.e the output of one NOR gate is passed as an input to another NOR gate]
Usage:
➢ A Latch is a storage device that can receive and hold an input bit.
➢ A Latch is transparent [that is a change can be seen in outputs]
➢ SR Latch has 2 inputs S & L and produces two outputs Q and ~Q.
Disadvantages: When both inputs are one the outputs are invalid or undetermined state.
Q= R+Qbar
Qbar = S+Q
SYMBOL:
S SR Q bar
LATCH
R Q
LOGIC DIAGRAM:
68
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE
INPUTS OUTPUTS
S R Q Qbar
0 0 Previous previous
0 1 0 1
1 0 1 0
1 1 0 0
when S=0 and R=0 , the output Q will have the previous state.
//Verilog code
module srlatch(
input S,
input R,
output Q,
output Qbar
);
nor n1(Qbar,S,Q);
nor n2(Q,R,Qbar);
endmodule
69
VLSI LAB DCET TANVEER SULTANA
module tbsrlatch;
// Inputs
reg S;
reg R;
// Outputs
wire Q;
wire Qbar;
srlatch uut (
.S(S),
.R(R),
.Q(Q),
.Qbar(Qbar)
);
initial begin
// Initialize Inputs
{S,R}=2'b00;
#50 {S,R}=2'b01;
#50 {S,R}=2'b10;
end
initial
Endmodule
70
VLSI LAB DCET TANVEER SULTANA
//VERILOG CODE
module logicdfm(
input a,
input b,
output c,
output d,
output e,
output f,
71
VLSI LAB DCET TANVEER SULTANA
output g,
output h
);
assign c=a&b;
assign d=a|b;
assign e=a^b;
assign f=~(a&b);
assign g=~(a|b);
assign h=~(a^b);
endmodule
//TEST BENCH
module tblogicdfm;
// Inputs
reg a;
reg b;
// Outputs
wire c;
wire d;
wire e;
wire f;
wire g;
wire h;
logicdfm uut (
.a(a),
.b(b),
72
VLSI LAB DCET TANVEER SULTANA
.c(c),
.d(d),
.e(e),
.f(f),
.g(g),
.h(h)
);
initial begin
// Initialize Inputs
{a,b}=2'b00;
#50 {a,b}=2'b01;
#50 {a,b}=2'b10;
#50 {a,b}=2'b11;
end
initial
Endmodule
73
VLSI LAB DCET TANVEER SULTANA
18`. FOUR INPUTS AND GATE USING TWO INPUTS CMOS NAND2 & NOR USING
MIXED LEVEL MODELING
//VERILOG CODE
//NAND2
module mlmnand2(
input a,
input b,
output f
);
wire wn;
supply1 vdd;
supply0 gnd;
pmos p1(f,vdd,a);
pmos p2(f,vdd,b);
nmos n1(f,wn,a);
nmos n2(wn,gnd,b);
endmodule
//NOR2
module mlmNOR2(
input a,
input b,
output f
);
wire wp;
74
VLSI LAB DCET TANVEER SULTANA
supply1 vdd;
supply0 gnd;
pmos p1(wp,vdd,a);
pmos p2(f,wp,b);
nmos n1(f,gnd,a);
nmos n2(f,gnd,b);
endmodule
//AND4
module mlmAND4(
input a,
input b,
input c,
input d,
output f
);
wire w1,w2;
mlmnand2 n1(w1,a,b);
mlmnand2 n2(w2,c,d);
mlmNOR2 n3(f,w1,w2);
endmodule
//TEST BENCH
module tbAND4;
// Inputs
reg a;
reg b;
75
VLSI LAB DCET TANVEER SULTANA
reg c;
reg d;
// Outputs
wire f;
mlmAND4 uut (
.a(a),
.b(b),
.c(c),
.d(d),
.f(f)
);
initial begin
// Initialize Inputs
{a,b,c,d}=4'b0000;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0010;
#50 {a,b,c,d}=4'b0011;
#50 {a,b,c,d}=4'b0001;
#50 {a,b,c,d}=4'b0100;
#50 {a,b,c,d}=4'b0101;
#50 {a,b,c,d}=4'b0110;
#50 {a,b,c,d}=4'b0111;
#50 {a,b,c,d}=4'b1000;
76
VLSI LAB DCET TANVEER SULTANA
#50 {a,b,c,d}=4'b1001;
#50 {a,b,c,d}=4'b1010;
#50 {a,b,c,d}=4'b1011;
#50 {a,b,c,d}=4'b1100;
#50 {a,b,c,d}=4'b1101;
#50 {a,b,c,d}=4'b1110;
#50 {a,b,c,d}=4'b1111;
end
initial
Endmodule
77
VLSI LAB DCET TANVEER SULTANA
19. DECODER 2:4 USING 2 INPUTS CMOS AND2 GATE USING MIXED LEVEL
MODELING
DESCRIPTION: A decoder is a device which does the reverse of an encoder, undoing the
encoding so that original information can be retrieved decoder is a multiple input, multiple
output logic. Circuit that converts coded inputs into coded outputs where the input and output
codes are different. Ex: n to 2n, BCD decoders.
(2) Active low decoder: It set zero on the selected line and keep others at 1.
Simplest decoder circuit would be AND gate because the output of AND gate is high.
(1) Only when all its inputs are high such output is called as active high output.
2-4 binary decoder have 2 inputs lines s0 and s1 that combinationally pass through 4
𝑑0 = 𝑠1 .𝑠0
𝑑1 = 𝑠1 .𝑠0
𝑑2 =𝑠1 .𝑠0
𝑑3 = 𝑠1 .𝑠0
SYMBOL:
s1 s0
2:4
d0
d1
Binary
d2
decoder d3
78
VLSI LAB DCET TANVEER SULTANA
CIRCUIT DIAGRAM
Input Outputs
s1 s0 d0 d1 d2 d3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
79
VLSI LAB DCET TANVEER SULTANA
//VERILOG CODE
//CMOS AND2
module cmosand2(
input a,
input b,
output f
);
wire wn,g;
supply1 vdd;
supply0 gnd;
pmos p1(g,vdd,a),p2(g,vdd,b),p3(f,vdd,g);
nmos n1(g,wn,a),n2(wn,gnd,b),n3(f,gnd,g);
endmodule
module dec24(
input w0,
input w1,
output d0,
output d1,
output d2,
output d3
);
cmosand2 a1(d3,~w0,~w1);
cmosand2 a2(d2,~w0,w1);
cmosand2 a3(d1,w0,~w1);
cmosand2 a4(d0,w0,w1);
80
VLSI LAB DCET TANVEER SULTANA
endmodule
//TEST BENCH
module tbdec24;
// Inputs
reg w0;
reg w1;
// Outputs
wire d0;
wire d1;
wire d2;
wire d3;
dec24 uut (
.w0(w0),
.w1(w1),
.d0(d0),
.d1(d1),
.d2(d2),
.d3(d3)
);
initial begin
// Initialize Inputs
{w1,w0}=2'b00;
#50 {w1,w0}=2'b01;
#50 {w1,w0}=2'b10;
81
VLSI LAB DCET TANVEER SULTANA
#50 {w1,w0}=2'b11;
end
initial
Endmodule
82
VLSI LAB DCET TANVEER SULTANA
4:1 mux is built using 4 AND gates, 2 NOT gate and one OR gate.
Each AND gate has 3 inputs[ that is 4 inputs a to d is applied to one input of AND gate, 2
inputs are select inputs to AND gate]
Select lines s0 ans s1 are decoded to select a particular AND gate to produce an output of
EXPRESSION
f = (a . 𝑠0 . 𝑠1 ) + (b . 𝑠0 . 𝑠1 ) + (c . 𝑠0 . 𝑠1 ) + (d . 𝑠0 . 𝑠1 )
SYMBOL:
83
VLSI LAB DCET TANVEER SULTANA
CIRCUIT DIAGRAM:
TRUTH TABLE:
INPUTS OUTPUT
S1 S0 d c b a f
0 0 0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
1 1 0 1 1
0 1 0 0 0 0 0
0 0 0 1 0
0 1 1 0 1
1 0 0 0 0 0 0
0 0 0 1 0
0 1 0 1 1
84
VLSI LAB DCET TANVEER SULTANA
1 0 1 1 0
1 1 0 1 1 1 0
0 0 0 1 0
1 1 1 1 1
1 0 0 0 1
//VERILOG
module MUX41(
input [3:0]a,
input b,
input c,
input d,
input [1:0]s,
output [3:0]f
);
reg [3:0]f;
always@(s or a or b or c or d)
case(s)
2'b00:f=a;
2'b01:f=b;
2'b10:f=c;
2'b11:f=d;
endcase
endmodule
//TEST BENCH
module tbMUX41;
// Inputs
85
VLSI LAB DCET TANVEER SULTANA
reg [3:0] a;
reg b;
reg c;
reg d;
reg [1:0] s;
// Outputs
wire [3:0] f;
MUX41 uut (
.a(a),
.b(b),
.c(c),
.d(d),
.s(s),
.f(f)
);
initial begin
// Initialize Inputs
a = 10;
b =11;
c = 12;
d = 13;
s = 0;
#50 s=1;
#50 s=2;
86
VLSI LAB DCET TANVEER SULTANA
#50 s=3;
end
initial
Endmodule
87
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION :flipflop is a storage device which can hold or store 1 bit numbers.
A flipflop differs from latch in that it is nontransperent. D flipflop(DFF) is most commonly
(clk) is directly given to slave and (~clk)is given to master outputs .outputs of master are
given to slave and slave outputs are q and q-bar.additionally preset and clear intput is given to
master to preset the output q=1 and clear the output q=0.
LOGICAL SYMBOL:
CIRCUIT DIAGRAM:
88
VLSI LAB DCET TANVEER SULTANA
pr
q_bar w1 w3 w5
d q
master slave
clk
q_bar
q w2 w4 w6
cr
Inputs Output
D Clk Pr Cr q q bar
0 1 1 1 0 1
1 1 1 1 1 0
0 1 0 1 1 0
0 0 1 1 0 1
1 0 1 1 1 0
1 1 1 0 0 1
X 0 1 0 0 1
89
VLSI LAB DCET TANVEER SULTANA
module dff(q,d,clk);
input d,clk;
output q;
reg q;
always@(posedgeclk)
q=d;
endmodule
//TEST BENCH
module tbdff;
reg d,clk;
wire q;
dff dl(q,d,clk);
initial
clk=1’b0;
always
#50 clk=~clk;
initial begin
d=0;
#50 d =1;
#50 d =0;
#50 d =1;
end
initial
$monitor ($time, ”clk=%b d=%b q=%b”,clk,d,q);
Endmodule
90
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION:
Flip flop is a storage element based on gated latch principle which can have it’s output state
changed only on the edge of controlling clock signal.
LOGIC SYMBOL
91
VLSI LAB DCET TANVEER SULTANA
CIRCUIT DIAGRAM:
TRUTH TABLE:
Inputs Outputs
j k Pr Cr Clk Q Qbar
X X 1 0 1 0 1
0 0 1 1 1 0 1
0 1 1 1 1 0 1
1 0 1 1 1 1 0
1 1 1 1 1 1/0 0/0
When both pr and cr=1 and j=0 and k=1, the flip flop is in reset state.
When both pr and cr=1 and j=1 and k=0, the flip flop is in set state.
When both pr and cr=1 and j=1 and k=1, the flip flop is in toggle state.
module JKff(q,j,k,clk);
92
VLSI LAB DCET TANVEER SULTANA
input j,k,clk;
output q;
reg q;
always@(posedgeclk)
case({j,k})
2’b00:q=q;
2’b01:q=0;
2’b10:q=1;
2’b11:q=~q;
endcase
endmodule
//TEST BENCH
module tbjkff;
reg j,k,clk;
wire q;
jkff j1(q,j,k,clk);
initial
clk=1’b0;
always
#50 clk=~clk;
initial begin
{j,k}=2’b00;
#50 {j,k}=2’b01;
#50 {j,k}=2’b10;
#50 {j,k}=2’b11;
#50 {j,k}=2’b00;
end
initial
$monitor ($time, ”clk=%b j=%b k=%b q=%b”,clk,j,k,q);
endmodule
93
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION: A priority encoder examines the input bits of an n bit word and produces
an output that indicates the position of highest priority Logic 1 bit.
4 bit priority encoder is a circuit basically converts the 4 bit input into 2 bit binary
representation. If the input ‘n’ is active, all lower inputs (n-1….0) are ignored.
Circuit function does not depend at all on least significant input bit.
APPLICATIONS:
They are used when multiple components(eg: processor, memory, I/O devices, etc) are to
share a common resource(eg: a bus). Each component is assigned certain priority whenever
there is conflict, the highest priority component will be granted usage of resource.
𝑦1 = 1 . 𝑥3 + 𝑥3 𝑥2 . 1 + 𝑥3 𝑥2 𝑥1 . 0 + 𝑥3 𝑥2 𝑥1 . 0
𝑦1 = 𝑥3 + 𝑥3 𝑥2
𝑦0 = 1 . 𝑥3 + 𝑥3 𝑥2 . 0 + 𝑥3 𝑥2 𝑥1 . 1 + 𝑥3 𝑥2 𝑥1 . 0
𝑦0 = 𝑥3 + 𝑥3 𝑥2 𝑥1
SYMBOL
94
VLSI LAB DCET TANVEER SULTANA
CIRCUIT DESIGN
x0 is dummy
TRUTH TABLE
Input output
x3 x2 x1 x0 y1 y0
1 x x x 1 1
0 1 x x 1 0
0 0 1 x 0 1
0 0 0 x 0 0
95
VLSI LAB DCET TANVEER SULTANA
//Verilog
module pe83(
input [7:0]d,
output [2:0]q,
output q3
);
reg[2:0]q;
reg q3;
always @(d)
begin
q3=1;
if(d[7]) q=7;
else
begin
q3=0;
q=3'bxxx;
end
end
endmodule
96
VLSI LAB DCET TANVEER SULTANA
//TEST BENCH:
module tbpe83;
// Inputs
reg [7:0] d;
// Outputs
wire [2:0] q;
wire q3;
pe83 uut (
.d(d),
.q(q),
.q3(q3)
);
#50 d=8'b00000010;
#50 d=8'b00000100;
#50 d=8'b00001000;
#50 d=8'b00010000;
#50 d=8'b00100000;
#50 d=8'b01000000;
end
initial
endmodule
97
VLSI LAB DCET TANVEER SULTANA
• Mealy State Machine : Its output depends on current state and current inputs. In the
above picture, the blue dotted line makes the circuit a mealy state machine.
• Moore State Machine : Its output depends on current state and current inputs. In the
above picture, the blue dotted line makes the circuit a mealy state machine.
98
VLSI LAB DCET TANVEER SULTANA
//Verilog.
module moorefsm(
input clk,
input data_in,
input reset,
);
reg [2:0]state;
// Declare states
parameter S0 = 0, S1 = 1, S2 = 2, S3 = 3, S4 = 4;
if (reset)
else
case (state)
S0:
if (data_in)
else
S1:
if (data_in)
99
VLSI LAB DCET TANVEER SULTANA
else
S2:
if (data_in)
else
S3:
if (data_in)
else
S4:
if (data_in)
else
case (state)
S0:
data_out = 1'b0;
S1:
data_out = 1'b1;
100
VLSI LAB DCET TANVEER SULTANA
S2:
data_out = 1'b0;
S3:
data_out = 1'b1;
S4:
data_out = 1'b1;
default:
data_out = 1'b0;
endmodule
//Test bench.
module tbmoorefsm;
// Inputs
reg clk;
reg data_in;
reg reset;
// Outputs
wire data_out;
moorefsm uut (
.clk(clk),
.data_in(data_in),
.reset(reset),
.data_out(data_out)
);
101
VLSI LAB DCET TANVEER SULTANA
initial
// Initialize Inputs
// clk = 0;
// data_in = 0;
// reset = 0;
// #100;
clk=1'b0;
always
#50 clk=~clk;
initial begin
reset=0;
#50 reset=1;data_in=0;
#50 data_in=1;
end
initial
endmodule
102
VLSI LAB DCET TANVEER SULTANA
DESCRIPTION: Adding two n-bit words yields an n-bit sum and carry-out bit Cn that can
either be used as carry-in to another higher order adder or act as an overflow flag.
An n-bit ripple carry adders requires n-full adders with carry-out bit Ci+1 used as carry-in bit
to next column.
c3 c2 c1 c0
+ a3 a2 a1 a0
+ b3 b2 b1 b0
c4 s3 s2 s1 s0
ADVANTAGE:
Carryout=cout=𝑎𝑖 . 𝑏𝑖 +𝑐𝑖 .( 𝑎𝑖 ⊕ 𝑏𝑖 )
DEMERITS:
Since the output of any full adder is not valid until the incoming carry bit is valid(calculated).
103
VLSI LAB DCET TANVEER SULTANA
LOGIC SYMBOL
+ :indicate fulladder
104
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE:
module half_adder(
output S,
output C,
input A,
input B
);
xor(S,A,B);
and(C,A,B);
endmodule
module full_adder(
output S,
105
VLSI LAB DCET TANVEER SULTANA
output Cout,
input A,
input B,
input Cin
);
wire s1,c1,c2;
half_adder HA1(s1,c1,A,B);
half_adder HA2(S,c2,s1,Cin);
or OG1(Cout,c1,c2);
endmodule
module ripple_adder_4bit(
output Cout,
input [3:0] A,
input [3:0] B,
input Cin
);
wire c1,c2,c3;
full_adder FA1(Sum[0],c1,A[0],B[0],Cin),
FA2(Sum[1],c2,A[1],B[1],c1),
FA3(Sum[2],c3,A[2],B[2],c2),
FA4(Sum[3],Cout,A[3],B[3],c3);
endmodule
//Test bench.
module test_ripple_adder_4bit;
106
VLSI LAB DCET TANVEER SULTANA
// Inputs
reg [3:0] A;
reg [3:0] B;
reg Cin;
// Outputs
wire Cout;
ripple_adder_4bit uut (
.Sum(Sum),
.Cout(Cout),
.A(A),
.B(B),
.Cin(Cin)
);
initial begin
// Initialize Inputs
A = 0;
B = 0;
Cin = 0;
#100;
#35 A=4'b0000;B=4'b0000;Cin=0;
#35 A=4'b0001;B=4'b0000;Cin=1;
#35 A=4'b1100;B=4'b1100;Cin=1;
107
VLSI LAB DCET TANVEER SULTANA
#35 A=4'b1100;B=4'b1100;Cin=0;
#35 A=4'b1101;B=4'b1101;Cin=1;
#30 A=4'b0001;B=4'b1000;Cin=1;
#30 A=4'b0000;B=4'b1111;Cin=1;
#30 A=4'b1100;B=4'b1100;Cin=0;
#30 A=4'b0000;B=4'b0111;Cin=1;
initial begin
end
endmodule
108
VLSI LAB DCET TANVEER SULTANA
Description
In parallel adders, carry output of each full adder is given as a carry input to the next higher-
order state. Hence, these adders it is not possible to produce carry and sum outputs of any
state unless a carry input is available for that state.
Circuit diagram
Truth table
DESCRIPTON: CLA algorithm is based on the origin of the carryout bit in the equation
ci+1 = ai.bi + ci . (ai^bi)
In CLA the sumout and carryout equations are written in terms of generate and propagate
terms.
Generate term ‘gi’ is used since inputs one viewed as “generating” the carryout bit.
Propagate term ‘pi’ is used where an input carry ci=1 may be propagated through the full
adder.
MERITS:
CLA adders are designed to overcome the latency introduced by the rippling effect of carry
109
VLSI LAB DCET TANVEER SULTANA
𝑔𝑖 = 𝑎𝑖 . 𝑏𝑖
𝑝𝑖 = 𝑎𝑖 ⊕ 𝑏𝑖
Carryout = 𝑐𝑖+1 = 𝑔𝑖 + 𝑝𝑖 . 𝑐𝑖
Sumout = 𝑠𝑖 = 𝑝𝑖 ⊕ 𝑐𝑖
gi pi
ai . bi ai ^ bi
ai = bi = 0 0 0
ai = bi = 1 1 0
ai ≠ bi 0 1
LOGIC SYMBOL
110
VLSI LAB DCET TANVEER SULTANA
c1 = g0 + p0 . c0
c2 = g1 + p1 . c1 = g1 + p1 . (g0 + p0 . c0)
c3 = g2 + p2 . c2 = g2 + p2. g1 + p2 . p1 .g0 + p2 . p1 . p0 . c0
c4 = g3 + p3 . c3 = g3 + p3. g2 + p3 . p2 .g1 + p3 . p2 . p1 . g0 + p3 . p2 . p1 . p0 . c0
111
VLSI LAB DCET TANVEER SULTANA
TRUTH TABLE:
Inputs Output
a3 a2 a1 a0 b3 b2 b1 b0 c0 s3 s2 s1 s0 Cout
0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1 0 1 1 0 0 0 0 0 1 0 1
//Verilog.
112
VLSI LAB DCET TANVEER SULTANA
module CLA_4Bit(
output [3:0] S,
output Cout,
output PG,
output GG,
input [3:0] A,
input [3:0] B,
input Cin
);
assign P = A ^ B; //Propagate
assign C[2] = G[1] | (P[1] & G[0]) | (P[1] & P[0] & C[0]);
assign C[3] = G[2] | (P[2] & G[1]) | (P[2] & P[1] & G[0]) | (P[2] & P[1] & P[0] &
C[0]);
assign Cout = G[3] | (P[3] & G[2]) | (P[3] & P[2] & G[1]) | (P[3] & P[2] & P[1] & G[0])
|(P[3] & P[2] & P[1] & P[0] & C[0]);
assign S = P ^ C;
assign GG = G[3] | (P[3] & G[2]) | (P[3] & P[2] & G[1]) | (P[3] & P[2] & P[1] & G[0]);
endmodule
//Test Bench.
module TEST_CLA_4bit;
// Inputs
reg [3:0] A;
113
VLSI LAB DCET TANVEER SULTANA
reg [3:0] B;
reg Cin;
// Outputs
wire [3:0] S;
wire Cout;
wire PG;
wire GG;
CLA_4Bit uut (
.S(S),
.Cout(Cout),
.PG(PG),
.GG(GG),
.A(A),
.B(B),
.Cin(Cin)
);
initial begin
// Initialize Inputs
A = 0;
B = 0;
Cin = 0;
#100;
114
VLSI LAB DCET TANVEER SULTANA
A=4'b0001;B=4'b0000;Cin=1'b0;
#30 A=4'b100;B=4'b0011;Cin=1'b0;
#30 A=4'b1101;B=4'b1010;Cin=1'b1;
#30 A=4'b1110;B=4'b1001;Cin=1'b0;
#30 A=4'b1111;B=4'b1010;Cin=1'b0;
end
initial begin
end
endmodule
115
VLSI LAB DCET TANVEER SULTANA
MICROWIND-2 AND DSCH-2 ARE USER FRIENDLY TOOLS FOR DESIGN AND
STIMULATION .
DSCH is used to validate the architecture of logic circuit before the microelectronic design is
started.
DSCH provides a user friendly environment for hierarchical logic design and fast simulation.
DSCH 2 is the companion software for logic design based on primitive, a hierarchical circuit
is built and simulated. Interactive symbols such as keyboards, led and displays are used for
Microwind software allows the designer to simulate and design an integrated circuit at
It includes all the comments for a mask editor as well as digital tools never gathered before in
a single module.
Microwind works as a comprehensive layout and simulation tool and can be applied to micro
STEP(1) - n well
STEP(2) - active
STEP(3) - poly
STEP(4) - p select
116
VLSI LAB DCET TANVEER SULTANA
STEP(5) - n select
STEP(8) - metal 1
STEP(9) - via
STEP(10) - metal 2
117
VLSI LAB DCET TANVEER SULTANA
3. Draw the Layout diagram using the drag and drop tools on right.
118
VLSI LAB DCET TANVEER SULTANA
6. Stop the simulation and click on the ‘Timing Diagram’ icon on top toolbar which looks
like.
119
VLSI LAB DCET TANVEER SULTANA
10. Then again goto ‘File’ and then this time select ‘Make Verilog File’ option.
120
VLSI LAB DCET TANVEER SULTANA
11. The Verilog code will be shown and the name of the file will be given. Remember the
name and then click on [Ok].
12. Close Dsch2 and then open Microwind2 wsing the following icon.
121
VLSI LAB DCET TANVEER SULTANA
122
VLSI LAB DCET TANVEER SULTANA
123
VLSI LAB DCET TANVEER SULTANA
17. Next goto ‘Compile’ and then select the ‘Compile Verilog File’ option.
18. Select the Verilog file created in Dsch2 (It will be a .txt file) and the clcik [Open].
124
VLSI LAB DCET TANVEER SULTANA
125
VLSI LAB DCET TANVEER SULTANA
AIM: To design NOT logic gate in switch level modeling using verilog code
Description: The NOT or INVERT function is often considered the simplest Boolean
operation.
1. NOT logic gate Cmos is built using one PFET and one NFET. Gate input ‘a’ is given
common to both FETS and o/p ‘f’ is drawn connecting both FETS in series.
2. If gate i/p a=0 then PFET mp is ON and NFET mn is off. This connect the o/p node ‘f’ to
power supply voltage VDD (i/p) giving an o/p f=1
3. If the gate i/p a=1 then NFET mn is on and PFET mp is off. This connect the o/p node f
to ground (i/p).
f = 𝑎̅ . 1 + a . 0 = 𝑎̅
f = NOT ( a ) =𝑎̅
126
VLSI LAB DCET TANVEER SULTANA
Symbol:
CMOS Diagram:
TRUTH TABLE:
INPUT OUTPUT
a F
0 1
1 0
127
VLSI LAB DCET TANVEER SULTANA
128
VLSI LAB DCET TANVEER SULTANA
AIM: TO design NAND logic gate in switch level modeling using Verilog code.
Description: NAND gate is called as universal gate. NAND2 logic gate CMOS circuit is built
using 2 parallel connected PFET and 2 series connected NFET.
4. If gate inputs a = b = 1 then PFET are off [p1 & p2] and NFET [n1 & n2] are ON. This
connecting ground (i/p) to o/p node f = 0.
f (a , b)=𝑎̅. 1 + 𝑏̅ . 1+ a .b . 0
f = ̅𝑎 +𝑏̅ =𝑎. 𝑏
SYMBOL:
CMOS DIAGRAM:
TRUTH TABLE:
129
VLSI LAB DCET TANVEER SULTANA
INPUT OUTPUT
a B F
0 0 1
0 1 1
1 0 1
1 1 0
130
VLSI LAB DCET TANVEER SULTANA
AIM:-To design NOR logic gate in Switch level modeling using Verilog code.
NOR2 logic gate CMOS circuit is built using two series PFET (p1&p2) and two parallel
connected NFET (n1&n2).
If both inputs a=b=0 then PFET p1&p2 are ON and NFETS (n1&n2) are off. This connects the
VDD input to output node f=1
f(a,b)= . =
SYMBOL:
131
VLSI LAB DCET TANVEER SULTANA
CMOS DIAGRAM:
TRUTH TABLE:
INPUT OUTPUT
A b F
0 0 1
0 1 0
1 0 0
1 1 0
132
VLSI LAB DCET TANVEER SULTANA
133
VLSI LAB DCET TANVEER SULTANA
Low power Dissipation High Packing density Bi directional capability Low Input Impedance
11. What are the different operating regions foe an MOS transistor?
_ Cutoff region
_ Non- Saturated Region
_ Saturated Region
Careful
control during fabrication is necessary to avoid this problem.
134
VLSI LAB DCET TANVEER SULTANA
21.What is LOCOS?
LOCOS mean Local Oxidation of Silicon. This is one type of oxide construction.
135