I'm trying do declare a type to use in the port but i'm with a problem if I do the following I get an error that STD_LOGIC_VECTOR isn't declared
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
-- Custom types --
package Common is
type Mem_in is array (2**6 to 0) of STD_LOGIC_VECTOR (11 downto 0);
type DinDout is range 11 downto 0;
end package Common ;
-- Use Custom Type
use work.Common.all;
entity MUX is
Port (
D : in Mem_in;
Q : out DinDout;
SEL : in STD_LOGIC_VECTOR (11 downto 0)
);
end MUX;
Why can't I use STD_LOGIC_VECTOR? If I change it to DinDout I get another problem down the line in the architecture: to_integer is not declared; indexed name is not a dindout.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
-- Custom types --
package Common is
type Mem_in is array (2**6 to 0) of STD_LOGIC_VECTOR (11 downto 0);
type DinDout is range 11 downto 0;
end package Common ;
And the entity using package Common:
-- Use Custom Type
use work.Common.all;
entity MUX is
Port (
D : in Mem_in;
Q : out DinDout;
SEL : in DinDout
);
end MUX;
architecture Arc of MUX is
begin
Q <= D(to_integer(unsigned(SEL)));
end Arc;
how can I add STD_logic_vector to my package OR solve these two errors: to_integer is not declared; indexed name is not a dindout?
thanks
Mem_inarray type has 2**6 + 1 (2**6 downto 0) elements which is going the same number of distinct indexes not 2**DinDout'length causing a constraint violations for some values of SEL. Your memory size should be a power of 2 matching the length of SEL. It seems unusual to provide a port with so many 'bits' (2**6+1 * 12 - the length of a memory element or 780. This memory read MUX that should likely be located with the actual for D particularly for block memory. - user1155120