AddressWidth : integer := 10); --address width
port (
clk : in std_logic;-- clock
+ reset : in std_logic;-- reset
WrEn : in std_logic;-- write enable
WrAddr : in std_logic_vector(AddressWidth - 1 downto 0);-- write address
Din : in std_logic_vector(DataWidth - 1 downto 0);-- data in
MemoryControll : process(clk)
begin -- process MemoryControll
- if rising_edge(clk) then
- Dout <= memory(to_integer(unsigned(ReAddr))); --read memory
- if(WrEn = '1') then
- memory(to_integer(unsigned(WrAddr))) <= Din; -- write memory
- end if;
+ if rising_edge(clk) then
+ if reset = '1' then
+ Dout <= (others => '0');
+ else
+ Dout <= memory(to_integer(unsigned(ReAddr))); --read memory
+ if(WrEn = '1') then
+ memory(to_integer(unsigned(WrAddr))) <= Din; -- write memory
+ end if;
+ end if;
end if;
end process MemoryControll;
AddressWidth : integer);
port (
clk : in std_logic;
+ reset : in std_logic;
WrEn : in std_logic;
WrAddr : in std_logic_vector(AddressWidth - 1 downto 0);
Din : in std_logic_vector(DataWidth - 1 downto 0);
AddressWidth => HistogramRange)
port map (
clk => clk,
+ reset => reset,
WrEn => MemWrEn,
WrAddr => MemWrAddr,
Din => MemDIn,