-
Notifications
You must be signed in to change notification settings - Fork 0
/
datapath.vhd
139 lines (117 loc) · 5.12 KB
/
datapath.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.user_pkg.all;
-- NOTES ON PARAMETERIZATION
-- first and last stage is always the same
-- middle stages come in pairs of two
-- ex: if we want a 16 point fft, we need 2^n = 4 stages
-- this is the trivial case
-- for higher point ffts, we might want to generate the internal pipeline
-- recursively, and then connect it to the first and last stage
-- this will greatly simplify the logic of the for generate required
-- we might not want to split up the stages so much,
-- having the middle 2 stages as their own component would be preferred I think
entity datapath is
generic (
num_internal_stage_pairs : positive := 1;
width : positive := 32);
port (
clk : in std_logic;
rst : in std_logic;
en : in std_logic;
input_valid : in std_logic;
output_valid : out std_logic;
r0_input, r1_input, r2_input, r3_input : in std_logic_vector(width - 1 downto 0);
i0_input, i1_input, i2_input, i3_input : in std_logic_vector(width - 1 downto 0);
r0_output, r1_output, r2_output, r3_output : out std_logic_vector(width - 1 downto 0);
i0_output, i1_output, i2_output, i3_output : out std_logic_vector(width - 1 downto 0));
end datapath;
architecture STR of datapath is
signal first_stage_r0_output, first_stage_r1_output, first_stage_r2_output, first_stage_r3_output : std_logic_vector(width - 1 downto 0);
signal first_stage_i0_output, first_stage_i1_output, first_stage_i2_output, first_stage_i3_output : std_logic_vector(width - 1 downto 0);
signal first_stage_output_valid : std_logic;
signal inner_stage_r0_output, inner_stage_r1_output, inner_stage_r2_output, inner_stage_r3_output : std_logic_vector(width - 1 downto 0);
signal inner_stage_i0_output, inner_stage_i1_output, inner_stage_i2_output, inner_stage_i3_output : std_logic_vector(width - 1 downto 0);
signal inner_stage_output_valid : std_logic;
begin
first_stage : entity work.first_stage
generic map(
width => DATA_WIDTH
)
port map(
clk => clk,
rst => rst,
en => en,
input_valid => input_valid,
output_valid => first_stage_output_valid,
r0_input => r0_input,
r1_input => r1_input,
r2_input => r2_input,
r3_input => r3_input,
i0_input => i0_input,
i1_input => i1_input,
i2_input => i2_input,
i3_input => i3_input,
r0_output => first_stage_r0_output,
r1_output => first_stage_r1_output,
r2_output => first_stage_r2_output,
r3_output => first_stage_r3_output,
i0_output => first_stage_i0_output,
i1_output => first_stage_i1_output,
i2_output => first_stage_i2_output,
i3_output => first_stage_i3_output);
inner_stage : entity work.inner_stage
generic map(
num_stage_pairs => num_internal_stage_pairs,
width => DATA_WIDTH
)
port map(
clk => clk,
rst => rst,
en => en,
input_valid => first_stage_output_valid,
output_valid => inner_stage_output_valid,
r0_input => first_stage_r0_output,
r1_input => first_stage_r1_output,
r2_input => first_stage_r2_output,
r3_input => first_stage_r3_output,
i0_input => first_stage_i0_output,
i1_input => first_stage_i1_output,
i2_input => first_stage_i2_output,
i3_input => first_stage_i3_output,
r0_output => inner_stage_r0_output,
r1_output => inner_stage_r1_output,
r2_output => inner_stage_r2_output,
r3_output => inner_stage_r3_output,
i0_output => inner_stage_i0_output,
i1_output => inner_stage_i1_output,
i2_output => inner_stage_i2_output,
i3_output => inner_stage_i3_output);
last_stage : entity work.last_stage
generic map(
width => DATA_WIDTH
)
port map(
clk => clk,
rst => rst,
en => en,
input_valid => inner_stage_output_valid,
output_valid => output_valid,
r0_input => inner_stage_r0_output,
r1_input => inner_stage_r1_output,
r2_input => inner_stage_r2_output,
r3_input => inner_stage_r3_output,
i0_input => inner_stage_i0_output,
i1_input => inner_stage_i1_output,
i2_input => inner_stage_i2_output,
i3_input => inner_stage_i3_output,
r0_output => r0_output,
r1_output => r1_output,
r2_output => r2_output,
r3_output => r3_output,
i0_output => i0_output,
i1_output => i1_output,
i2_output => i2_output,
i3_output => i3_output);
end STR;