![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1xhN4-zwZODLH-p7pkkWyUKP6SqON-E9sj-9vHgnGveCAp6hJSf-O4hyzV02R3rcuQeIdKhGs9ATa5X8yv5PSNU_9VXTBVBMtSDgZ01CT75vZeFwFFw42xhOR-q8T57IF8eKdIceciteL/s320/D+flip.png)
If rst = ‘1’, then the output must be q = ‘0’ ,regardless of the status of clk.
Otherwise, the output must copy the input (that is, q = d) at the positive edge of clk
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY dff IS
PORT (d, clk, rst: IN STD_LOGIC;
q: OUT STD_LOGIC);
END dff;
ARCHITECTURE behavior OF dff IS
BEGIN
PROCESS (clk, rst)
BEGIN
IF (rst='1') THEN
q <= '0';
ELSIF (clk'EVENT AND clk='1') THEN
q <= d;
END IF;
END PROCESS;
END behavior;
Output
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU3pKjl2EkeK3tqCfDRNcAx35R1an6lIlZgxpQ0qgao4q1cCi4w12QG8Dfwn_vpKdfBKk2L9gztqnMWWrRam035NRWZUIO42jTUSRzgMx18ariqn36qFOhIaOi0WV-uSjFQLqDWfFvLx0U/s320/output.png)
information shared by www.irvs.info