prashanthi999
Member level 1
- Joined
- Nov 19, 2014
- Messages
- 39
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 8
- Activity points
- 287
hai everyone im doing an array multiplication of 2 vector whose size is 8 bit , im getting error called index type which means not using similar type!! even though using same type for the vectors
how to deal it? there are 2 errors after counter process in my progrm.
how to deal it? there are 2 errors after counter process in my progrm.
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
entity dot_product is
port( a,b : in std_logic_vector (7 downto 0);
clk,reset : in std_logic;
result : out std_logic_vector (15 downto 0)
);
end dot_product;
architecture Behavioral of dot_product is
signal i : std_logic_vector(2 downto 0);
signal ai,bi :std_logic_vector (7 downto 0);
signal product,add_in,sum,accumulator :std_logic_vector(15 downto 0);
subtype sig8 is std_logic_vector (7 downto 0);
type sig8_vector is array ( natural range <>) of sig8;
begin
control : process
begin
wait until rising_edge(clk);
if reset ='1' then
i<= (others => '0');
else
i<=i+1;
end if;
end process;
a_mux : ai <= a( std_logic_vector (i));////error here
b_mux : bi <= b( std_logic_vector (i)); /// error here
multiply : product <=ai* bi;
zero_mux : add_in <=x"0000" when i = 0 else accumulator;
add : sum <=product +add_in;
accumulate : process
begin
wait until rising_edge(clk);
accumulator<= sum;
end process;
output : result<= accumulator;
end Behavioral;