D Flip Flop with active-low asynchronous Reset

I was trying to code a D-Flip Flop with active-low asynchronous reset with NAND-gates.

Below, is the schematic for the same.

Verilog Codes for 2-input nand gate & 3-input nand-gate:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>module nand2
( input i0,
input i1,
output z
);
assign z = ~(i0 & i1);
endmodule
module nand3
( input i0,
input i1,
input i2,
output z
);
assign z = ~(i0 & i1 & i2);
endmodule
</code>
<code>module nand2 ( input i0, input i1, output z ); assign z = ~(i0 & i1); endmodule module nand3 ( input i0, input i1, input i2, output z ); assign z = ~(i0 & i1 & i2); endmodule </code>
module nand2
( input i0, 
  input i1,
  output z
 );

assign z = ~(i0 & i1);

endmodule


module nand3
( input i0,
  input i1,
  input i2,
  output z
 );

assign z = ~(i0 & i1 & i2);

endmodule

Verilog Code for DFF:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>module DFF
( input CK,
input RD,
input D,
output Q,
output QN
);
wire net_nand21_in0_nand33_out;
wire net_nand31_in0_nand21_out;
wire net_nand22_in0_nand31_out;
wire net_nand34_in1_nand32_out;
nand2 NAND21(.i0(net_nand21_in0_nand33_out), .i1(net_nand22_in0_nand31_out), .z(net_nand31_in0_nand21_out));
nand3 NAND31(.i0(net_nand31_in0_nand21_out), .i1(CK), .i2(RD), .z(net_nand22_in0_nand31_out));
nand3 NAND32(.i0(net_nand22_in0_nand31_out), .i1(CK), .i2(net_nand21_in0_nand33_out), .z(net_nand34_in1_nand32_out));
nand3 NAND33(.i0(net_nand34_in1_nand32_out), .i1(RD), .i2(D), .z(net_nand21_in0_nand33_out));
nand2 NAND22(.i0(net_nand22_in0_nand31_out), .i1(QN), .z(Q));
nand3 NAND34(.i0(Q), .i1(net_nand34_in1_nand32_out), .i2(RD), .z(QN));
endmodule
</code>
<code>module DFF ( input CK, input RD, input D, output Q, output QN ); wire net_nand21_in0_nand33_out; wire net_nand31_in0_nand21_out; wire net_nand22_in0_nand31_out; wire net_nand34_in1_nand32_out; nand2 NAND21(.i0(net_nand21_in0_nand33_out), .i1(net_nand22_in0_nand31_out), .z(net_nand31_in0_nand21_out)); nand3 NAND31(.i0(net_nand31_in0_nand21_out), .i1(CK), .i2(RD), .z(net_nand22_in0_nand31_out)); nand3 NAND32(.i0(net_nand22_in0_nand31_out), .i1(CK), .i2(net_nand21_in0_nand33_out), .z(net_nand34_in1_nand32_out)); nand3 NAND33(.i0(net_nand34_in1_nand32_out), .i1(RD), .i2(D), .z(net_nand21_in0_nand33_out)); nand2 NAND22(.i0(net_nand22_in0_nand31_out), .i1(QN), .z(Q)); nand3 NAND34(.i0(Q), .i1(net_nand34_in1_nand32_out), .i2(RD), .z(QN)); endmodule </code>
module DFF
( input CK,
  input RD,
  input D,
  output Q,
  output QN
 );

wire net_nand21_in0_nand33_out;
wire net_nand31_in0_nand21_out;
wire net_nand22_in0_nand31_out;
wire net_nand34_in1_nand32_out;

nand2 NAND21(.i0(net_nand21_in0_nand33_out), .i1(net_nand22_in0_nand31_out), .z(net_nand31_in0_nand21_out));
nand3 NAND31(.i0(net_nand31_in0_nand21_out), .i1(CK), .i2(RD), .z(net_nand22_in0_nand31_out));
nand3 NAND32(.i0(net_nand22_in0_nand31_out), .i1(CK), .i2(net_nand21_in0_nand33_out), .z(net_nand34_in1_nand32_out));
nand3 NAND33(.i0(net_nand34_in1_nand32_out), .i1(RD), .i2(D), .z(net_nand21_in0_nand33_out));
nand2 NAND22(.i0(net_nand22_in0_nand31_out), .i1(QN), .z(Q));
nand3 NAND34(.i0(Q), .i1(net_nand34_in1_nand32_out), .i2(RD), .z(QN));

endmodule

Testbench of the DFF:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>module DFF_tb();
reg D;
reg CK;
reg RD;
wire Q;
wire QN;
DFF dut(D,CK,RD,Q,QN);
initial begin
CK=0;
forever #10 CK = ~CK;
end
initial begin
RD=0;
D <= 1;
#50;
RD=1;
#50;
D <= 0;
#50;
D <= 1;
end
endmodule
</code>
<code>module DFF_tb(); reg D; reg CK; reg RD; wire Q; wire QN; DFF dut(D,CK,RD,Q,QN); initial begin CK=0; forever #10 CK = ~CK; end initial begin RD=0; D <= 1; #50; RD=1; #50; D <= 0; #50; D <= 1; end endmodule </code>
module DFF_tb();

reg D;
reg CK;
reg RD;
wire Q;
wire QN;

DFF dut(D,CK,RD,Q,QN);

initial begin
CK=0;
   forever #10 CK = ~CK;  
end

initial begin 
RD=0;
D <= 1;
#50;
RD=1;
#50;
D <= 0;
#50;
D <= 1;
end 
endmodule

The waveforms are still not behaving as a D-FlipFlop with active-low async-reset:

Can you please help me with the problem? Is there some issue with the schematic or with the code?

Thanks & Regards,
Parth.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật