Hi, this was posted a while back, but I'll answer anyway:
Let's say you have a simple memory interface,with an Enable (toggle for R/W), Addr, and Data word, like this:
entity PageBuf_1 is
port (
Enable : in std_logic;
Address : in std_logic_vector (6 downto 0);
Data : inout std_logic_vector (31 downto 0)
);
end PageBuf_1;
Then your declared memory array would look like this, as declared within the Architecture:
architecture RAM of PageBuf_1 is
type MEMORY_ARRAY is array (0 to 127) of std_logic_vector (31 downto 0);
begin
....
You declare you working variables from controlling access to memory, like this (which are local to the process); you're sensitive to any of the inputs changing value to execute the process:
process (Enable, Address, Data)
variable TEMP : std_logic_vector (6 downto 0);
variable VALID_ADDRESS : boolean;
variable Memory : MEMORY_ARRAY; -- you instantiate your declared array here.
Then, you'd have your process that controls reading the Enable line to determine whether the op is a read or write, from which you would index into the memory array to the specified location and either assign to, or read from, the location, like this:
if (Enable = '0') then
for i in 0 to 127 loop
if (SomeCompareFunctionIsTrue (TEMP, Address)) then
Data <= Memory (i);
VALID_ADDRESS := TRUE;
end if;
TEMP := FunctionToIncrementArrayIndex (TEMP);
end loop;
You'll have a similar If-Then block in the process for when you want to write to memory. Note that there are many styles of memory models, this is simply one example. Check out Ashenden's VHDL text where he discusses others. There are places where I've indicated that some "magic" need to be done with regards to incrementing and index and comparing two signals (which will likely involve VHDL type conversions).
Remember also that you need to consider boundary conditions and exceptions and what to do if you have an invalid address or enable value (since we're dealing with MVL9 here).
Hope this helps. have fun.
regds,
jim