Sunday, January 12, 2014

NAND Gate






module nand_gate(a,b,c);
  input a,b;
  output wire c;
  assign c=~(a & b);
endmodule

Test Bench

`timescale 1ns/1ns
module tb();
  reg a,b;
  wire c;
  nand_gate U1(
                .a(a),
                .b(b),
                .c(c));
              
  initial
  begin 
    a=0;
    b=1;
    #10;
    a=1;
    b=1;
    #20;
    b=0;
    #100;
  //  $finish;
  end

  endmodule

No comments:

Post a Comment