Professional Documents
Culture Documents
Mayank With Ep Wave
Mayank With Ep Wave
Mayank With Ep Wave
com)
Examples
Community
Collaborate
Forum (https://groups.google.com/forum/#!forum/eda-playground)
Follow @edaplayground
211
testbench.sv testbenchs.sv
1 // Code your testbench here SV/Verilog Testbench
2 module t_full_adder;
3 wire S,C;
4
5 reg a,b,c,M;
6
7 full_adder FA1(S,C,a,b,c,M);
8 initial
9 begin
10 $dumpfile("t_full_adder.vcd");
11 $dumpvars();
12 a=1'b0;b=1'b0;c=1'b0;M=1'b0;;
13 #5 a=1'b0;b=1'b0;c=1'b1;M=1'b0;
#5 a=1'b0;b=1'b1;c=1'b0;M=1'b0;
14
15 #5 a=1'b0;b=1'b1;c=1'b1;M=1'b0;
16 #5 a=1'b1;b=1'b0;c=1'b0;M=1'b0;
EPWave #5
17 a=1'b1;b=1'b0;c=1'b1;M=1'b0;
#5 a=1'b1;b=1'b1;c=1'b0;M=1'b0;
18
19 #5 a=1'b1;b=1'b1;c=1'b1;M=1'b0;
20 #5 a=1'b1;b=1'b1;c=1'b0;M=1'b1;
21 #5 a=1'b1;b=1'b1;c=1'b1;M=1'b1;
22 #5 a=1'b1;b=1'b1;c=1'b0;M=1'b1;
23 #5 a=1'b1;b=1'b1;c=1'b1;M=1'b1;
24 #5 a=1'b1;b=1'b1;c=1'b0;M=1'b1;
25 #5 a=1'b1;b=1'b1;c=1'b1;M=1'b1;
26 #5 a=1'b1;b=1'b1;c=1'b0;M=1'b1;
27 #5 a=1'b1;b=1'b1;c=1'b1;M=1'b1;
28 end
29
30 endmodule
design.sv designs.sv
1 // Code your design here SV/Verilog Design
2
3 // starting module and defining output and input variables
4
5 // here module defines a design component by defining the block ports and internal
behaviour . Higher level modules can embed lower level modules to create a heirarchial
designs . here we are first defining the a module for half adder and we will use it
latter in the module of full adder
6
7 module full_adder(
8
9 output sum,carry,
10
11 input A,B,C,
12 input M
13 );
14
15
16 // assigning the values of outputs as a function of inputs
17
18
19 assign sum = A^B^C ;
20
21 assign carry= ((A^M)&(B||C))||(B&C);
22
23
24 // ending the module
25
26
27 endmodule
28
29
30 // endmodule is used to end the module block
31
32
Log Share