shaiko
Advanced Member level 5
- Joined
- Aug 20, 2011
- Messages
- 2,644
- Helped
- 303
- Reputation
- 608
- Reaction score
- 297
- Trophy points
- 1,363
- Activity points
- 18,302
I'm trying to build a generic multi port memory (register based - not RAM).
I wrote the following package:
I use the package in my entity as follows:
This is the write process:
Modelsim fails with the following error:
What did I do wrong?
I wrote the following package:
Code:
package definitions is
constant memory_depth : positive := 256 ;
constant memory_width : positive := 8 ;
constant number_of_ports : positive := 4 ;
type array_of_address is array ( 0 to number_of_ports ) of unsigned ( log_2_decimal ( memory_depth ) downto 0 ) ;
type memory is array ( 0 to memory_depth ) of unsigned ( memory_width - 1 downto 0 ) ;
end package definitions ;
I use the package in my entity as follows:
Code:
I_WRITE : in unsigned ( number_of_ports - 1 downto 0 ) ;
I_ADDRESS : in array_of_address ;
I_DATA: in memory ;
This is the write process:
Code:
process ( I_CLOCK , I_RESET ) is
begin
if I_RESET = '1' then
memory_matrix <= ( others => ( others => '0' ) ) ;
elsif rising_edge ( I_CLOCK ) then
for index in 0 to number_of_ports
loop
if I_WRITE ( index ) = '1' then
memory_matrix <= I_DATA ( to_integer ( I_ADDRESS ( i ) ) ) ;
end if ;
end loop ;
end if;
end process ;
Modelsim fails with the following error:
Cannot resolve indexed name as type work.definitions.memory.
What did I do wrong?