--- Quote Start ---
Thanks for the prompt response.
I don't think I can use signals to store the samples though, right? Cause I need to store my data coming from the microphone into a memory, say like 8 samples of 32 bits. Then Call each sample, apply a filter and then read them back to the speakers when the specified control signals in the audio codec is set to high.
--- Quote End ---
Okay, how does this look like? I added the read part a well.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use ieee.numeric_std.all;
entity sram is
Port
(clk, Reset, run : IN std_logic;
adc_full, data_over : IN std_logic;
data : IN std_logic_vector (7 downto 0);
ADCout : OUT std_logic_vector(7 downto 0));
end sram;
ARCHITECTURE Behavorial OF sram IS
signal adccount, datacount : integer range 0 to 7 := 0;
--CONSTANT word_limit : integer := 15;
type mem_type is array (0 to 7) of std_logic_vector(7 downto 0);
signal ADC_array : mem_type :=
( 0 => "00010000",
1 => "00010001",
2 => "00010010",
3 => "00010011",
4 => "00010100",
5 => "00010101",
6 => "00010110",
7 => "00010111");
BEGIN
process(clk)
begin
if (Reset = '1') then
adccount <= 0;
elsif (rising_edge(clk)) then
if (adc_full = '1') then
adccount <= adccount + 1;
end if;
ADC_array(adccount) <= data ;
end if;
if (adccount = 8) then
adccount <= 0;
end if;
--read the data
datacount <= 1;
if (rising_edge(clk)) then
if (data_over = '1') then
datacount <= datacount + 1;
end if;
ADCout <= ADC_array(datacount);
end if;
if (datacount = 8) then
datacount <= 0;
end if;
end process;
END Behavorial;