SlideShare ist ein Scribd-Unternehmen logo
1 von 60
Downloaden Sie, um offline zu lesen
SHAH DARSHIL HARESHKUMAR
17MVD0091
DIGITAL DESIGN WITH FPGA
ASSIGNMENT I
SIVANANTHAM S
VIT UNIVERSITY
Aim:
To design, simulate and implement basic gates circuit using schematic and
Verilog HDL.
Software Details:
For design Functional Simulation: Quartus II, ModelSim
For design Synthesis: Quartus II
For design Implementation: Quartus II
1. And gate
a) Verilog code
module and_gate(a,b,y);
input a,b;
output y;
assign y = a & b;
endmodule
Verilog Code (Gate Level):
module andgate(a,b,y);
input a,b;
output y;
wire y;
and(y,a,b);
endmodule
b) Output waveform:
Task: 1 Design and Implementation of Basic gates using Verilog HDL
coding
2. OR gate
a) Verilog code:
module OR_gate(a,b,y);
input a,b;
output y;
assign y = a | b;
endmodule
Verilog Code(Gate Level):
module orgate(a,b,y);
input a,b;
output y;
wire y;
or(y,a,b);
endmodule
b) Output waveform:
3. XOR gate
a) Verilog code:
module XOR_gate(a,b,y);
input a,b;
output y;
assign y = a ^ b;
endmodule
Verilog code:
module XOR_gate(a,b,y);
input a,b;
output y;
xor (y , a , b);
endmodule
a) Output waveform:
4. NAND gate
a) Verilog code:
module nand_gate(a,b,y);
input a,b;
output y;
assign y = ~a | ~b;
endmodule
Verilog code:
module nand_gate(a,b,y);
input a,b;
output y;
or o1( y ,~a , ~b);
endmodule
a) Output waveform:
5. NOR gate
a) Verilog code:
module nor_gate(a,b,y);
input a,b;
output y;
assign y = ~a & ~b;
endmodule
Verilog code:
module nor_gate(a,b,y);
input a,b;
output y;
and (y , ~a , ~b);
endmodule
a) Output waveform:
6. EXNOR gate
a) Verilog code:
module exnor_gate(a,b,y);
input a,b;
output y;
assign y = a ~^ b;
endmodule
Verilog code:
module exnor_gate(a,b,y);
input a,b;
output y;
xnor (y , a , b);
endmodule
a) Output waveform:
Common test bench:
module tb_and_gate;
reg A,B;
wire Y;
and_gate a1 (A,B,Y);
initial begin
A =0;
B= 0;
end
always #25 A =~A;
always #50 B =~B;
endmodule
Aim:
To design, simulate and implement combinational circuits using schematic and
Verilog HDL.
Software Details:
For design Functional Simulation: Quartus II, ModelSim
For design Synthesis: Quartus II
For design Implementation: Quartus II
1. Half subtractor
a) Verilog code:
module hsubb(a,b,d,bo);
input a,b;
output d,bo;
wire d,bo;
assign d = a ^ b;
assign bo = ~a & b;
endmodule
Verilog Code(Gate Level):
module half_sub(a,b,d,b0);
input a,b;
output d,b0;
wire d,b0;
xor (d,a,b);
and(b0,~a,b);
endmodule
Task: 2 Design and Implementation of combinational circuit using
Verilog HDL coding
b) Test bench
module hsubb_tb();
reg a1,b1;
wire d1,bo1;
hsubb h1(a1,b1,d1,bo1);
initial
begin
a1=0;
b1=0;
end
always #50 a1=~a1;
always #100 b1=~b1;
endmodule
c) Wave forms:
2. Half adder
a) Verilog coding:
module hadd(a,b,s,co);
input a,b;
output s,co;
wire s,co;
assign s = a ^ b;
assign co = a & b;
endmodule
Verilog Code(Gate Level):
module hadd(a,b,s,c0);
input a,b;
output s,c0;
wire s,c0;
xor(s,a,b);
and(c0,a,b);
endmodule
b) Test-Bench
module hadd_tb();
reg a1,b1;
wire s1,co1;
hadd h1(a1,b1,s1,co1);
initial
begin
a1=0;
b1=0;
end
always #50 a1=~a1;
always #100 b1=~b1;
endmodule
c) Output waveform:
3. Full adder
Verilog coding:
module fadd(a,b,cin,s,cout);
input a,b,cin;
output s,cout;
wire s,cout;
wire w1,w2,w3,w4;
xor x1(w1,a,b);
xor x2(s,w1,cin);
and a1(w2,a,b);
and a2(w3,b,cin);
and a3(w4,a,cin);
or o1(cout,w2,w3,w4);
endmodule
Verilog Code(Data Flow):
module fadd_d(a,b,c,sum,carry);
input a,b,c;
output sum,carry;
assign sum = a^b^c;
assign carry = (a&b)|(b&c)|(a&c);
endmodule
Test-bench:
module fadd_tb();
reg a1,b1,cin1;
wire s1,co1;
fadd f1(a1,b1,cin1,s1,co1);
initial
begin
a1=0;
b1=0;
cin1=0;
end
always #50 a1=~a1;
always #100 b1=~b1;
always #150 cin1=~cin1;
endmodule
Output wave-Form:
4. Full subtractor:
a) Verilog Coding:
module fadd(a,b,cin,d,borrow);
input a,b,cin;
output d,borrow;
wire d,borrow;
wire w1,w2,w3,w4;
xor x1(w1,a,b);
xor x2(d,w1,cin);
and a1(w2,~a,b);
and a2(w3,b,cin);
and a3(w4,~a,cin);
or o1(borrow,w2,w3,w4);
Verilog Code(Data Flow):
module full_subtractor ( a ,b ,c ,diff ,borrow );
output diff ;
output borrow ;
input a ;
input b ;
input c ;
assign diff = a ^ b ^ c;
assign borrow = ((~a) & b) | (b & c) | (c & (~a));
endmodule
b) Test-Bench
module fsubb_tb();
reg a1,b1,cin1;
wire d1,bo1;
fadd f1(a1,b1,cin1,d1,bo1);
initial
begin
a1=0;
b1=0;
cin1=0;
end
always #50 a1=~a1;
always #100 b1=~b1;
always #150 cin1=~cin1;
endmodule
c) Output waveform:
5. 3:8 decoder
a) Verilog coding:
module decoder(i, y);
input [2:0] i;
output [7:0] y;
assign y[7] = (i[2] & i[1] & i[0]);
assign y[6] = (i[2] & i[1] & ~i[0]);
assign y[5] = (i[2] & ~i[1] & i[0]);
assign y[4] = (i[2] & ~i[1] & ~i[0]);
assign y[3] = (~i[2] & i[1] & i[0]);
assign y[2] = (~i[2] & i[1] & ~i[0]);
assign y[1] = (~i[2] & ~i[1] & i[0]);
assign y[0] = (~i[2] & ~i[1] & ~i[0]);
endmodule
b) Test bench :
module decoder_tb();
reg [2:0]i1;
wire [7:0]y1;
decoder d1(i1, y1);
initial
begin
i1[0]=0;
i1[1]=0;
i1[2]=0;
end
always #50 i1[0]=~i1[0];
always #100 i1[1]=~i1[1];
always #200 i1[2]=~i1[2];
endmodule
c) Output waveforms
6. 8:3 encoder
a) Verilog coding:
module encoder(i, y);
input [7:0] i;
output [2:0] y;
assign y[2]= (i[4] + i[5] +i[6] + i[7]);
assign y[1]= (i[2] + i[3] +i[6] + i[7]);
assign y[0]= (i[1] + i[3] +i[5] + i[7]);
endmodule
b) Test bench
module encoder_tb();
reg [7:0]i1;
wire [2:0]y1;
encoder d1(i1, y1);
initial
begin
i1=8'b10000000;
i1=8'b01000000;
i1=8'b00100000;
i1=8'b00010000;
i1=8'b00001000;
i1=8'b00000100;
i1=8'b00000010;
i1=8'b00000001;
end
endmodule
c) Output waveform:
7. 2-bit Comparator
a) Verilog coding
module comparator(a,b,l,e,g);
input a,b;
output l,e,g;
wire l,e,g;
and a1(l, ~a, b);
xnor x1(e, a, b);
and a2(g, a, ~b);
endmodule
b) Test-Bench
module comparator_tb();
reg a1,b1;
wire l1,e1,g1;
comparator c1(a1,b1,l1,e1,g1);
initial
begin
a1=0;
b1=0;
end
always #100 a1=~a1;
always #50 b1=~b1;
endmodule
c) Output waveform:
8. Priority encoder:
a) Verilog coding:
module p_encoder(d,y);
input [3:0]d;
output [1:0]y;
assign y[1] = (d[3]+ (~d[2] * d[1]));
assign y[0] = (d[2] + d[3]);
endmodule
Verilog coding:
module Priority_enCode(Gate Level)r(d3,d2,d1,d0,y1,y0,y);
input d3,d2,d1,d0;
output y1,y0,y;
wire y1,y0,y,w1,w2;
not(w1,d2);
and(w2,w1,d1);
or(y0,w2,d3);
or(y1,d3,d2);
or(y,y1,d1,d0);
endmodule
a) Test bench
module p_encoder_tb();
reg [3:0]d1;
wire[1:0]y1;
p_encoder p1(d1,y1);
initial
begin
#10 d1=4'b1000;
#10 d1=4'b0100;
#10 d1=4'b0010;
#10 d1=4'b0001;
#10 $stop;
end
endmodule
b) Output waveform
9. 4:1 Mux
a) Verilog coding:
module mux(y,i0,i1,i2,i3,s1,s0);
input i0,i1,i2,i3;
input s1,s0;
output y;
assign y =(~s1 & ~s0 & i0) | (~s1 & s0 & i1) | (s1 & ~s0 & i2) | (s1 & s0 & i3);
endmodule
Verilog Code(Gate Level):
module mux4_to_1(out,i0,i1,i2,i3,s1,s0);
output out;
input i0,i1,i2,i3,s1,s0;
wire s1n,s0n;
wire y0,y1,y2,y3;
not (s1n,s1);
not (s0n,s0);
and(y0,i0,s1n,s0n);
and(y1,i1,s1n,s0);
and(y2,i2,s1,s0n);
and(y3,i3,s1,s0);
or(out,y0,y1,y2,y3);
endmodule
b) Test-Bench
module mux4_1_tb();
reg i00,i11,i22,i33,s11,s00;
wire y1;
mux m1(y1,i00,i11,i22,i33,s11,s00);
initial
begin
i00=0;
i11=0;
i22=0;
i33=0;
s00=1;
s11=1;
end
always #200 i00=~i00;
always #100 i11=~i11;
always #50 i22=~i22;
always #25 i33=~i33;
always #800 s00=~s00;
always #3200 s11=~s11;
endmodule
c) Output waveform
10.2:1 Mux
a) Verilog coding
module Mux(i0,i1,s,y);
input i0,i1,s;
output y;
assign y = s ? i1 : i0;
endmodule
module mux_2(y,i1,i0,s);
output y;
wire m,n;
input i1,i0,s;
and (m,s,i1);
and (n,~s,i0);
or (y,m,n);
endmodule
b) Test-Bench
module mux_tb();
reg i00,i11,s1;
wire y1;
Mux m1(i00,i11,s1,y1);
initial
begin
i00=0;
i11=0;
s1=0;
end
always #50 i00=~i00;
always #100 i11=~i11;
always #400 s1=~s1;
endmodule
c) Output waveform
11. 8_1Mux using 4_1 and 2_1 mux
a) Verilog coding:
module mux_top(a,b,c);
input [7:0]a;
input [2:0]b;
output c;
wire w1,w2;
mux d1(w1,a[0],a[1],a[2],a[3],b[1],b[0]);
mux d2(w2,a[4],a[5],a[6],a[7],b[1],b[0]);
Mux d3(w1,w2,b[2],c);
endmodule
b) Test-Bench:
module mux8_1_tb();
reg [7:0]a1;
reg [2:0]b1;
wire c1;
mux_top m1(a1,b1,c1);
initial
begin
a1[0]=0;
a1[1]=0;
b1[0]=0;
b1[1]=0;
b1[2]=0;
end
always #25 a1[0]=~a1[0];
always #50 a1[1]=~a1[1];
always #100 b1[0]=~b1[0];
always #200 b1[1]=~b1[1];
always #400 b1[2]=~b1[2];
endmodule
c) Output waveform:
We can observe that the my output is follow input a[0] and a[1]
respectively.
12. Demux1_4
a) Verilog coding
module demux(I,S,Y);
input [1:0]S;
input I;
output [3:0]Y;
assign Y[0]= (~S[1] & ~S[0] & I);
assign Y[1]= (~S[1] & S[0] & I);
assign Y[2]= (S[1] & ~S[0] & I);
assign Y[3]= (S[1] & S[0] & I);
endmodule
Verilog Code(Gate Level):
module demux_4(a,b,d,y0,y1,y2,y3);
output y0,y1,y2,y3;
input a,b,d;
wire w1,w2;
not(w1,a);
not(w2,b);
and(y0,w1,w2,d);
and(y1,w1,b,d);
and(y2,a,w2,d);
and(y3,a,b,d);
endmodule
b) Test bench
module demux_tb();
reg [1:0]S1;
reg I1;
wire [3:0]Y1;
demux D1(I1,S1,Y1);
initial
begin
I1=1;
S1[1]=0;
S1[0]=0;
end
always #100 S1[1]=~S1[1];
always #50 S1[0]=~S1[0];
endmodule
c) Output waveform
13.Demux1_2
a) Verilog coding:
module demux1_2(i,s,y0,y1);
input i,s;
output y0,y1;
wire y0,y1;
assign y0 = (~s&i);
assign y1 = (s&i);
endmodule
Verilog Code(Gate Level):
module demux_2(s,d,y1,y0);
input s,d;
output y1,y0;
wire y1,y0,w1;
not(w1,s);
and(y1,d,s);
and(y0,w1,d);
endmodule
b) Test-bench
module demux1_2_tb();
reg i1,s1;
wire y00,y11;
demux1_2 m1(i1,s1,y00,y11);
initial
begin
i1=1;
s1=0;
end
always #100 s1=~s1;
endmodule
c) Output waveform:
14. 1_8 demux
a) Verilog coding:
module demux1_8(i,s2,s1,s0,y0,y1,y2,y3,y4,y5,y6,y7);
input i,s2,s1,s0;
output y0,y1,y2,y3,y4,y5,y6,y7;
wire y0,y1,y2,y3,y4,y5,y6,y7;
assign y7 = (s2 & s1 & s0 & i);
assign y6 = (s2 & s1 & ~s0& i);
assign y5 = (s2 & ~s1 & s0& i);
assign y4 = (s2 & ~s1 & ~s0& i);
assign y3 = (~s2 & s1 & s0& i);
assign y2 = (~s2 & s1 & ~s0& i);
assign y1 = (~s2 & ~s1 & s0& i);
assign y0 = (~s2 & ~s1 & ~s0& i);
endmodule
b) Test bench
module demux1_8_tb();
reg i1,s22,s11,s00;
wire y00,y11,y22,y33,y44,y55,y66,y77;
demux1_8 m2(i1,s22,s11,s00,y00,y11,y22,y33,y44,y55,y66,y77);
initial
begin
i1=1;
s11=0;
s22=0;
s00=0;
end
always #50 s00=~s00;
always #100 s11=~s11;
always #200 s22=~s22;
endmodule
c) Output waveforms:
Aim:
To design, simulate and implement code converters using schematic and
Verilog HDL.
Software Details:
For design Functional Simulation: Quartus II, ModelSim
For design Synthesis: Quartus II
For design Implementation: Quartus II
1. Binary to BCD
a) Verilog coding:
module B_TO_BCD(a,s);
input [3:0]a;
output[4:0]s;
assign s[4] = (a[1] & a[3]) | (a[3] & a[2]);
assign s[3] = (~a[1] & ~a[2] & a[3]);
assign s[2] = (a[2] & a[1]) | (a[2] & ~a[3]);
assign s[1] = (a[1] & ~a[3]) | (~a[1] & a[3] & a[2]);
assign s[0] = a[0];
endmodule
Task: 3 Design and Implementation of code converters using Verilog
HDL coding
b) Test bench
module B_TO_BCD_TB();
reg [3:0]a1;
wire [4:0]s1;
B_TO_BCD m1(a1,s1);
initial
begin
#10 a1=4'b0000;
#10 a1=4'b0001;
#10 a1=4'b0010;
#10 a1=4'b0011;
#10 a1=4'b0100;
#10 a1=4'b0101;
#10 a1=4'b0110;
#10 a1=4'b0111;
#10 a1=4'b1000;
#10 a1=4'b1001;
#10 a1=4'b1010;
#10 a1=4'b1011;
#10 a1=4'b1100;
#10 a1=4'b1101;
#10 a1=4'b1110;
#10 a1=4'b1111;
#100 $stop;
end
endmodule
c) Waveform:
2. BCD to Binary
a) Verilog code:
module BCD_TO_B(b,a);
input [4:0]b;
output[4:0]a;
assign a[4] = (b[3] & b[4]) | (b[1] & b[2] & b[4]);
assign a[3] = (b[3] & ~b[4]) | (~b[2] & ~b[3] & b[4]) | (~b[1] & ~b[3] & b[4]);
assign a[2] = (b[2] & ~b[4]) | (~b[1] & b[2]) | (b[1] & ~b[2] & b[4]);
assign a[1] = (b[1] ^ b[4]);
assign a[0] = b[0];
endmodule
b) Test bench
module BCD_TO_B_TB();
reg [4:0]b1;
wire [4:0]a1;
BCD_TO_B m1(b1,a1);
initial
begin
#10 b1=5'b00000;
#10 b1=5'b00001;
#10 b1=5'b00010;
#10 b1=5'b00011;
#10 b1=5'b00100;
#10 b1=5'b00101;
#10 b1=5'b00110;
#10 b1=5'b00111;
#10 b1=5'b01000;
#10 b1=5'b01001;
#10 b1=5'b10000;
#10 b1=5'b10001;
#10 b1=5'b10010;
#10 b1=5'b10011;
#10 b1=5'b10100;
#10 b1=5'b10101;
#100 $stop;
end
endmodule
c) Waveform:
3. Binary To Gray
a) Verilog code:
module B_TO_G(b,g);
output [3:0]g;
input [3:0]b;
xor x1(g[0],b[0],b[1]);
xor x2(g[1],b[1],b[2]);
xor x3(g[2],b[2],b[3]);
and a1(g[3],b[3],1'b1);
endmodule
b) Test bench:
module B_TO_G_TB();
reg [3:0]b1;
wire [3:0]g1;
B_TO_G m1(b1,g1);
initial
begin
#10 b1=4'b0000;
#10 b1=4'b0001;
#10 b1=4'b0010;
#10 b1=4'b0011;
#10 b1=4'b0100;
#10 b1=4'b0101;
#10 b1=4'b0110;
#10 b1=4'b0111;
#10 b1=4'b1000;
#10 b1=4'b1001;
#10 b1=4'b1010;
#10 b1=4'b1011;
#10 b1=4'b1100;
#10 b1=4'b1101;
#10 b1=4'b1110;
#10 b1=4'b1111;
#100 $stop;
end
endmodule
c) Waveforms:
4. Gray to Binary:
a) Verilog code:
module G_TO_B(g,b);
output [3:0]b;
input [3:0]g;
xor x1(b[0],b[1],g[0]);
xor x2(b[1],b[2],g[1]);
xor x3(b[2],b[3],g[2]);
and a1(b[3],g[3],1'b1);
endmodule
b) Test bench
module G_TO_B_TB();
reg [3:0]g1;
wire [3:0]b1;
G_TO_B m1(g1,b1);
initial
begin
#10 g1=4'b0000;
#10 g1=4'b0001;
#10 g1=4'b0010;
#10 g1=4'b0011;
#10 g1=4'b0100;
#10 g1=4'b0101;
#10 g1=4'b0110;
#10 g1=4'b0111;
#10 g1=4'b1000;
#10 g1=4'b1001;
#10 g1=4'b1010;
#10 g1=4'b1011;
#10 g1=4'b1100;
#10 g1=4'b1101;
#10 g1=4'b1110;
#10 g1=4'b1111;
#100 $stop;
end
endmodule
c) Waveforms:
5. Excess-3 To BCD
a) Verilog code:
module E_TO_BCD(e,b);
input [3:0]e;
output [3:0]b;
assign b[3] = (e[0] & e[1] & e[3]) | (e[2] & e[3]);
assign b[2] = (~e[0] & e[1] & e[3]) | (e[0] & e[1] & e[2]) | (~e[1] & ~e[2]);
assign b[1] = (e[1] ^ e[0]);
assign b[0] = ~e[0];
endmodule
b) Test-bench
module E_TO_BCD_TB();
reg [3:0]e1;
wire [3:0]b1;
E_TO_BCD m1(e1,b1);
initial
begin
#10 e1=4'b0011;
#10 e1=4'b0100;
#10 e1=4'b0101;
#10 e1=4'b0110;
#10 e1=4'b0111;
#10 e1=4'b1000;
#10 e1=4'b1001;
#10 e1=4'b1010;
#10 e1=4'b1011;
#10 e1=4'b1100;
#100 $stop;
end
endmodule
c) Waveforms
6. BCD To Excess-3
a) Verilog code:
module B_TO_E(b,e);
input [3:0]b;
output [3:0]e;
assign e[3]= b[3] | (b[2] & b[1]) | (b[2] & b[0]);
assign e[2]= (~b[2] & b[1]) | (~b[2] & b[0]) | (b[2] & ~b[1] & ~b[0]);
assign e[1]= (b[1] & b[0]) | (~b[1] & ~b[0]);
assign e[0]= ~b[0] ;
endmodule
b) Test-bench
module B_TO_E_TB();
reg [3:0]b1;
wire [3:0]e1;
B_TO_E m1(b1,e1);
initial
begin
#10 b1=4'b0000;
#10 b1=4'b0001;
#10 b1=4'b0010;
#10 b1=4'b0011;
#10 b1=4'b0100;
#10 b1=4'b0101;
#10 b1=4'b0110;
#10 b1=4'b0111;
#10 b1=4'b1000;
#10 b1=4'b1001;
#100 $stop;
end
endmodule
c) Waveforms:
Aim:
To design, simulate and implement Ripple carry adder using schematic and
Verilog HDL.
Software Details:
For design Functional Simulation: Quartus II, ModelSim
For design Synthesis: Quartus II
For design Implementation: Quartus II
a) RC_Verilog Code:
module RC_adder(a2,b2,cin2,s2,cout2);
input [3:0]a2,b2;
wire c1,c2,c3;
input cin2;
output [3:0]s2;
output cout2;
FA f1(a2[0],b2[0],cin2,s2[0],c1);
FA f2(a2[1],b2[1],c1,s2[1],c2);
FA f3(a2[2],b2[2],c2,s2[2],c3);
FA f4(a2[3],b2[3],c3,s2[3],cout2);
Endmodule
b) FA_Verilog code:
Task: 4 Design and Implementation of Combinational Circuits using
Verilog HDL coding
module FA(a,b,cin,s,cout);
input a,b,cin;
output s,cout;
wire s,cout;
wire w1,w2,w3,w4;
xor x1(w1,a,b);
xor x2(s,w1,cin);
and a1(w2,a,b);
and a2(w3,cin,b);
and a3(w4,a,cin);
or o1(cout,w2,w3,w4);
endmodule
c) Test bench:
module RC_FA_TB();
reg [3:0]a2,b2;
reg cin2;
wire [3:0]s2;
wire cout2;
RC_adder f11(a2,b2,cin2,s2,cout2);
initial
begin
cin2=0;
#10 a2=4'b1100; b2=4'b0001;
#10 a2=4'b1100; b2=4'b1001;
#10 $stop;
end
endmodule
d) Waveforms:
Scanned by CamScanner
w c
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Verilog operators
Verilog operatorsVerilog operators
Verilog operators
 
