library IEEE;
|
library IEEE;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
|
|
-- Uncomment the following lines to use the declarations that are
|
-- Uncomment the following lines to use the declarations that are
|
-- provided for instantiating Xilinx primitive components.
|
-- provided for instantiating Xilinx primitive components.
|
--library UNISIM;
|
--library UNISIM;
|
--use UNISIM.VComponents.all;
|
--use UNISIM.VComponents.all;
|
|
|
entity io_control is
|
entity io_control is
|
generic (
|
generic (
|
stage : natural:=3);
|
stage : natural:=3);
|
|
|
port (
|
port (
|
clk : in std_logic;
|
clk : in std_logic;
|
rst : in std_logic;
|
rst : in std_logic;
|
mem_bk : in std_logic;
|
mem_bk : in std_logic;
|
Gen_state : in std_logic_vector(2*stage+2 downto 0);
|
Gen_state : in std_logic_vector(2*stage+2 downto 0);
|
bank0_busy : out std_logic;
|
bank0_busy : out std_logic;
|
bank1_busy : out std_logic;
|
bank1_busy : out std_logic;
|
Output_enable: out std_logic);
|
Output_enable: out std_logic);
|
end io_control;
|
end io_control;
|
|
|
architecture io_control of io_control is
|
architecture io_control of io_control is
|
|
|
alias state: std_logic_vector(2 downto 0) is Gen_state(2*stage+2 downto 2*stage);
|
alias state: std_logic_vector(2 downto 0) is Gen_state(2*stage+2 downto 2*stage);
|
alias counter: std_logic_vector(2*stage-1 downto 0) is Gen_state(2*stage-1 downto 0);
|
alias counter: std_logic_vector(2*stage-1 downto 0) is Gen_state(2*stage-1 downto 0);
|
|
|
begin
|
begin
|
|
|
Outen:process (clk, rst)
|
Outen:process (clk, rst)
|
begin -- process
|
begin -- process
|
if rst = '1' then -- asynchronous reset (active low)
|
if rst = '1' then -- asynchronous reset (active low)
|
Output_enable <= '0';
|
Output_enable <= '0';
|
elsif clk'event and clk = '1' then -- rising clock edge
|
elsif clk'event and clk = '1' then -- rising clock edge
|
if unsigned(state)=stage-1 and unsigned(counter)=55 then
|
if unsigned(state)=stage-1 and unsigned(counter)=55 then
|
Output_enable <= '1';
|
Output_enable <= '1';
|
else
|
else
|
Output_enable <= '0';
|
Output_enable <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
Bank_busy:process(clk, rst)
|
Bank_busy:process(clk, rst)
|
begin
|
begin
|
if rst = '1' then
|
if rst = '1' then
|
bank0_busy <= '0';
|
bank0_busy <= '0';
|
bank1_busy <= '0';
|
bank1_busy <= '0';
|
elsif clk'event and clk = '1' then
|
elsif clk'event and clk = '1' then
|
if unsigned(state)=0 then
|
if unsigned(state)=0 then
|
if mem_bk = '0' then
|
if mem_bk = '0' then
|
bank0_busy <= '1';
|
bank0_busy <= '1';
|
else
|
else
|
bank1_busy <= '1';
|
bank1_busy <= '1';
|
end if;
|
end if;
|
else
|
else
|
bank0_busy <= '0';
|
bank0_busy <= '0';
|
bank1_busy <= '0';
|
bank1_busy <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
end io_control;
|
end io_control;
|
|
|