S
srinukasam
Guest
hello
in my design iam trying to create my memory with record type. its shows
error(type error resolving index expression ) while doing simulation with
model sim.
why iam using like this is,i read somewhere that synopsys gives good
result if you use record type instead of double dimensional array.
please guide me what ia the problem with below code.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
use work.contr_pak.all;
ENTITY mux_mem IS
generic(addr_width: integer:=8;
data_width: integer :=24);
port(
clk : in std_logic;
reset : in std_logic;
w_addr : in std_logic_vector(addr_width-1 downto 0); --write
address (state bits)
r_addr : in std_logic_vector(addr_width-1 downto 0); -- read
address (state bits)
data_in : in std_logic_vector(data_width-1 downto 0); -- input
dara
data_out : out std_logic_vector(data_width-1 downto 0);
--output data ( input ctrl width
-- incl..no )
we : in std_logic;
re : in std_logic);
END ENTITY mux_mem;
--
ARCHITECTURE mux_mem_beh OF mux_mem Is
type mux_mw is record --mem width
temp : std_logic_vector( data_width-1 downto 0);
end record;
type mux_mem is array (addr_width-1 downto 0)of mux_mw; --mem size
--type mux_mem is array (addr_width-1 downto 0) of
std_logic_vector(data_width-1 downto 0);
signal ram1: mux_mem;
begin
process(clk,reset)
begin
if reset = '0' then
--w_addr <=(others=>'0');
--r_addr <=(others=>'0');
data_out <=(others=>'0');
elsif clk'event and clk='1' then
if re = '1' then
data_out <= ram1(conv_integer(r_addr));
-- data_out<= ram1(vect_to_int(r_addr));
else
data_out <= (others=>'0');
end if;
if we = '1' then
ram1(vect_to_int(w_addr)) <= data_in;
end if;
end if;
end process;
END ARCHITECTURE mux_mem_beh;
in my design iam trying to create my memory with record type. its shows
error(type error resolving index expression ) while doing simulation with
model sim.
why iam using like this is,i read somewhere that synopsys gives good
result if you use record type instead of double dimensional array.
please guide me what ia the problem with below code.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
use work.contr_pak.all;
ENTITY mux_mem IS
generic(addr_width: integer:=8;
data_width: integer :=24);
port(
clk : in std_logic;
reset : in std_logic;
w_addr : in std_logic_vector(addr_width-1 downto 0); --write
address (state bits)
r_addr : in std_logic_vector(addr_width-1 downto 0); -- read
address (state bits)
data_in : in std_logic_vector(data_width-1 downto 0); -- input
dara
data_out : out std_logic_vector(data_width-1 downto 0);
--output data ( input ctrl width
-- incl..no )
we : in std_logic;
re : in std_logic);
END ENTITY mux_mem;
--
ARCHITECTURE mux_mem_beh OF mux_mem Is
type mux_mw is record --mem width
temp : std_logic_vector( data_width-1 downto 0);
end record;
type mux_mem is array (addr_width-1 downto 0)of mux_mw; --mem size
--type mux_mem is array (addr_width-1 downto 0) of
std_logic_vector(data_width-1 downto 0);
signal ram1: mux_mem;
begin
process(clk,reset)
begin
if reset = '0' then
--w_addr <=(others=>'0');
--r_addr <=(others=>'0');
data_out <=(others=>'0');
elsif clk'event and clk='1' then
if re = '1' then
data_out <= ram1(conv_integer(r_addr));
-- data_out<= ram1(vect_to_int(r_addr));
else
data_out <= (others=>'0');
end if;
if we = '1' then
ram1(vect_to_int(w_addr)) <= data_in;
end if;
end if;
end process;
END ARCHITECTURE mux_mem_beh;