Switch level modeling
Switch level modelingSwitch level modeling
Switch level modeling
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學
 
5 linear block codes
5 linear block codes5 linear block codes
5 linear block codes
 
Analog Transmission
Analog TransmissionAnalog Transmission
Analog Transmission
 
8255
82558255
8255
 
Bch codes
Bch codesBch codes
Bch codes
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
 
Windowing techniques of fir filter design
Windowing techniques of fir filter designWindowing techniques of fir filter design
Windowing techniques of fir filter design
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language
 
Convolutional codes
Convolutional codesConvolutional codes
Convolutional codes
 
All VLSI programs
All VLSI programsAll VLSI programs
All VLSI programs
 
Convolution sum using graphical and matrix method
Convolution sum using graphical and matrix methodConvolution sum using graphical and matrix method
Convolution sum using graphical and matrix method
 
FPGA Tutorial - LCD Interface
FPGA Tutorial - LCD InterfaceFPGA Tutorial - LCD Interface
FPGA Tutorial - LCD Interface
 
VLSI Lab manual PDF
VLSI Lab manual PDFVLSI Lab manual PDF
VLSI Lab manual PDF
 
Verilog Tasks and functions
Verilog Tasks and functionsVerilog Tasks and functions
Verilog Tasks and functions
 
Keypad scanner using Verilog code in VLSI Systems
Keypad scanner using Verilog code in VLSI SystemsKeypad scanner using Verilog code in VLSI Systems
Keypad scanner using Verilog code in VLSI Systems
 
