You are on page 1of 2

library ieee ;

use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity my_flash_interface is
port (
rst_flash : in std_logic;
clk_flash : in std_logic;
flash_en_int : in std_logic;

im_reqn : in std_logic;

flash_data_in : in std_logic_vector(31 downto 0);

wait_processor : out std_logic;


bus_sel : out std_logic;
dd_ins_data : out std_logic_vector(31 downto 0)

);

end my_flash_interface ;

architecture my_flash_interface_a of my_flash_interface is

type state_type is (S0,S1,S2,S3,S4);

signal state_flash : state_type;

signal bus_sel_o : std_logic;

begin

bus_sel <= bus_sel_o after 10 ns;


--
--bus_sel <= bus_sel_o;

flash_p : process (clk_flash,rst_flash,state_flash)


begin

if clk_flash'event and clk_flash = '1' then

if rst_flash = '0' then

wait_processor <= '1';


bus_sel_o <= '0';
state_flash <= S0;
dd_ins_data <= (others => '0');

else
case state_flash is

when S0 =>
if flash_en_int = '1' then

wait_processor <= '0';


bus_sel_o <= '1';

state_flash <= S1;

end if;

when S1 =>

state_flash <= S2;

when S2 =>

bus_sel_o <= '0';


dd_ins_data <= flash_data_in;

if im_reqn = '0' then


state_flash <= S3; -- ins memory
access
else
state_flash <= S0;
wait_processor <= '1';

end if;

when S3 =>

state_flash <= S4;

when S4 =>

wait_processor <= '1';


state_flash <= S0;

when others =>


null;

end case;

end if;
end if;
end process flash_p;

end my_flash_interface_a;

You might also like