Guest
hi all:
when i finish this , i got a problem like
"Unsupported feature error: non locally static bounds are not
supported"
my code is
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ram is
generic ( k: integer :=8;
w: integer :=4);
port ( rd, wr, cs : in std_logic;
adr: in std_logic_vector(w-1 downto 0);
din: in std_logic_vector(k-1 downto 0);
doutut std_logic_vector(k-1 downto 0));
end ram;
architecture behav of ram is
--constant a : integer := 4;
subtype word is std_logic_vector(k-1 downto 0);
type memory is array (0 to 2 ** w-1) of word;
signal sram : memory;
signal adr_in : integer;
begin
adr_in <= conv_integer(adr);
write : process (wr, cs, adr_in, din, rd)
begin
if wr = '0' then
if cs = '0' and rd = '1' then sram(adr_in) <= din;
end if;
end if;
end process;
read : process(rd, cs, adr_in, wr)
begin
if(rd = '0' and cs = '0' and wr = '1') then dout <= sram(adr_in);
else dout <= "ZZZZZZZZ";
end if;
end process;
end behav;
when i finish this , i got a problem like
"Unsupported feature error: non locally static bounds are not
supported"
my code is
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ram is
generic ( k: integer :=8;
w: integer :=4);
port ( rd, wr, cs : in std_logic;
adr: in std_logic_vector(w-1 downto 0);
din: in std_logic_vector(k-1 downto 0);
doutut std_logic_vector(k-1 downto 0));
end ram;
architecture behav of ram is
--constant a : integer := 4;
subtype word is std_logic_vector(k-1 downto 0);
type memory is array (0 to 2 ** w-1) of word;
signal sram : memory;
signal adr_in : integer;
begin
adr_in <= conv_integer(adr);
write : process (wr, cs, adr_in, din, rd)
begin
if wr = '0' then
if cs = '0' and rd = '1' then sram(adr_in) <= din;
end if;
end if;
end process;
read : process(rd, cs, adr_in, wr)
begin
if(rd = '0' and cs = '0' and wr = '1') then dout <= sram(adr_in);
else dout <= "ZZZZZZZZ";
end if;
end process;
end behav;