Pradeepa_kck
Newbie level 5
Following is a working VHDL code for a D-flip flop with Asynchronous reset. Note that it is using a variable state for it's operation.
architecture var of D_FF is
begin
p0: process(Clock, Reset) is
variable state : std_logic;
begin
if(Reset = '0') then
state := '0';
elsif rising_edge(Clock) then
state := D;
end if;
Q <= state;
Qbar <= notstate;
end process p0;
end architecture var;
My problem is that without using this state variable can't we simply drive the output by D. Then we will not need a variable to store the state.
Q <= D;
Q <= not D;
Is there any drawback of doing that?
architecture var of D_FF is
begin
p0: process(Clock, Reset) is
variable state : std_logic;
begin
if(Reset = '0') then
state := '0';
elsif rising_edge(Clock) then
state := D;
end if;
Q <= state;
Qbar <= notstate;
end process p0;
end architecture var;
My problem is that without using this state variable can't we simply drive the output by D. Then we will not need a variable to store the state.
Q <= D;
Q <= not D;
Is there any drawback of doing that?