-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRamCacheInterface.vhd
208 lines (160 loc) · 4.24 KB
/
RamCacheInterface.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
Library ieee;
use ieee.std_logic_1164.all;
Entity RamCacheInterface is
Port(
clk: in std_logic;
rst: in std_logic;
Start: in std_logic;
conv: in std_logic;
size: in std_logic;
stride: in std_logic
);
end entity;
Architecture RamCacheInterfaceArch of RamCacheInterface is
--------------------COMPONETS--------------------------
COMPONENT Accelerator is
Port(
clk:in std_logic;
port1: in std_logic_vector(39 downto 0);
port2: in std_logic_vector(39 downto 0);
port3: in std_logic_vector(39 downto 0);
port4: in std_logic_vector(39 downto 0);
port5: in std_logic_vector(39 downto 0);
port6: in std_logic_vector(39 downto 0);
port7: in std_logic_vector(39 downto 0);
port8: in std_logic_vector(39 downto 0);
port9: in std_logic_vector(39 downto 0);
port10: in std_logic_vector(39 downto 0);
opFinished: out std_logic;
AcceleratorOutput: out std_logic_vector(7 downto 0);
AcceleratorWr :inout std_logic;
conv:in std_logic;
size: in std_logic;
enableOp: in std_logic
);
end COMPONENT;
COMPONENT ram IS
PORT(
clk : IN std_logic;
we : IN std_logic;
address : IN std_logic_vector(17 DOWNTO 0);
datain : IN std_logic_vector(7 DOWNTO 0);
dataout : OUT std_logic_vector(39 DOWNTO 0));
END COMPONENT;
COMPONENT cache2 is
port(
DataFromRam: in std_logic_vector(39 downto 0); --input from DMA
DataFromAccelerator: in std_logic_vector(7 downto 0); --input from accelerator
DataOut: out std_logic_vector(7 downto 0); --input TO DMA
port1:out std_logic_vector(39 downto 0);
port2:out std_logic_vector(39 downto 0);
port3:out std_logic_vector(39 downto 0);
port4:out std_logic_vector(39 downto 0);
port5:out std_logic_vector(39 downto 0);
port6:out std_logic_vector(39 downto 0);
port7:out std_logic_vector(39 downto 0);
port8:out std_logic_vector(39 downto 0);
port9:out std_logic_vector(39 downto 0);
port10:out std_logic_vector(39 downto 0);
cacheAddress:in std_logic_vector(3 downto 0);
rd:in std_logic;
wr: in std_logic;
rst:in std_logic;
clk:in std_logic
);
end COMPONENT;
---------------------SIGNALS----------------------------
Signal ramdataoutput: std_logic_vector(39 downto 0);
Signal cacheDataInput: std_logic_vector(39 downto 0);
Signal ramDataInput: std_logic_vector(7 downto 0);
Signal cacheDataOut: std_logic_vector(7 downto 0);
Signal ramAddress: std_logic_vector(17 downto 0);
Signal cacheAddress: std_logic_vector(3 downto 0);
Signal wrRam: std_logic;
Signal wrCache: std_logic;
Signal rdRam: std_logic;
Signal rdCache: std_logic;
Signal DMAWRcache:std_logic;
Signal oprENACC:std_logic;
Signal AccOutput: std_logic_vector(7 downto 0);
---------------------------------------------------------
Signal opFinished: std_logic; --Signal from accelerator to indicate that the operation
--has finished
Signal AcceleratorOutput: std_logic_vector(7 downto 0);
Signal AcceleratorWr : std_logic;
--ports to be connected to the accelerator
------------------------------------------
Signal port1: std_logic_vector(39 downto 0);
Signal port2: std_logic_vector(39 downto 0);
Signal port3: std_logic_vector(39 downto 0);
Signal port4: std_logic_vector(39 downto 0);
Signal port5: std_logic_vector(39 downto 0);
Signal port6: std_logic_vector(39 downto 0);
Signal port7: std_logic_vector(39 downto 0);
Signal port8: std_logic_vector(39 downto 0);
Signal port9: std_logic_vector(39 downto 0);
Signal port10: std_logic_vector(39 downto 0);
---------------------------------------------------------
begin
wrCache<= DMAWRcache or AcceleratorWr;
DMA: entity work.DMA port map(
start,
Conv,
Size,
ramdataoutput,
cacheDatainput,
cacheDataOut,
ramDataInput,
ramAddress,
CacheAddress,
wrRam,
DMAwrCache,
rdRam,
rdCache,
opfinished,
stride,
clk,
rst,
oprENACC
);
--Ram: entity work.Ram port map(clk,wrRam,ramAddress,ramDataInput,ramDataOutput);
myRam: Ram port map(clk,wrRam,ramAddress,ramDataInput,ramDataOutput);
myCache: cache2 port map(cacheDatainput,AcceleratorOutput,cacheDataOut,
port1,
port2,
port3,
port4,
port5,
port6,
port7,
port8,
port9,
port10,
cacheAddress,
rdCache,
WrCache,
rst,
clk
);
myACC: Accelerator Port map(
clk,
port1,
port2,
port3,
port4,
port5,
port6,
port7,
port8,
port9,
port10,
opFinished,
AcceleratorOutput,
AcceleratorWr ,
conv,
size,
oprENACC
);
--------------opFinishedACC
--------------AccWr :out std_logic; w out
end RamCacheInterfaceArch;