Amplitude modulation
Amplitude modulationAmplitude modulation
Amplitude modulation
 
T-states in microprocessor 8085
T-states in microprocessor 8085T-states in microprocessor 8085
T-states in microprocessor 8085
 

Ähnlich wie Task i

Ähnlich wie Task i (20)

gate level modeling
gate level modelinggate level modeling
gate level modeling
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
VerilogHDL_Utkarsh_kulshrestha
VerilogHDL_Utkarsh_kulshresthaVerilogHDL_Utkarsh_kulshrestha
VerilogHDL_Utkarsh_kulshrestha
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Verilog_Overview.pdf
Verilog_Overview.pdfVerilog_Overview.pdf
Verilog_Overview.pdf
 
vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1
 
Ecad &vlsi lab 18
Ecad &vlsi lab 18Ecad &vlsi lab 18
Ecad &vlsi lab 18
 
CombVerilog.pdf
CombVerilog.pdfCombVerilog.pdf
CombVerilog.pdf
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manual
 
VLSI experiments II
VLSI experiments IIVLSI experiments II
VLSI experiments II
 
Vlsi lab manual exp:1
Vlsi lab manual exp:1Vlsi lab manual exp:1
Vlsi lab manual exp:1
 
mod-4.pptx
mod-4.pptxmod-4.pptx
mod-4.pptx
 
