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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [vhdl/] [WISHBONE_FFT/] [comp_mult.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
--Since both the real and imaginary values       have the same number of  fractio nal bits, 
2
--  there is no need to   truncate. 
3
 
4
library  IEEE;
5
use IEEE.std_logic_1164.all;
6
use ieee.std_logic_arith.all;
7
 
8
entity comp_mult is
9
 
10
generic (   inst_width1 : INTEGER := 14;
11
      inst_width2 : INTEGER := 14
12
        );
13
 
14
port  ( Re1  : in std_logic_vector(inst_width1-1 downto 0);
15
        Im1  : in std_logic_vector(inst_width1-1 downto 0);
16
        Re2  : in std_logic_vector(inst_width2-1 downto 0);
17
        Im2  : in std_logic_vector(inst_width2-1 downto 0);
18
        Re   : out std_logic_vector(inst_width1 + inst_width2 downto 0);
19
         Im    : out std_logic_vector(inst_width1 + inst_width2 downto 0)
20
 
21
);
22
end comp_mult;
23
 
24
architecture behavior of  comp_mult is
25
--multiplier outputs 
26
signal product1 :std_logic_vector(inst_width1+inst_width2-1 downto 0);--re1*re2 
27
signal product2 :std_logic_vector(inst_width1+inst_width2-1 downto 0);--i m1*im2 
28
signal product3 :std_logic_vector(inst_width1+inst_width2-1 downto 0);
29
signal product4 :std_logic_vector(inst_width1+inst_width2-1 downto 0);
30
 
31
 
32
 
33
component adder
34
 generic (inst_width:integer);
35
        port (
36
              inst_A : in std_logic_vector(inst_width-1 downto 0);
37
               inst_B : in std_logic_vector(inst_width-1 downto 0);
38
                SUM : out std_logic_vector(inst_width downto 0)
39
              );
40
 
41
end component;
42
 
43
 
44
component subtract
45
 generic (inst_width:integer);
46
         port (
47
             inst_A : in std_logic_vector(inst_width-1 downto 0);
48
              inst_B : in std_logic_vector(inst_width-1 downto 0);
49
         DIFF : out std_logic_vector(inst_width downto 0)
50
             );
51
end component;
52
 
53
component multiplier
54
 generic (inst_width1:integer ;
55
  inst_width2:integer
56
  );
57
         port (
58
              inst_A : in std_logic_vector(inst_width1-1 downto 0);
59
              inst_B : in  std_logic_vector(inst_width2-1 downto 0);
60
              PRODUCT_inst  : out
61
std_logic_vector(inst_width1+inst_width2-1 downto 0)
62
             );
63
end component;
64
 
65
 
66
begin
67
 
68
        U1 : multiplier
69
       generic map( inst_width1=>           inst_width1,
70
inst_width2=>inst_width2)
71
             port map ( inst_A => Re1, inst_B => Re2, PRODUCT_inst =>
72
product1 );
73
 
74
        U2 : multiplier
75
         generic map( inst_width1=>inst_width1,
76
inst_width2=>inst_width2)
77
            port map ( inst_A => Im1, inst_B => Im2, PRODUCT_inst =>
78
product2 );
79
 
80
        U3 : multiplier
81
      generic map( inst_width1=>inst_width1,
82
inst_width2=>inst_width2)
83
        port map( inst_A => Re1, inst_B => Im2, PRODUCT_inst =>product3 );
84
 
85
         U4 : multiplier
86
      generic map( inst_width1=>inst_width2, inst_width2=>inst_width1)
87
              port map ( inst_A => Re2, inst_B => Im1, PRODUCT_inst =>product4);
88
 
89
     U5 : subtract
90
       generic map (               inst_width=>inst_width1+inst_width2)
91
             port  map(inst_A => product1, inst_B => product2, DIFF => Re );
92
 
93
        U6 : adder
94
                  generic map ( inst_width=>inst_width1+inst_width2)
95
              port map ( inst_A => product3, inst_B => product4, SUM =>Im );
96
 
97
end;

powered by: WebSVN 2.1.0

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