Line 56... |
Line 56... |
-- To Optimze :
|
-- To Optimze :
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|
-- (!)
|
-- (!)
|
-- Original file modified to reduce code and make WR and reset signals
|
-- Original file modified to reduce code and make WR and reset signals
|
-- positive and make Reset sincronous
|
-- positive, make Reset sincronous, make data transfer asinc.
|
|
|
|
|
library ieee;
|
library ieee;
|
|
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
Line 98... |
Line 98... |
|
|
|
|
architecture spmem_beh of mem_8bit_reset is
|
architecture spmem_beh of mem_8bit_reset is
|
|
|
type data_array is array (integer range <>) of std_logic_vector(WIDTH-1 downto 0);
|
type data_array is array (integer range <>) of std_logic_vector(WIDTH-1 downto 0);
|
|
-- signal s_reset: std_logic;
|
-- Memory Type
|
-- Memory Type
|
signal data : data_array(0 to (2** add_width-1) ); -- Local data
|
signal data : data_array(0 to (2** add_width-1) ); -- Local data
|
|
|
|
|
-- FLEX/APEX devices require address to be registered with inclock for read operations
|
-- FLEX/APEX devices require address to be registered with inclock for read operations
|
-- This signal is used only when OPTION = 1
|
-- This signal is used only when OPTION = 1
|
-- signal regA : std_logic_vector( (add_width -1) downto 0);
|
-- signal regA : std_logic_vector( (add_width -1) downto 0);
|
|
|
procedure init_mem(signal memory_cell : inout data_array ) is
|
procedure init_mem(signal memory_cell : inout data_array ) is
|
Line 128... |
Line 130... |
-- Reset_ENABLED : if USE_RESET = true generate
|
-- Reset_ENABLED : if USE_RESET = true generate
|
|
|
-- -------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------
|
-- CS_ENABLED : if USE_CS = true generate
|
-- CS_ENABLED : if USE_CS = true generate
|
|
|
process (clk, reset)
|
process (clk, reset,CS,WR, add)
|
|
|
begin -- PROCESS
|
begin -- PROCESS
|
-- activities triggered by asynchronous reset (active low)
|
-- activities triggered by asynchronous reset (active low)
|
|
|
-- activities triggered by rising edge of clock
|
-- activities triggered by rising edge of clock
|
if clk'event and clk = '1' then
|
|
|
|
|
data_out <= data(conv_integer(add));
|
|
|
|
|
|
if clk'event and clk = '1' then
|
if reset = '1' then
|
if reset = '1' then
|
data_out <= (others => DEFAULT_OUT);
|
|
init_mem ( data);
|
init_mem ( data);
|
else
|
elsif CS = '1' then
|
if CS = '1' then
|
|
if WR = '1' then
|
if WR = '1' then
|
data(conv_integer(add)) <= data_in;
|
data(conv_integer(add)) <= Data_In;
|
data_out <= (others => DEFAULT_OUT);
|
|
else
|
|
data_out <= data(conv_integer(add));
|
|
end if;
|
|
else
|
|
data_out <= (others => DEFAULT_OUT);
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
|
|
end process;
|
end process;
|
-- end generate CS_ENABLED;
|
-- end generate CS_ENABLED;
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- CS_DISABLED : if USE_CS = false generate
|
-- CS_DISABLED : if USE_CS = false generate
|