Hi, I try to simple multiplication, but when i use dsp attribute then i got different result in simulation .what is the reason of this?
without dsp attribute - attribute use_dsp of sum : signal is "no";
with dsp attribute - attribute use_dsp of sum : signal is "yes";
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.types.all;
entity convolution2d is
port (
clk, rst : in std_logic;
start : in std_logic;
window : in frame9;
done : out std_logic;
pixel : out pixel8
);
end convolution2d;
architecture rtl of convolution2d is
constant mask : mask_9 := (-1, -1, -1, -1, 8, -1, -1, -1, -1);
signal sum : integer:=0;
attribute use_dsp : string;
attribute use_dsp of sum : signal is "yes";
begin
-- iterative way
process(clk) is
--variable tick : std_logic:='0';
begin
done<='0';
if rising_edge(clk) then
if start = '1' then
sum <= 0;
for n in 0 to 2 loop
for k in 0 to 2 loop
sum <= sum + (to_integer(unsigned(window(n*3 + k))) * mask(n*3 + k));
end loop;
end loop;
done<='1';
pixel <= std_logic_vector(to_unsigned(sum, 8));
end if;
end if;
end process;
end rtl;
Question
askhunter
Hi, I try to simple multiplication, but when i use dsp attribute then i got different result in simulation .what is the reason of this?
without dsp attribute - attribute use_dsp of sum : signal is "no";
with dsp attribute - attribute use_dsp of sum : signal is "yes";
"
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.