verilog
verilogverilog
verilog
 
Fpga 1
Fpga 1Fpga 1
Fpga 1
 
e CAD lab manual
e CAD lab manuale CAD lab manual
e CAD lab manual
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
 
VHDL Programs
VHDL ProgramsVHDL Programs
VHDL Programs
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
 

Mehr von Darshil Shah

final report_51_33_17
final report_51_33_17final report_51_33_17
final report_51_33_17Darshil Shah
 
Final project report on Solar street light
Final project report on Solar street light Final project report on Solar street light
Final project report on Solar street light Darshil Shah
 
Charge coupled device(ccd)
Charge coupled device(ccd)Charge coupled device(ccd)
Charge coupled device(ccd)Darshil Shah
 
Frequency modulation and its application
Frequency modulation and its applicationFrequency modulation and its application
Frequency modulation and its applicationDarshil Shah
 
Photoelectric sensors
Photoelectric sensorsPhotoelectric sensors
Photoelectric sensorsDarshil Shah
 

Mehr von Darshil Shah (8)

Umc_18_CMOS
Umc_18_CMOSUmc_18_CMOS
Umc_18_CMOS
 
final report_51_33_17
final report_51_33_17final report_51_33_17
final report_51_33_17
 
Final project report on Solar street light
Final project report on Solar street light Final project report on Solar street light
Final project report on Solar street light
 
