Verilog code for positive edge triggered D flip flop using NAND Gates

`timescale 1ns / 1ps
module PositiveEdgeTriggeredDFlipflop(q,d,clk,rst);
input d,clk,rst;
output q;
wire a,b,c,e,t;
wire q1,q1bar;
and(t,rst,d);
nand(a,e,b);
nand(b,clk,a);
nand(c,b,clk,e);
nand(e,c,t);
nand(q1,q1bar,b);
nand(q1bar,q1,c);
assign q=q1; 
endmodule

Comments