Forum Discussion
Altera_Forum
Honored Contributor
8 years agoInvalid memory implementation
Please I need a help in following two questions: First : I need to read from memory one element at a time, however, memory locations is not sequential so I need two variables as indicators. The...
Altera_Forum
Honored Contributor
8 years agoIf you're trying to infer a memory, you should be creating it as a 2D array, similar to this for a single port RAM:
ARCHITECTURE logic OF sp_ram IS
TYPE mem_type IS ARRAY (0 TO 63) OF
std_logic_vector (7 DOWNTO 0);
SIGNAL mem: mem_type;
BEGIN
PROCESS (clock) BEGIN
IF rising_edge(clock) THEN
IF (wren = '1') THEN
mem(to_integer(unsigned(address)))
<= data;
END IF;
END IF;
END PROCESS;
q <= mem(to_integer(unsigned(address)));
END ARCHITECTURE logic;