Hello Folks,
Listed below is a simple NoBL SRAM model that I use to help me debug. Recently, I've been getting a ModelSim error numstd_conv_unsigned_nu Natural arg value is negative. I Googled this and found it to an issue with the to_unsigned function and the natural must be from the 'length attribute? I guess; don't know. please help.
Brad Smallridge AiVision
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity memory is
port( clk : in std_logic; mem_wr : in std_logic; -- active high memory write mem_addr : in std_logic_vector(17 downto 0); --18 bits 256K mem_wr_data : in std_logic_vector(35 downto 0); mem_rd_data : out std_logic_vector(35 downto 0) ); end memory;
architecture beh of memory is
signal mem_wr_1 : std_logic; signal mem_wr_2 : std_logic; signal mem_addr_1 : std_logic_vector(17 downto 0); signal mem_addr_2 : std_logic_vector(17 downto 0);
-- keep the size of the memory small here
-- to keep ModelSim simulation convenient constant size : integer := 127; type mem_array_type is array(0 to size) of integer; signal mem_array : mem_array_type; begin
memory_proc:process(clk) variable addr1 : integer; variable addr2 : integer; begin if(clk'event and clk='1')then mem_wr_1