juansiahaan
Junior Member level 2
Hello everyone,
I'm trying to implement a simple RAM (for the SP601 evaluation kit) that will store a 12-bit data. I've seen many sample codes from XST user guide such as this one
From that code, is it possible that an input is stored/written in a selected/defined address so that I only have to access that address if I want to read that data?
Also, does anyone know how to test that RAM code (with testbench, maybe)?
Regards,
Juan
I'm trying to implement a simple RAM (for the SP601 evaluation kit) that will store a 12-bit data. I've seen many sample codes from XST user guide such as this one
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity RAM_src is PORT (CLK : in std_logic; en : in std_logic; we : in std_logic; addr : in std_logic_vector (5 downto 0); d_in : in std_logic_vector (11 downto 0); d_out : out std_logic_vector (11 downto 0) ); end RAM_src; architecture Behavioral of RAM_src is type ram_type is array (63 downto 0) of std_logic_vector (11 downto 0); signal RAM : ram_type; signal read_a : std_logic_vector (5 downto 0); begin d_out <= RAM(conv_integer(read_a)); memory: process (CLK) begin if rising_edge (CLK) then if en = '1' then -- enable if we = '1' then -- write enable RAM(conv_integer(addr)) <= d_in; read_a <= addr; end if; end if; end if; end process memory; end Behavioral;
From that code, is it possible that an input is stored/written in a selected/defined address so that I only have to access that address if I want to read that data?
Also, does anyone know how to test that RAM code (with testbench, maybe)?
Regards,
Juan