O
Olaf Petzold
Guest
Hi,
at this time I try to write a ram banking entity (using XC2S100
internal block ram as one architecture; the infering ram architecture
is working):
entity ram_256x16 is
generic (
RESET_ACTIVE : std_logic := '1';
BIT_WIDTH : positive := 16
);
port (
clk : in std_logic;
rst : in std_logic;
en : in std_logic; -- L75, error below refers
ADDR : in std_logic_vector(7 downto 0);
DI : in std_logic_vector(BIT_WIDTH-1 downto 0);
DO : out std_logic_vector(BIT_WIDTH-1 downto 0);
we : in std_logic
);
end entity ram_256x16;
.....
entity ram_1536x16 is
generic (
RESET_ACTIVE : std_logic := '1';
BIT_WIDTH : positive := 16
);
port (
clk : in std_logic;
reset : in std_logic;
en : in std_logic;
AB : in std_logic_vector(10 downto 0);
DB_I : in std_logic_vector(BIT_WIDTH-1 downto 0);
DB_O : out std_logic_vector(BIT_WIDTH-1 downto 0);
we : in std_logic
);
end entity ram_1536x16;
architecture banking of ram_1536x16 is
alias ADDR : std_logic_vector(7 downto 0) is AB(7 downto 0);
alias CS : std_logic_vector(2 downto 0) is AB(10 downto 8);
signal clk_ram : std_logic;
function chip_sel (
addr : std_logic_vector(CS'length-1 downto 0);
en : std_logic;
idx : unsigned)
return std_logic is
begin
-- L181 won't compile; how to write this?
return (en = '1') and (unsigned(addr) = idx)
end function;
begin -- architecture RAMB4_S16_banking
bank0 : entity work.ram_256x16
port map (
CLK => clk,
RST => reset,
EN => chip_sel(CS, en, 0), -- L198 won't work
ADDR => ADDR,
DO => DB_O,
DI => DB_I,
WE => we
);
....
Concerning the return value of the function I get the error:
** Error:
xc2s100_ram.vhd(181): Type error resolving infix expression "and".
concerning the use of this function for EN = ... of instance bank0:
** Error: xc2s100_ram.vhd(198): No feasible entries for subprogram
"chip_sel".
** Error: xc2s100_ram.vhd(198): The actual for formal 'en' is not a
globally static expression.
** Error: xc2s100_ram.vhd(75): (vcom-1164) The actual expression for
formal port 'en' is an impure function.
What does it mean and how can I correct this?
The reason for this function is to force a logical combination and
avoid latches (generated before using if/else/case clause)
Thanks and Regards,
Olaf
at this time I try to write a ram banking entity (using XC2S100
internal block ram as one architecture; the infering ram architecture
is working):
entity ram_256x16 is
generic (
RESET_ACTIVE : std_logic := '1';
BIT_WIDTH : positive := 16
);
port (
clk : in std_logic;
rst : in std_logic;
en : in std_logic; -- L75, error below refers
ADDR : in std_logic_vector(7 downto 0);
DI : in std_logic_vector(BIT_WIDTH-1 downto 0);
DO : out std_logic_vector(BIT_WIDTH-1 downto 0);
we : in std_logic
);
end entity ram_256x16;
.....
entity ram_1536x16 is
generic (
RESET_ACTIVE : std_logic := '1';
BIT_WIDTH : positive := 16
);
port (
clk : in std_logic;
reset : in std_logic;
en : in std_logic;
AB : in std_logic_vector(10 downto 0);
DB_I : in std_logic_vector(BIT_WIDTH-1 downto 0);
DB_O : out std_logic_vector(BIT_WIDTH-1 downto 0);
we : in std_logic
);
end entity ram_1536x16;
architecture banking of ram_1536x16 is
alias ADDR : std_logic_vector(7 downto 0) is AB(7 downto 0);
alias CS : std_logic_vector(2 downto 0) is AB(10 downto 8);
signal clk_ram : std_logic;
function chip_sel (
addr : std_logic_vector(CS'length-1 downto 0);
en : std_logic;
idx : unsigned)
return std_logic is
begin
-- L181 won't compile; how to write this?
return (en = '1') and (unsigned(addr) = idx)
end function;
begin -- architecture RAMB4_S16_banking
bank0 : entity work.ram_256x16
port map (
CLK => clk,
RST => reset,
EN => chip_sel(CS, en, 0), -- L198 won't work
ADDR => ADDR,
DO => DB_O,
DI => DB_I,
WE => we
);
....
Concerning the return value of the function I get the error:
** Error:
xc2s100_ram.vhd(181): Type error resolving infix expression "and".
concerning the use of this function for EN = ... of instance bank0:
** Error: xc2s100_ram.vhd(198): No feasible entries for subprogram
"chip_sel".
** Error: xc2s100_ram.vhd(198): The actual for formal 'en' is not a
globally static expression.
** Error: xc2s100_ram.vhd(75): (vcom-1164) The actual expression for
formal port 'en' is an impure function.
What does it mean and how can I correct this?
The reason for this function is to force a logical combination and
avoid latches (generated before using if/else/case clause)
Thanks and Regards,
Olaf