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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [rtl/] [lxp32_mul_dsp.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ring0_mipt
---------------------------------------------------------------------
2
-- DSP multiplier
3
--
4
-- Part of the LXP32 CPU
5
--
6
-- Copyright (c) 2016 by Alex I. Kuznetsov
7
--
8
-- This multiplier is designed for technologies that provide fast
9
-- 16x16 multipliers, including most modern FPGA families. One
10
-- multiplication takes 2 cycles.
11
---------------------------------------------------------------------
12
 
13
library ieee;
14
use ieee.std_logic_1164.all;
15
use ieee.numeric_std.all;
16
 
17
entity lxp32_mul_dsp is
18
        port(
19
                clk_i: in std_logic;
20
                rst_i: in std_logic;
21
                ce_i: in std_logic;
22
                op1_i: in std_logic_vector(31 downto 0);
23
                op2_i: in std_logic_vector(31 downto 0);
24
                ce_o: out std_logic;
25
                result_o: out std_logic_vector(31 downto 0)
26
        );
27
end entity;
28
 
29
architecture rtl of lxp32_mul_dsp is
30
 
31
signal pp00: unsigned(31 downto 0);
32
signal pp01: unsigned(31 downto 0);
33
signal pp10: unsigned(31 downto 0);
34
 
35
signal product: unsigned(31 downto 0);
36
 
37
signal ceo: std_logic:='0';
38
 
39
begin
40
 
41
mul00_inst: entity work.lxp32_mul16x16
42
        port map(
43
                clk_i=>clk_i,
44
                a_i=>op1_i(15 downto 0),
45
                b_i=>op2_i(15 downto 0),
46
                unsigned(p_o)=>pp00
47
        );
48
 
49
mul01_inst: entity work.lxp32_mul16x16
50
        port map(
51
                clk_i=>clk_i,
52
                a_i=>op1_i(15 downto 0),
53
                b_i=>op2_i(31 downto 16),
54
                unsigned(p_o)=>pp01
55
        );
56
 
57
mul10_inst: entity work.lxp32_mul16x16
58
        port map(
59
                clk_i=>clk_i,
60
                a_i=>op1_i(31 downto 16),
61
                b_i=>op2_i(15 downto 0),
62
                unsigned(p_o)=>pp10
63
        );
64
 
65
product(31 downto 16)<=pp00(31 downto 16)+pp01(15 downto 0)+pp10(15 downto 0);
66
product(15 downto 0)<=pp00(15 downto 0);
67
result_o<=std_logic_vector(product);
68
 
69
process (clk_i) is
70
begin
71
        if rising_edge(clk_i) then
72
                if rst_i='1' then
73
                        ceo<='0';
74
                else
75
                        ceo<=ce_i;
76
                end if;
77
        end if;
78
end process;
79
 
80
ce_o<=ceo;
81
 
82
end architecture;

powered by: WebSVN 2.1.0

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