----------------------------------- -- CONTROLADOR DE DRAM -- -- Creat per: Lluís Magí 2000 -- ----------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; ENTITY cdram IS PORT( clk : in std_logic; -- 16 MHz rd : in std_logic; -- a nivell baix wr : in std_logic; -- a nivell baix ale : in std_logic; fila : in unsigned(9 downto 0); columna : in unsigned(9 downto 0); data_user : inout std_logic_vector(3 downto 0); data_ram : inout std_logic_vector(3 downto 0); address : out unsigned(9 downto 0); cas : out std_logic; ras : out std_logic; oe : buffer std_logic; we : buffer std_logic; f_cicle : out std_logic ); constant DELAY: integer := 2; constant TW: integer := 3; constant TRAD: integer := 4; constant TRCD : integer := 5; constant TR : integer := 6; constant TAR : integer := 7; constant TRAS : integer := 9; constant TRC : integer := 12; constant MAX : unsigned (9 downto 0) := "1111111111"; END cdram; ARCHITECTURE arq_cdram OF cdram IS signal cont_row : unsigned(9 downto 0); signal r_busy, w_busy, busy : std_logic; signal c_trc_r: integer range 0 to TRC-DELAY; signal c_trc_rw: integer range 0 to TRC; signal rw_ras, r_ras : std_logic; signal dades : std_logic_vector(3 downto 0); signal espera : std_logic; BEGIN -------------- cicle de refresc ----------------------- -- TRC = Time Refresh Cicle process(clk) begin if rising_edge(clk) then if busy='1' then c_trc_r<=0; else if c_trc_r < TRC then c_trc_r<=c_trc_r+1; else c_trc_r<=0; end if; end if; end if; end process; -- cicle de refresc : RETARD, RAS='0', RAS='1' ,........... process(clk) begin if rising_edge(clk) then if busy='0' then if c_trc_r < DELAY then r_ras<='1'; elsif c_trc_r < TRAS then r_ras<='0'; elsif c_trc_r if inici_r='1' or inici_w='1' then --esperem inici estat<=1; address<=fila; end if; cas<='1'; ras<='1'; temps<=0; when 1 => ras<='0'; -- activació del RAS cas<='1'; if temps ras<='0'; cas<='0'; -- activació del CAS if temps ras<='1'; cas<='1'; address<="ZZZZZZZZZZ"; if temps