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

Subversion Repositories wdsp

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
 
2
--Twiddle multiplier 
3
--7/17/02  
4
--Uses a both inputs same width complex multiplier 
5
--Won't sign extend output, but will truncate it down 
6
--(mult_width + twiddle_width >= output_width) 
7
-- 
8
--Twiddle factors are limited to -1 < twdl < 1. 
9
--(twiddle factor can't be 0b1000000000) 
10
 
11
library IEEE;
12
use IEEE.std_logic_1164.all;
13
 
14
entity twiddle_mult is
15
 
16
generic (
17
    mult_width : INTEGER := 7;
18
    twiddle_width : INTEGER :=3;
19
        output_width : INTEGER :=9
20
        );
21
 
22
port    (   data_r :in std_logic_vector(mult_width-1 downto 0);
23
                     data_i :in std_logic_vector(mult_width-1 downto 0);
24
   twdl_r :in std_logic_vector(twiddle_width-1 downto 0);
25
   twdl_i :in std_logic_vector(twiddle_width-1 downto 0);
26
                     out_r :out std_logic_vector(output_width-1 downto 0);
27
 
28
      out_i :out std_logic_vector(output_width-1 downto 0)
29
  );
30
 
31
end twiddle_mult;
32
 
33
architecture behavior of  twiddle_mult is
34
signal  mult_out_r : std_logic_vector(twiddle_width + mult_width downto 0);
35
signal mult_out_i : std_logic_vector(twiddle_width + mult_width downto 0);
36
 
37
component comp_mult
38
 generic ( inst_width1:integer;
39
   inst_width2:integer );
40
  port  ( Re1  : in std_logic_vector(inst_width1-1 downto 0);
41
          Im1        : in std_logic_vector(inst_width1-1 downto 0);
42
          Re2  :        in std_logic_vector(inst_width2-1 downto 0);
43
          Im2  : in std_logic_vector(inst_width2-1 downto 0);
44
          Re   : out std_logic_vector(inst_width1 + inst_width2
45
downto 0);
46
          Im   : out std_logic_vector(inst_width1 + inst_width2
47
downto 0)
48
 
49
  ) ;
50
 
51
end component;
52
 
53
begin
54
 
55
  U1 : comp_mult
56
 generic map(
57
    inst_width1 => mult_width, inst_width2 => twiddle_width)
58
  port map (Re1=>data_r, Im1=>data_i, Re2=>twdl_r, Im2=>twdl_i,
59
Re=>mult_out_r, Im=>mult_out_i);
60
 
61
 process(mult_out_r,mult_out_i)
62
  begin
63
       out_r <= mult_out_r((twiddle_width+mult_width-1) downto (twiddle_width+mult_width-output_width));
64
       out_i <= mult_out_i((twiddle_width+mult_width-1) downto (twiddle_width+mult_width-output_width));
65
 
66
  end process;
67
end;

powered by: WebSVN 2.1.0

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