Serwan Bamerni
Member level 2
hello everyone
I wrote the following code but I get a wrong output and a huge warnings
I suppose that the output should be at first data in
wmae = 1
and
wmbe = 0
but it was opposite
and
write_add_a_ind = 00000000
but it will be = 00000001
also
write_add_b_ind will be 00000001
while it should be not changed
please can any one help me with this errors
I wrote the following code but I get a wrong output and a huge warnings
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity memory_controller is
Port ( data_in : in STD_LOGIC_VECTOR (7 downto 0);
read_add : out STD_LOGIC_VECTOR (7 downto 0);
write_add_a_ind : out STD_LOGIC_VECTOR (7 downto 0);
write_add_b_ind : out STD_LOGIC_VECTOR (7 downto 0);
write_add_c_ind : out STD_LOGIC_VECTOR (7 downto 0);
write_add_d_ind : out STD_LOGIC_VECTOR (7 downto 0);
data_out : out STD_LOGIC_VECTOR (7 downto 0);
wmae : out STD_LOGIC;
wmbe : out STD_LOGIC;
wmce : out STD_LOGIC;
wmde : out STD_LOGIC);
end memory_controller;
architecture Behavioral of memory_controller is
SIGNAL mem_sel: STD_LOGIC := '0';
SIGNAL gro_sel: STD_LOGIC := '0';
SIGNAL write_mem_a_count: STD_LOGIC_VECTOR (7 downto 0):= (others => '0');
SIGNAL write_mem_b_count: STD_LOGIC_VECTOR (7 downto 0):= (others => '0');
SIGNAL write_mem_c_count: STD_LOGIC_VECTOR (7 downto 0):= (others => '0');
SIGNAL write_mem_d_count: STD_LOGIC_VECTOR (7 downto 0):= (others => '0');
SIGNAL mem_group_count: STD_LOGIC_VECTOR (8 downto 0):= (others => '0');
SIGNAL read_ind: STD_LOGIC_VECTOR (7 downto 0):= (others => '0');
begin
data_out <= data_in;
write_add_a_ind <= write_mem_a_count;
write_add_b_ind <= write_mem_b_count;
write_add_c_ind <= write_mem_c_count;
write_add_d_ind <= write_mem_d_count;
mem_con: PROCESS (data_in)
VARIABLE ci: STD_LOGIC_VECTOR (1 downto 0);
begin
ci := gro_sel & mem_sel;
CASE ci IS
WHEN "00" =>
wmae <= '1';
wmbe <= '0';
wmce <= '0';
wmde <= '0';
write_mem_a_count <= std_logic_vector(unsigned(write_mem_a_count) + 1 );
WHEN "01" =>
wmae <= '0';
wmbe <= '1';
wmce <= '0';
wmde <= '0';
write_mem_b_count <= std_logic_vector(unsigned(write_mem_b_count) + 1 );
WHEN "10" =>
wmae <= '0';
wmbe <= '0';
wmce <= '1';
wmde <= '0';
write_mem_c_count <= std_logic_vector(unsigned(write_mem_c_count) + 1 );
WHEN OTHERS =>
wmae <= '0';
wmbe <= '0';
wmce <= '0';
wmde <= '1';
write_mem_d_count <= std_logic_vector(unsigned(write_mem_d_count) + 1 );
END CASE;
mem_sel <= not(mem_sel);
mem_group_count <= std_logic_vector(unsigned(mem_group_count) + 1 );
if (mem_group_count(8) = '0') then
gro_sel <= '0';
else
gro_sel <= '1';
end if;
if (mem_group_count(8) = '1') then
read_add <= read_ind;
read_ind <= std_logic_vector(unsigned(read_ind) + 1 );
else
null;
end if;
end process mem_con;
end Behavioral;
I suppose that the output should be at first data in
wmae = 1
and
wmbe = 0
but it was opposite
and
write_add_a_ind = 00000000
but it will be = 00000001
also
write_add_b_ind will be 00000001
while it should be not changed
please can any one help me with this errors