Telemedicine
TelemedicineTelemedicine
Telemedicine
 
Pn sequence
Pn sequencePn sequence
Pn sequence
 
Charge coupled device(ccd)
Charge coupled device(ccd)Charge coupled device(ccd)
Charge coupled device(ccd)
 
Frequency modulation and its application
Frequency modulation and its applicationFrequency modulation and its application
Frequency modulation and its application
 
Photoelectric sensors
Photoelectric sensorsPhotoelectric sensors
Photoelectric sensors
 

Kürzlich hochgeladen

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Kürzlich hochgeladen (20)

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 

Task i

  • 1. SHAH DARSHIL HARESHKUMAR 17MVD0091 DIGITAL DESIGN WITH FPGA ASSIGNMENT I SIVANANTHAM S VIT UNIVERSITY
  • 2. Aim: To design, simulate and implement basic gates circuit using schematic and Verilog HDL. Software Details: For design Functional Simulation: Quartus II, ModelSim For design Synthesis: Quartus II For design Implementation: Quartus II 1. And gate a) Verilog code module and_gate(a,b,y); input a,b; output y; assign y = a & b; endmodule Verilog Code (Gate Level): module andgate(a,b,y); input a,b; output y; wire y; and(y,a,b); endmodule b) Output waveform: Task: 1 Design and Implementation of Basic gates using Verilog HDL coding
  • 3. 2. OR gate a) Verilog code: module OR_gate(a,b,y); input a,b; output y; assign y = a | b; endmodule Verilog Code(Gate Level): module orgate(a,b,y); input a,b; output y; wire y; or(y,a,b); endmodule
  • 4. b) Output waveform: 3. XOR gate a) Verilog code: module XOR_gate(a,b,y); input a,b; output y; assign y = a ^ b; endmodule Verilog code: module XOR_gate(a,b,y); input a,b; output y; xor (y , a , b); endmodule
  • 5. a) Output waveform: 4. NAND gate a) Verilog code: module nand_gate(a,b,y); input a,b; output y; assign y = ~a | ~b; endmodule Verilog code: module nand_gate(a,b,y); input a,b; output y;
  • 6. or o1( y ,~a , ~b); endmodule a) Output waveform: 5. NOR gate a) Verilog code: module nor_gate(a,b,y); input a,b; output y; assign y = ~a & ~b; endmodule Verilog code: module nor_gate(a,b,y);
  • 7. input a,b; output y; and (y , ~a , ~b); endmodule a) Output waveform: 6. EXNOR gate a) Verilog code: module exnor_gate(a,b,y); input a,b; output y; assign y = a ~^ b; endmodule Verilog code: module exnor_gate(a,b,y); input a,b;
  • 8. output y; xnor (y , a , b); endmodule a) Output waveform: Common test bench: module tb_and_gate; reg A,B; wire Y; and_gate a1 (A,B,Y); initial begin A =0; B= 0; end always #25 A =~A; always #50 B =~B; endmodule
  • 9. Aim: To design, simulate and implement combinational circuits using schematic and Verilog HDL. Software Details: For design Functional Simulation: Quartus II, ModelSim For design Synthesis: Quartus II For design Implementation: Quartus II 1. Half subtractor a) Verilog code: module hsubb(a,b,d,bo); input a,b; output d,bo; wire d,bo; assign d = a ^ b; assign bo = ~a & b; endmodule Verilog Code(Gate Level): module half_sub(a,b,d,b0); input a,b; output d,b0; wire d,b0; xor (d,a,b); and(b0,~a,b); endmodule Task: 2 Design and Implementation of combinational circuit using Verilog HDL coding
  • 10. b) Test bench module hsubb_tb(); reg a1,b1; wire d1,bo1; hsubb h1(a1,b1,d1,bo1); initial begin a1=0; b1=0; end always #50 a1=~a1; always #100 b1=~b1; endmodule c) Wave forms:
  • 11. 2. Half adder a) Verilog coding: module hadd(a,b,s,co); input a,b; output s,co; wire s,co; assign s = a ^ b; assign co = a & b; endmodule Verilog Code(Gate Level): module hadd(a,b,s,c0); input a,b; output s,c0; wire s,c0; xor(s,a,b); and(c0,a,b); endmodule b) Test-Bench module hadd_tb(); reg a1,b1; wire s1,co1; hadd h1(a1,b1,s1,co1); initial
  • 12. begin a1=0; b1=0; end always #50 a1=~a1; always #100 b1=~b1; endmodule c) Output waveform: 3. Full adder Verilog coding: module fadd(a,b,cin,s,cout);
  • 13. input a,b,cin; output s,cout; wire s,cout; wire w1,w2,w3,w4; xor x1(w1,a,b); xor x2(s,w1,cin); and a1(w2,a,b); and a2(w3,b,cin); and a3(w4,a,cin); or o1(cout,w2,w3,w4); endmodule Verilog Code(Data Flow): module fadd_d(a,b,c,sum,carry); input a,b,c; output sum,carry; assign sum = a^b^c; assign carry = (a&b)|(b&c)|(a&c); endmodule Test-bench: module fadd_tb(); reg a1,b1,cin1; wire s1,co1; fadd f1(a1,b1,cin1,s1,co1); initial begin a1=0; b1=0; cin1=0; end always #50 a1=~a1;
  • 14. always #100 b1=~b1; always #150 cin1=~cin1; endmodule Output wave-Form: 4. Full subtractor: a) Verilog Coding: module fadd(a,b,cin,d,borrow); input a,b,cin; output d,borrow; wire d,borrow; wire w1,w2,w3,w4; xor x1(w1,a,b); xor x2(d,w1,cin); and a1(w2,~a,b); and a2(w3,b,cin);
  • 15. and a3(w4,~a,cin); or o1(borrow,w2,w3,w4); Verilog Code(Data Flow): module full_subtractor ( a ,b ,c ,diff ,borrow ); output diff ; output borrow ; input a ; input b ; input c ; assign diff = a ^ b ^ c; assign borrow = ((~a) & b) | (b & c) | (c & (~a)); endmodule b) Test-Bench module fsubb_tb(); reg a1,b1,cin1; wire d1,bo1; fadd f1(a1,b1,cin1,d1,bo1); initial begin a1=0; b1=0; cin1=0; end always #50 a1=~a1; always #100 b1=~b1; always #150 cin1=~cin1; endmodule c) Output waveform:
  • 16. 5. 3:8 decoder a) Verilog coding: module decoder(i, y); input [2:0] i; output [7:0] y; assign y[7] = (i[2] & i[1] & i[0]); assign y[6] = (i[2] & i[1] & ~i[0]); assign y[5] = (i[2] & ~i[1] & i[0]); assign y[4] = (i[2] & ~i[1] & ~i[0]); assign y[3] = (~i[2] & i[1] & i[0]); assign y[2] = (~i[2] & i[1] & ~i[0]); assign y[1] = (~i[2] & ~i[1] & i[0]); assign y[0] = (~i[2] & ~i[1] & ~i[0]); endmodule
  • 17. b) Test bench : module decoder_tb(); reg [2:0]i1; wire [7:0]y1; decoder d1(i1, y1); initial begin i1[0]=0; i1[1]=0; i1[2]=0; end always #50 i1[0]=~i1[0]; always #100 i1[1]=~i1[1]; always #200 i1[2]=~i1[2]; endmodule c) Output waveforms 6. 8:3 encoder
  • 18. a) Verilog coding: module encoder(i, y); input [7:0] i; output [2:0] y; assign y[2]= (i[4] + i[5] +i[6] + i[7]); assign y[1]= (i[2] + i[3] +i[6] + i[7]); assign y[0]= (i[1] + i[3] +i[5] + i[7]); endmodule b) Test bench module encoder_tb(); reg [7:0]i1; wire [2:0]y1; encoder d1(i1, y1); initial begin i1=8'b10000000; i1=8'b01000000; i1=8'b00100000; i1=8'b00010000; i1=8'b00001000; i1=8'b00000100; i1=8'b00000010; i1=8'b00000001; end endmodule c) Output waveform:
  • 19. 7. 2-bit Comparator a) Verilog coding module comparator(a,b,l,e,g); input a,b; output l,e,g; wire l,e,g; and a1(l, ~a, b); xnor x1(e, a, b); and a2(g, a, ~b); endmodule b) Test-Bench
  • 20. module comparator_tb(); reg a1,b1; wire l1,e1,g1; comparator c1(a1,b1,l1,e1,g1); initial begin a1=0; b1=0; end always #100 a1=~a1; always #50 b1=~b1; endmodule c) Output waveform:
  • 21. 8. Priority encoder: a) Verilog coding: module p_encoder(d,y); input [3:0]d; output [1:0]y; assign y[1] = (d[3]+ (~d[2] * d[1])); assign y[0] = (d[2] + d[3]); endmodule Verilog coding: module Priority_enCode(Gate Level)r(d3,d2,d1,d0,y1,y0,y); input d3,d2,d1,d0; output y1,y0,y; wire y1,y0,y,w1,w2; not(w1,d2); and(w2,w1,d1); or(y0,w2,d3); or(y1,d3,d2); or(y,y1,d1,d0); endmodule a) Test bench module p_encoder_tb(); reg [3:0]d1; wire[1:0]y1; p_encoder p1(d1,y1);
  • 22. initial begin #10 d1=4'b1000; #10 d1=4'b0100; #10 d1=4'b0010; #10 d1=4'b0001; #10 $stop; end endmodule b) Output waveform 9. 4:1 Mux
  • 23. a) Verilog coding: module mux(y,i0,i1,i2,i3,s1,s0); input i0,i1,i2,i3; input s1,s0; output y; assign y =(~s1 & ~s0 & i0) | (~s1 & s0 & i1) | (s1 & ~s0 & i2) | (s1 & s0 & i3); endmodule Verilog Code(Gate Level): module mux4_to_1(out,i0,i1,i2,i3,s1,s0); output out; input i0,i1,i2,i3,s1,s0; wire s1n,s0n; wire y0,y1,y2,y3; not (s1n,s1); not (s0n,s0); and(y0,i0,s1n,s0n); and(y1,i1,s1n,s0); and(y2,i2,s1,s0n); and(y3,i3,s1,s0); or(out,y0,y1,y2,y3); endmodule b) Test-Bench module mux4_1_tb(); reg i00,i11,i22,i33,s11,s00; wire y1; mux m1(y1,i00,i11,i22,i33,s11,s00);
  • 24. initial begin i00=0; i11=0; i22=0; i33=0; s00=1; s11=1; end always #200 i00=~i00; always #100 i11=~i11; always #50 i22=~i22; always #25 i33=~i33; always #800 s00=~s00; always #3200 s11=~s11; endmodule c) Output waveform
  • 25. 10.2:1 Mux a) Verilog coding module Mux(i0,i1,s,y); input i0,i1,s; output y; assign y = s ? i1 : i0; endmodule module mux_2(y,i1,i0,s); output y; wire m,n; input i1,i0,s; and (m,s,i1); and (n,~s,i0); or (y,m,n); endmodule b) Test-Bench module mux_tb(); reg i00,i11,s1; wire y1; Mux m1(i00,i11,s1,y1); initial begin
  • 26. i00=0; i11=0; s1=0; end always #50 i00=~i00; always #100 i11=~i11; always #400 s1=~s1; endmodule c) Output waveform 11. 8_1Mux using 4_1 and 2_1 mux
  • 27. a) Verilog coding: module mux_top(a,b,c); input [7:0]a; input [2:0]b; output c; wire w1,w2; mux d1(w1,a[0],a[1],a[2],a[3],b[1],b[0]); mux d2(w2,a[4],a[5],a[6],a[7],b[1],b[0]); Mux d3(w1,w2,b[2],c); endmodule b) Test-Bench: module mux8_1_tb(); reg [7:0]a1; reg [2:0]b1; wire c1; mux_top m1(a1,b1,c1); initial begin a1[0]=0; a1[1]=0; b1[0]=0; b1[1]=0; b1[2]=0; end always #25 a1[0]=~a1[0]; always #50 a1[1]=~a1[1]; always #100 b1[0]=~b1[0]; always #200 b1[1]=~b1[1];
  • 28. always #400 b1[2]=~b1[2]; endmodule c) Output waveform: We can observe that the my output is follow input a[0] and a[1] respectively. 12. Demux1_4 a) Verilog coding module demux(I,S,Y); input [1:0]S; input I; output [3:0]Y; assign Y[0]= (~S[1] & ~S[0] & I); assign Y[1]= (~S[1] & S[0] & I); assign Y[2]= (S[1] & ~S[0] & I); assign Y[3]= (S[1] & S[0] & I);
  • 29. endmodule Verilog Code(Gate Level): module demux_4(a,b,d,y0,y1,y2,y3); output y0,y1,y2,y3; input a,b,d; wire w1,w2; not(w1,a); not(w2,b); and(y0,w1,w2,d); and(y1,w1,b,d); and(y2,a,w2,d); and(y3,a,b,d); endmodule b) Test bench module demux_tb(); reg [1:0]S1; reg I1; wire [3:0]Y1; demux D1(I1,S1,Y1); initial begin I1=1; S1[1]=0; S1[0]=0; end always #100 S1[1]=~S1[1]; always #50 S1[0]=~S1[0]; endmodule c) Output waveform
  • 30. 13.Demux1_2 a) Verilog coding: module demux1_2(i,s,y0,y1); input i,s; output y0,y1; wire y0,y1; assign y0 = (~s&i); assign y1 = (s&i); endmodule Verilog Code(Gate Level): module demux_2(s,d,y1,y0); input s,d; output y1,y0; wire y1,y0,w1; not(w1,s);
  • 31. and(y1,d,s); and(y0,w1,d); endmodule b) Test-bench module demux1_2_tb(); reg i1,s1; wire y00,y11; demux1_2 m1(i1,s1,y00,y11); initial begin i1=1; s1=0; end always #100 s1=~s1; endmodule c) Output waveform:
  • 32. 14. 1_8 demux a) Verilog coding: module demux1_8(i,s2,s1,s0,y0,y1,y2,y3,y4,y5,y6,y7); input i,s2,s1,s0; output y0,y1,y2,y3,y4,y5,y6,y7; wire y0,y1,y2,y3,y4,y5,y6,y7; assign y7 = (s2 & s1 & s0 & i); assign y6 = (s2 & s1 & ~s0& i); assign y5 = (s2 & ~s1 & s0& i); assign y4 = (s2 & ~s1 & ~s0& i); assign y3 = (~s2 & s1 & s0& i); assign y2 = (~s2 & s1 & ~s0& i); assign y1 = (~s2 & ~s1 & s0& i); assign y0 = (~s2 & ~s1 & ~s0& i); endmodule b) Test bench
  • 33. module demux1_8_tb(); reg i1,s22,s11,s00; wire y00,y11,y22,y33,y44,y55,y66,y77; demux1_8 m2(i1,s22,s11,s00,y00,y11,y22,y33,y44,y55,y66,y77); initial begin i1=1; s11=0; s22=0; s00=0; end always #50 s00=~s00; always #100 s11=~s11; always #200 s22=~s22; endmodule c) Output waveforms:
  • 34. Aim: To design, simulate and implement code converters using schematic and Verilog HDL. Software Details: For design Functional Simulation: Quartus II, ModelSim For design Synthesis: Quartus II For design Implementation: Quartus II 1. Binary to BCD a) Verilog coding: module B_TO_BCD(a,s); input [3:0]a; output[4:0]s; assign s[4] = (a[1] & a[3]) | (a[3] & a[2]); assign s[3] = (~a[1] & ~a[2] & a[3]); assign s[2] = (a[2] & a[1]) | (a[2] & ~a[3]); assign s[1] = (a[1] & ~a[3]) | (~a[1] & a[3] & a[2]); assign s[0] = a[0]; endmodule Task: 3 Design and Implementation of code converters using Verilog HDL coding
  • 35. b) Test bench module B_TO_BCD_TB(); reg [3:0]a1; wire [4:0]s1; B_TO_BCD m1(a1,s1); initial begin #10 a1=4'b0000; #10 a1=4'b0001; #10 a1=4'b0010; #10 a1=4'b0011; #10 a1=4'b0100; #10 a1=4'b0101; #10 a1=4'b0110; #10 a1=4'b0111; #10 a1=4'b1000; #10 a1=4'b1001; #10 a1=4'b1010; #10 a1=4'b1011; #10 a1=4'b1100; #10 a1=4'b1101; #10 a1=4'b1110; #10 a1=4'b1111; #100 $stop; end endmodule
  • 36. c) Waveform: 2. BCD to Binary a) Verilog code: module BCD_TO_B(b,a); input [4:0]b; output[4:0]a; assign a[4] = (b[3] & b[4]) | (b[1] & b[2] & b[4]); assign a[3] = (b[3] & ~b[4]) | (~b[2] & ~b[3] & b[4]) | (~b[1] & ~b[3] & b[4]); assign a[2] = (b[2] & ~b[4]) | (~b[1] & b[2]) | (b[1] & ~b[2] & b[4]); assign a[1] = (b[1] ^ b[4]); assign a[0] = b[0]; endmodule
  • 37. b) Test bench module BCD_TO_B_TB(); reg [4:0]b1; wire [4:0]a1; BCD_TO_B m1(b1,a1); initial begin #10 b1=5'b00000; #10 b1=5'b00001; #10 b1=5'b00010; #10 b1=5'b00011; #10 b1=5'b00100; #10 b1=5'b00101; #10 b1=5'b00110; #10 b1=5'b00111; #10 b1=5'b01000; #10 b1=5'b01001; #10 b1=5'b10000; #10 b1=5'b10001; #10 b1=5'b10010; #10 b1=5'b10011; #10 b1=5'b10100; #10 b1=5'b10101; #100 $stop; end endmodule
  • 38. c) Waveform: 3. Binary To Gray a) Verilog code: module B_TO_G(b,g); output [3:0]g; input [3:0]b; xor x1(g[0],b[0],b[1]); xor x2(g[1],b[1],b[2]); xor x3(g[2],b[2],b[3]); and a1(g[3],b[3],1'b1); endmodule b) Test bench:
  • 39. module B_TO_G_TB(); reg [3:0]b1; wire [3:0]g1; B_TO_G m1(b1,g1); initial begin #10 b1=4'b0000; #10 b1=4'b0001; #10 b1=4'b0010; #10 b1=4'b0011; #10 b1=4'b0100; #10 b1=4'b0101; #10 b1=4'b0110; #10 b1=4'b0111; #10 b1=4'b1000; #10 b1=4'b1001; #10 b1=4'b1010; #10 b1=4'b1011; #10 b1=4'b1100; #10 b1=4'b1101; #10 b1=4'b1110; #10 b1=4'b1111; #100 $stop; end endmodule c) Waveforms:
  • 40. 4. Gray to Binary: a) Verilog code: module G_TO_B(g,b); output [3:0]b; input [3:0]g; xor x1(b[0],b[1],g[0]); xor x2(b[1],b[2],g[1]); xor x3(b[2],b[3],g[2]); and a1(b[3],g[3],1'b1); endmodule b) Test bench
  • 41. module G_TO_B_TB(); reg [3:0]g1; wire [3:0]b1; G_TO_B m1(g1,b1); initial begin #10 g1=4'b0000; #10 g1=4'b0001; #10 g1=4'b0010; #10 g1=4'b0011; #10 g1=4'b0100; #10 g1=4'b0101; #10 g1=4'b0110; #10 g1=4'b0111; #10 g1=4'b1000; #10 g1=4'b1001; #10 g1=4'b1010; #10 g1=4'b1011; #10 g1=4'b1100; #10 g1=4'b1101; #10 g1=4'b1110; #10 g1=4'b1111; #100 $stop; end endmodule c) Waveforms:
  • 42. 5. Excess-3 To BCD a) Verilog code: module E_TO_BCD(e,b); input [3:0]e; output [3:0]b; assign b[3] = (e[0] & e[1] & e[3]) | (e[2] & e[3]); assign b[2] = (~e[0] & e[1] & e[3]) | (e[0] & e[1] & e[2]) | (~e[1] & ~e[2]); assign b[1] = (e[1] ^ e[0]); assign b[0] = ~e[0]; endmodule b) Test-bench
  • 43. module E_TO_BCD_TB(); reg [3:0]e1; wire [3:0]b1; E_TO_BCD m1(e1,b1); initial begin #10 e1=4'b0011; #10 e1=4'b0100; #10 e1=4'b0101; #10 e1=4'b0110; #10 e1=4'b0111; #10 e1=4'b1000; #10 e1=4'b1001; #10 e1=4'b1010; #10 e1=4'b1011; #10 e1=4'b1100; #100 $stop; end endmodule c) Waveforms
  • 44. 6. BCD To Excess-3 a) Verilog code: module B_TO_E(b,e); input [3:0]b; output [3:0]e; assign e[3]= b[3] | (b[2] & b[1]) | (b[2] & b[0]); assign e[2]= (~b[2] & b[1]) | (~b[2] & b[0]) | (b[2] & ~b[1] & ~b[0]); assign e[1]= (b[1] & b[0]) | (~b[1] & ~b[0]); assign e[0]= ~b[0] ; endmodule b) Test-bench
  • 45. module B_TO_E_TB(); reg [3:0]b1; wire [3:0]e1; B_TO_E m1(b1,e1); initial begin #10 b1=4'b0000; #10 b1=4'b0001; #10 b1=4'b0010; #10 b1=4'b0011; #10 b1=4'b0100; #10 b1=4'b0101; #10 b1=4'b0110; #10 b1=4'b0111; #10 b1=4'b1000; #10 b1=4'b1001; #100 $stop; end endmodule
  • 47. Aim: To design, simulate and implement Ripple carry adder using schematic and Verilog HDL. Software Details: For design Functional Simulation: Quartus II, ModelSim For design Synthesis: Quartus II For design Implementation: Quartus II a) RC_Verilog Code: module RC_adder(a2,b2,cin2,s2,cout2); input [3:0]a2,b2; wire c1,c2,c3; input cin2; output [3:0]s2; output cout2; FA f1(a2[0],b2[0],cin2,s2[0],c1); FA f2(a2[1],b2[1],c1,s2[1],c2); FA f3(a2[2],b2[2],c2,s2[2],c3); FA f4(a2[3],b2[3],c3,s2[3],cout2); Endmodule b) FA_Verilog code: Task: 4 Design and Implementation of Combinational Circuits using Verilog HDL coding
  • 48. module FA(a,b,cin,s,cout); input a,b,cin; output s,cout; wire s,cout; wire w1,w2,w3,w4; xor x1(w1,a,b); xor x2(s,w1,cin); and a1(w2,a,b); and a2(w3,cin,b); and a3(w4,a,cin); or o1(cout,w2,w3,w4); endmodule c) Test bench: module RC_FA_TB(); reg [3:0]a2,b2; reg cin2; wire [3:0]s2; wire cout2; RC_adder f11(a2,b2,cin2,s2,cout2); initial begin cin2=0; #10 a2=4'b1100; b2=4'b0001; #10 a2=4'b1100; b2=4'b1001; #10 $stop; end endmodule d) Waveforms:
  • 49.