Pradeepa_kck
Newbie level 5
- Joined
- Dec 27, 2012
- Messages
- 10
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Sri Lanka
- Activity points
- 1,378
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?