-
Notifications
You must be signed in to change notification settings - Fork 0
/
butterfly.vhd
80 lines (64 loc) · 2.36 KB
/
butterfly.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity butterfly is
generic (
width : positive := 16);
port (
clk : in std_logic;
rst : in std_logic;
en : in std_logic;
input_0_real : in std_logic_vector(width - 1 downto 0);
input_0_img : in std_logic_vector(width - 1 downto 0);
input_1_real : in std_logic_vector(width - 1 downto 0);
input_1_img : in std_logic_vector(width - 1 downto 0);
output_0_real : out std_logic_vector(width - 1 downto 0);
output_0_img : out std_logic_vector(width - 1 downto 0);
output_1_real : out std_logic_vector(width - 1 downto 0);
output_1_img : out std_logic_vector(width - 1 downto 0));
end butterfly;
architecture STR of butterfly is
signal reg_0_real, reg_0_img, reg_1_real, reg_1_img : std_logic_vector(width - 1 downto 0);
signal add2_r2_in, add2_i2_in : std_logic_vector(width - 1 downto 0);
begin
reg0 : entity work.complex_reg
generic map(width => width)
port map(
clk => clk,
rst => rst,
en => en,
input_real => input_0_real,
input_img => input_0_img,
output_real => reg_0_real,
output_img => reg_0_img);
reg1 : entity work.complex_reg
generic map(width => width)
port map(
clk => clk,
rst => rst,
en => en,
input_real => input_1_real,
input_img => input_1_img,
output_real => reg_1_real,
output_img => reg_1_img);
add1 : entity work.complex_add
generic map(width => width)
port map(
r1_in => reg_0_real,
i1_in => reg_0_img,
r2_in => reg_1_real,
i2_in => reg_1_img,
r_out => output_0_real,
i_out => output_0_img);
add2_r2_in <= std_logic_vector(resize(-1 * signed(reg_1_real), width));
add2_i2_in <= std_logic_vector(resize(-1 * signed(reg_1_img), width));
add2 : entity work.complex_add
generic map(width => width)
port map(
r1_in => reg_0_real,
i1_in => reg_0_img,
r2_in => add2_r2_in,
i2_in => add2_i2_in,
r_out => output_1_real,
i_out => output_1_img);
end STR;