OpenCores
URL https://opencores.org/ocsvn/highload/highload/trunk

Subversion Repositories highload

[/] [highload/] [trunk/] [dsp_use.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alexadmin
-- High load test project.
2
-- Alexey Fedorov, 2014
3
-- email: FPGA@nerudo.com
4
--
5
-- It implements 7 multipliers
6
 
7
library ieee;
8
use ieee.std_logic_1164.all;
9
use ieee.numeric_std.all;
10
 
11
entity dsp_use is
12
        generic (
13
                DATA_WIDTH  : positive := 16
14
                );
15
        port
16
        (
17
                clk     : in  std_logic;
18
                datain: in std_logic_vector(DATA_WIDTH-1 downto 0);
19
                dataout: out std_logic_vector(DATA_WIDTH-1 downto 0)
20
        );
21
end dsp_use;
22
 
23
architecture rtl of dsp_use is
24
type TShReg is array (0 to 7) of signed(DATA_WIDTH-1 downto 0);
25
signal ShReg_1, ShReg_1r, ShReg_2, ShReg_2r, ShReg_2rr, ShReg_3, ShReg_3r, ShReg_3rr, ShReg_4 : TShReg := (others => (others => '0'));
26
begin
27
 
28
process(clk)
29
variable product : signed(2*DATA_WIDTH-1 downto 0);
30
begin
31
        if rising_edge(clk) then
32
                ShReg_1(0) <= signed(datain);
33
                ShReg_1(1 to 7) <= ShReg_1(0 to 6);
34
 
35
                ShReg_1r  <= ShReg_1;
36
 
37
                for i in 0 to 3 loop
38
                        product := ShReg_1r(2*i) * ShReg_1r(2*i+1);
39
                        ShReg_2(i) <= product(DATA_WIDTH-1 downto 0);
40
                end loop;
41
 
42
                ShReg_2r  <= ShReg_2;
43
                ShReg_2rr <= ShReg_2r;
44
 
45
                for i in 0 to 1 loop
46
                        product := ShReg_2rr(2*i) * ShReg_2rr(2*i+1);
47
                        ShReg_3(i) <= product(DATA_WIDTH-1 downto 0);
48
                end loop;
49
 
50
                ShReg_3r <= ShReg_3;
51
                ShReg_3rr <= ShReg_3r;
52
 
53
                product := ShReg_3rr(0) * ShReg_3rr(1);
54
                ShReg_4(0) <= product(DATA_WIDTH-1 downto 0);
55
 
56
                dataout <= std_logic_vector(ShReg_4(0));
57
        end if;
58
 
59
end process;
60
 
61
end rtl;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.