Full_Adder_Gate_Level - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

205


24
 
1
// Testbench for Full_Adder
2
3
`timescale 1ns/1ns
4
5
module Test_Full_Adder; // No need for Ports
6
7
  reg  a, b, c;    // variables
8
  wire sum, cout;  // wires
9
10
  // Instantiate the module to be tested
11
  Full_Adder FA (a, b, c, cout, sum);
12
13
  initial begin    // initial block
14
    $dumpfile("Test_Full_Adder.vcd");
15
    $dumpvars(1, FA);
16
    a=0; b=0; c=0; // at t=0 time units
17
    #20 a=1; b=1;  // at t=20
18
    #20 a=0; b=0; c=1; // at t=40
19
    #20 a=1; c=0; // at t=60
20
    #20 $finish;    // at t=80 finish simulation
21
22
  end   // end of initial block
23
endmodule
24
xxxxxxxxxx
1
11
 
1
`timescale 1ns/1ns
2
3
module Full_Adder(input a, b, c, output cout, sum);
4
  wire w1, w2, w3; 
5
  and #2 (w1, a, b);
6
  xor #3 (w2, a, b);
7
  and #2 (w3, w2, c);
8
  xor #3 (sum, w2, c);
9
  or  #2 (cout, w1, w3);
10
endmodule
11
3644 views and 1 likes     
 
Full Adder with gates

Full Adder with gates

140:0