I am new to VHDL programming. The project regards detecting faults in a memory array. I have obtained the faulty data and address. Now I want to get the corresponding row or column number of the particular address found in memory array. Code for achieving this in VHDL would be appreciated! Here is my simple code for creating SRAM and performing read and write operation:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity memory is
port( Clock : in std_logic;
Write : in std_logic;
Read : in std_logic;
-- Addr : in std_logic_vector(7 downto 0);
Data_in : in std_logic_vector(7 downto 0);
Data_out: out std_logic_vector(7 downto 0);
Data_out_f: out std_logic_vector(7 downto 0);
add_out : out std_logic_vector(7 downto 0)
);
end memory;
architecture behav of memory is
--Declaration of type and signal of a 256 element RAM
--with each element being 8 bit wide.
type ram_type is array (0 to 255) of std_logic_vector(7 downto 0);
signal tmp_ram: ram_type:=(others=>"00000000");
signal Addr : std_logic_vector(7 downto 0):="00000000";
begin
process(Clock,addr,Write,read)
begin
if (Clock'event and Clock='1') then
if addr <"00001111" and write='1' and Data_in(7)/='U' then
addr <= addr + '1';
elsif addr >"00000000" and read='1' then
addr <= addr - '1';
end if;
end if;
end process;
-- Write Functional Section
process(Clock,Write,Addr)
begin
if Write='1' then
tmp_ram(conv_integer(Addr)) <= Data_in;
end if;
end process;
process(Clock,Read,Addr)
begin
if Read='1' then
Data_out <= tmp_ram(conv_integer(Addr));
end if;
end process;
end behav;