Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

/*program for d-ff */ module ff_d (d,clk,q,reset_n,q_n); //module name. input d,clk,reset_n; //input port declaration .

output q,q_n; //output port declaration. reg q,q_n; always@(posedge clk,negedge reset_n) begin if (reset_n==0) begin //if reset is active. q<=0; q_n<=1; end else begin //if reset is not applied. q<=d; q_n<=!d; end end endmodule

You might also like