jianhuachews
Member level 2
hi guys, i want to obtain 2outputs ff outputs from the same input driven in. Everytime i press on "ff_return", the ff begins. Below is my program. I tried compiling it but it showed an error in modelsim. Can anyone guide and enlighten me? Thanks in advance.
# ** Error: C:\Modeltech_pe_edu_10.0a\examples\test_flipflop.vhd(23): Cannot read output "q".
Code:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity flipflop is port(
ff_keyin: in std_logic_vector(15 downto 0);
ff_clk, ff_return, ff_rst: in std_logic;
q, qbar: out std_logic_vector(15 downto 0)); -- q is the first ff output, while qbar is the second ff output from q.
end flipflop;
architecture behavioral OF flipflop is
signal ff_return_int, done: std_logic;
begin
process(ff_clk)
begin
if(ff_rst='1') then
qbar <= (others => '0');
q <= (others => '0');
elsif(ff_clk'event and ff_clk='1') then
if(ff_return='1') then
q <= not ff_keyin;
ff_return_int <= '1';
elsif(ff_return_int='1') then
qbar <= not q;
end if;
end if;
end process;
end behavioral;