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

Subversion Repositories the_wizardry_project

[/] [the_wizardry_project/] [trunk/] [Wizardry/] [VHDL/] [Wizardry Top Level/] [Address Generation/] [RDIC/] [Top_Level_MAC.vhd] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 mcwaccent
----------------------------------------------------------------------------------
2
--
3
--  This file is a part of Technica Corporation Wizardry Project
4
--
5
--  Copyright (C) 2004-2009, Technica Corporation  
6
--
7
--  This program is free software: you can redistribute it and/or modify
8
--  it under the terms of the GNU General Public License as published by
9
--  the Free Software Foundation, either version 3 of the License, or
10
--  (at your option) any later version.
11
--
12
--  This program is distributed in the hope that it will be useful,
13
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
--  GNU General Public License for more details.
16
--
17
--  You should have received a copy of the GNU General Public License
18
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
--
20
----------------------------------------------------------------------------------
21
----------------------------------------------------------------------------------
22
-- Module Name: Top_Level_MAC - Structural 
23
-- Project Name: Wizardry
24
-- Target Devices: Virtex 4 ML401
25
-- Description: Top-level structural description for Memory Access Controller (MAC).
26
-- Revision: 1.0
27
-- Additional Comments: 
28
--
29
----------------------------------------------------------------------------------
30
library IEEE;
31
use IEEE.STD_LOGIC_1164.ALL;
32
use IEEE.STD_LOGIC_ARITH.ALL;
33
use IEEE.STD_LOGIC_UNSIGNED.ALL;
34
use work.MAC_Constants.all;
35
 
36
---- Uncomment the following library declaration if instantiating
37
---- any Xilinx primitives in this code.
38
--library UNISIM;
39
--use UNISIM.VComponents.all;
40
 
41
entity Top_Level_MAC is
42
    Port ( clock : in  STD_LOGIC;
43
                          device_clock : in  STD_LOGIC;
44
           reset : in  STD_LOGIC;
45
           Memory_Access_in : in  Memory_Access_Port_in;
46
           Memory_Access_out : out  Memory_Access_Port_out;
47
                          MAC_in : in Preprocessor_Interface_Port_in;
48
                          MAC_out : out Preprocessor_Interface_Port_out
49
                          );
50
end Top_Level_MAC;
51
 
52
architecture Structural of Top_Level_MAC is
53
 
54
component Arbitration_Path is
55
    Port ( clock : in  STD_LOGIC;
56
           reset : in  STD_LOGIC;
57
                          FIFO_full : in  STD_LOGIC;
58
                          FIFO_empty : in std_logic;
59
                          read_request : in std_logic_vector(num_of_ports downto 0);
60
                          write_request : in std_logic_vector(num_of_ports downto 0);
61
--           Memory_Access_in : in  Memory_Access_Port_in;
62
                          priority_signals : in priority_type;
63
                          read_acknowledge : in std_logic_vector(num_of_ports downto 0);
64
                          read_enable_in : out  std_logic_vector(num_of_ports downto 0);
65
                          write_enable_in : out  std_logic_vector(num_of_ports downto 0)
66
                          );
67
end component;
68
 
69
component write_read_FIFO is
70
    Port ( clock : in  STD_LOGIC;
71
                     reset : in  STD_LOGIC;
72
                          DAT_I : in  v_data_i;
73
           SEL_I : in  v_sel_i;
74
           Read_Enable : in  STD_LOGIC;
75
           Write_Enable : in  std_logic_vector(num_of_ports downto 0);
76
                          decoded_write_address : in std_logic_vector(physical_address_width -1 downto 0);
77
                          decoded_read_address : in std_logic_vector(physical_address_width -1 downto 0);
78
           Acknowledge_in : in  STD_LOGIC;
79
           Write_data_out : out  std_logic_vector(data_width -1 downto 0);
80
           address_out : out  std_logic_vector(physical_address_width -1 downto 0);
81
           write_enable_out : out  STD_LOGIC;
82
           read_enable_out : out  STD_LOGIC;
83
           FIFO_empty : out  STD_LOGIC;
84
           FIFO_full : out  STD_LOGIC);
85
end component;
86
 
87
component write_address_decoder is
88
    Port (      clock : std_logic;
89
                                ports_in : memory_access_port_in;
90
                                write_enable_in : in  STD_LOGIC_VECTOR (num_of_ports -1 downto 0);
91
                                decoded_write_address : out  STD_LOGIC_VECTOR (physical_address_width -1 downto 0);
92
                                write_enable_out : out  STD_LOGIC_VECTOR (num_of_ports -1 downto 0));
93
end component;
94
 
95
signal read_enable_in_s, write_enable_in_s, write_enable_out_s,burst_write_enable_s,
96
                 read_request_s,write_request_s, acknowledge_s : std_logic_vector(num_of_ports downto 0);
97
signal read_enable_out_s,FIFO_full_s,FIFO_empty_s: std_logic;
98
signal decoded_read_address_out_s : std_logic_vector(physical_address_width -1 downto 0);
99
signal Decoded_write_address_out_s : std_logic_vector(physical_address_width -1 downto 0);
100
signal Read_Acknowledge_out_s,Read_Acknowledge_out_s_1,read_err_o_s,write_err_o_s,pop_burst_data_s : std_logic_vector(num_of_ports downto 0);
101
--signal Memory_Access_out_s : Memory_Access_Port_out;
102
signal burst_data_s : v_data_i;
103
signal burst_full_s, burst_empty_s,reset_buffer_s, acknowledge_read_data_s,reset_pop_count_s : std_logic_vector(num_of_ports downto 0);
104
signal address_vectors,burst_addresses_s : v_adr_i;
105
signal data_out_s : Data_out_Array;
106
signal pop_index_s, store_data_s : std_logic;
107
signal read_data_out_s,read_data_reg_s : std_logic_vector(data_width -1 downto 0);
108
signal read_index_s : integer range 0 to num_of_ports;
109
signal read_buffer_enable_s, pop_dummy_s, buffer_full_dummy_s, buffer_empty_dummy_s,pop_read_data_s : std_logic_vector(num_of_ports downto 0);
110
signal data_out_dummy_s : read_data_array;
111
 
112
component Address_Path is
113
    Port ( clock : in  STD_LOGIC;
114
           reset : in  STD_LOGIC;
115
           read_enable_in : in std_logic_vector(num_of_ports downto 0);
116
           write_enable_in : in std_logic_vector(num_of_ports downto 0);
117
           Memory_Access_in : in  Memory_Access_Port_in;
118
                          burst_addresses : in v_adr_i;
119
                          read_address : in v_adr_i;
120
                          acknowledge_read_data_in : in  STD_LOGIC;
121
                          read_index : out integer range 0 to num_of_ports;
122
                          read_err_o : out  STD_LOGIC_VECTOR (num_of_ports downto 0);
123
                          write_err_o : out  STD_LOGIC_VECTOR (num_of_ports downto 0);
124
           Decoded_write_address_out : out  std_logic_vector(physical_address_width -1 downto 0);
125
           Write_enable_out : out  STD_LOGIC_VECTOR (num_of_ports downto 0);
126
           Decoded_Read_address_out : out  std_logic_vector(physical_address_width -1 downto 0);
127
           read_enable_out : out  STD_LOGIC;
128
           Read_Acknowledge_out : out  STD_LOGIC_VECTOR(num_of_ports downto 0)
129
                          );
130
end component;
131
 
132
component burst_data_fetch is
133
    Port (      reset : in std_logic;
134
                                clock : in  STD_LOGIC;
135
                                buffer_empty : in  STD_LOGIC_VECTOR (num_of_ports downto 0);
136
                                write_enable_in : in  STD_LOGIC_VECTOR (num_of_ports downto 0);
137
                                pop_o : out  STD_LOGIC_VECTOR (num_of_ports downto 0);
138
                                burst_write_enable : out STD_LOGIC_VECTOR (num_of_ports downto 0);
139
                                reset_pop_count : out STD_LOGIC_VECTOR (num_of_ports downto 0)
140
                                );
141
end component;
142
 
143
component Burst_data_Buffer is
144
    Port (clock : in  STD_LOGIC;
145
                        device_clock : in  STD_LOGIC;
146
                        reset : in std_logic;
147
                        we_i : in std_logic;
148
                        data_in : in std_logic_vector(data_width -1 downto 0);
149
                        address_in : in std_logic_vector(virtual_address_width -1 downto 0);
150
                        data_out : out std_logic_vector((data_width + virtual_address_width)-1 downto 0);
151
                        read_address : out std_logic_vector(virtual_address_width -1 downto 0);
152
                        pop : in std_logic;
153
                        cyc_i : in std_logic;
154
                        stb_i : in std_logic;
155
                        lock_i : in std_logic;
156
                        read_err_i : in std_logic;
157
                        write_err_i : in std_logic;
158
                        err_o : out std_logic;
159
                        read_buffer_full : in std_logic;
160
                        read_serviced : in std_logic;
161
                        reset_pop_count_in : in std_logic;
162
                        read_acknowledge : in std_logic;
163
                        buffer_full : out std_logic;
164
                        buffer_empty : out std_logic;
165
                        write_enable_out : out std_logic;
166
                        read_enable_out : out std_logic;
167
                        acknowledge : out std_logic;
168
                        reset_buffer : out std_logic;
169
                        acknowledge_read_data : out std_logic
170
                        );
171
end component;
172
 
173
component burst_read_data_fetcher is
174
    Port ( clock : in  STD_LOGIC;
175
           reset : in  STD_LOGIC;
176
           acknowledge_read_data_in : in  STD_LOGIC;
177
           data_in : in  std_logic_vector(data_width -1 downto 0);
178
                          data_out : out std_logic_vector(data_width -1 downto 0);
179
           pop_index : out  STD_LOGIC;
180
                          store_data : out  STD_LOGIC
181
                          );
182
end component;
183
 
184
component read_data_buffer is
185
    Port ( clock : in  STD_LOGIC;
186
           reset : in  STD_LOGIC;
187
                          clear_buffer : in std_logic;
188
           push : in  STD_LOGIC;
189
           pop : in  STD_LOGIC;
190
           data_in : in  STD_LOGIC_VECTOR(data_width -1 downto 0);
191
           data_out : out  STD_LOGIC_VECTOR(data_width -1 downto 0);
192
                          buffer_full : out std_logic;
193
                          buffer_empty : out std_logic
194
                          );
195
end component;
196
 
197
begin
198
--process(Read_Acknowledge_out_s,Memory_Access_out_s)
199
--begin
200
----if clock='1' and clock'event then
201
--      for i in 0 to num_of_ports loop
202
--              if(Memory_Access_out_s.ack_o(i) = '1') then
203
--                      Memory_Access_out.ack_o(i) <= '1';
204
--              elsif(Read_Acknowledge_out_s(i) = '1') then
205
--                      Memory_Access_out.ack_o(i) <= '1';
206
--              else
207
--                      Memory_Access_out.ack_o(i) <= '0';
208
--              end if;
209
--      end loop;
210
----end if;
211
--end process;
212
 
213
--process(clock,read_err_o_s,write_err_o_s)
214
--begin
215
--if clock='1' and clock'event then
216
--      for i in 0 to num_of_ports loop
217
--              if(read_err_o_s(i) = '1') then
218
--                      Memory_Access_out.err_o(i) <= '1';
219
--              elsif(write_err_o_s(i) = '1') then
220
--                      Memory_Access_out.err_o(i) <= '1';
221
--              else
222
--                      Memory_Access_out.err_o(i) <= '0';
223
--              end if;
224
--      end loop;
225
--end if;
226
--end process;
227
 
228
register_read_data : process(clock,reset,MAC_in.Acknowledge_read_data_in)
229
begin
230
if(clock ='1' AND clock'event) then
231
        if(reset = '1') then
232
                read_data_reg_s <= (others => '0');
233
        elsif(MAC_in.Acknowledge_read_data_in = '1') then
234
                read_data_reg_s <= MAC_in.read_data_in;
235
        else
236
                read_data_reg_s <= read_data_reg_s;
237
        end if;
238
end if;
239
end process;
240
 
241
multiplex_read_data : process(clock,reset,read_index_s,store_data_s)
242
begin
243
if(clock ='1' AND clock'event) then  -- May not need to use clock enable for this signal
244
        if(store_data_s = '1') then
245
                read_buffer_enable_s(read_index_s) <= '1';
246
        else
247
                read_buffer_enable_s <= (others => '0');
248
        end if;
249
end if;
250
end process;
251
 
252
 
253
process(data_out_s)
254
begin
255
        for i in 0 to num_of_ports loop
256
                burst_data_s(i) <= data_out_s(i)(53 downto 22);
257
                burst_addresses_s(i) <= data_out_s(i)(21 downto 0);
258
        end loop;
259
--end if;
260
end process;
261
 
262
 
263
 
264
A0 : Address_Path
265
    Port Map( clock => clock,
266
           reset => reset,
267
           read_enable_in => read_enable_in_s,
268
           write_enable_in => write_enable_in_s,
269
           Memory_Access_in => Memory_Access_in,
270
                          burst_addresses => burst_addresses_s,
271
                          read_address => address_vectors,
272
                          acknowledge_read_data_in => pop_index_s,
273
                          read_index => read_index_s,
274
                          read_err_o => read_err_o_s,
275
                          write_err_o => write_err_o_s,
276
           Decoded_write_address_out => Decoded_write_address_out_s,
277
           Write_enable_out => write_enable_out_s,
278
           Decoded_Read_address_out => Decoded_Read_address_out_s,
279
           read_enable_out => read_enable_out_s,
280
           Read_Acknowledge_out => Read_Acknowledge_out_s
281
                          );
282
 
283
 
284
A1 : Arbitration_Path
285
    Port Map( clock => clock,
286
           reset => reset,
287
                          FIFO_full => FIFO_full_s,
288
                          FIFO_empty => FIFO_empty_s,
289
                          read_request => read_request_s,
290
                          write_request => write_request_s,
291
                          priority_signals => Memory_Access_in.priority_i,
292
                          read_acknowledge => Read_Acknowledge_out_s,
293
                          read_enable_in => read_enable_in_s,
294
                          write_enable_in => write_enable_in_s
295
                          );
296
 
297
 
298
A2 : write_read_FIFO
299
    Port MAP( clock => clock,
300
                     reset => reset,
301
                          DAT_I =>  burst_data_s,
302
           SEL_I => Memory_Access_in.sel_i,
303
           Read_Enable => read_enable_out_s,
304
           Write_Enable => burst_write_enable_s,
305
                          decoded_write_address => Decoded_write_address_out_s,
306
                          decoded_read_address => Decoded_Read_address_out_s,
307
           Acknowledge_in => MAC_in.ack_access_in,
308
           Write_data_out => MAC_out.Write_data_out,
309
           address_out => MAC_out.address_out,
310
           write_enable_out => MAC_out.write_enable_out,
311
           read_enable_out => MAC_out.read_enable_out,
312
           FIFO_empty => FIFO_empty_s,
313
           FIFO_full => FIFO_full_s
314
                          );
315
 
316
Burts_write_data_fetcher : burst_data_fetch
317
    Port Map(   reset => reset,
318
                                clock => clock,
319
                                buffer_empty => burst_empty_s,
320
                                write_enable_in => write_enable_out_s,
321
                                pop_o => pop_burst_data_s,
322
                                burst_write_enable => burst_write_enable_s,
323
                                reset_pop_count => reset_pop_count_s
324
                                );
325
 
326
Make_Buffers: for i in 0 to num_of_ports generate
327
begin
328
Buffer_FIFO : Burst_data_Buffer
329
    Port Map( clock => clock,
330
                                device_clock => device_clock,
331
                                reset => reset,
332
                                we_i => Memory_Access_in.we_i(i),
333
                                data_in => Memory_Access_in.dat_i(i),
334
                                address_in => Memory_Access_in.adr_i(i),
335
                                read_address => address_vectors(i),
336
                                pop => pop_burst_data_s(i),
337
                                data_out => data_out_s(i),
338
                                cyc_i => Memory_Access_in.cyc_i(i),
339
                                stb_i => Memory_Access_in.stb_i(i),
340
                                lock_i => Memory_Access_in.lock_i(i),
341
                                read_err_i => read_err_o_s(i),
342
                                write_err_i => write_err_o_s(i),
343
                                err_o => Memory_Access_out.err_o(i),
344
                                read_buffer_full => buffer_full_dummy_s(i),
345
                                read_serviced => read_enable_in_s(i),
346
                                reset_pop_count_in => reset_pop_count_s(i),
347
                                read_acknowledge => pop_burst_data_s(i),
348
                                buffer_full => burst_full_s(i),
349
                                buffer_empty => burst_empty_s(i),
350
                                write_enable_out => write_request_s(i),
351
                                read_enable_out => read_request_s(i),
352
                                reset_buffer => reset_buffer_s(i),
353
                                acknowledge => Read_Acknowledge_out_s_1(i),
354
                                acknowledge_read_data => acknowledge_read_data_s(i)
355
                        );
356
end generate;
357
 
358
read_data_fetcher : burst_read_data_fetcher
359
    Port Map( clock => clock,
360
           reset => reset,
361
           acknowledge_read_data_in => MAC_in.Acknowledge_read_data_in,
362
           data_in => MAC_in.Read_data_in,
363
                          data_out => read_data_out_s,
364
           pop_index => pop_index_s,
365
                          store_data => store_data_s
366
                          );
367
 
368
Make_Read_Buffers : for i in 0 to num_of_ports generate
369
begin
370
read_buffers : read_data_buffer
371
    Port Map( clock => clock,
372
           reset => reset,
373
                          clear_buffer => reset_buffer_s(i),
374
           push => read_buffer_enable_s(i),
375
           pop => pop_read_data_s(i),
376
--                        pop => acknowledge_read_data_s(i),
377
--                        pop => pop_read_data_s(i),
378
           data_in => read_data_reg_s,
379
           data_out => Memory_Access_Out.dat_o(i),
380
                          buffer_full => buffer_full_dummy_s(i),
381
                          buffer_empty => buffer_empty_dummy_s(i)
382
                          );
383
end generate;
384
 
385
 
386
MAC_out.FIFO_empty_out <= FIFO_empty_s;
387
Memory_Access_out.burst_full <= burst_full_s;
388
Memory_Access_out.burst_empty <= burst_empty_s;
389
 
390
process(Read_Acknowledge_out_s_1,buffer_full_dummy_s,clock,acknowledge_read_data_s)
391
begin
392
if(rising_Edge(clock)) then
393
        for i in 0 to (num_of_ports) loop
394
                if(acknowledge_read_data_s(i) = '1') then
395
                        Memory_Access_out.ack_o(i) <= '1';
396
                        pop_read_data_s(i) <= '1';
397
                elsif(Read_Acknowledge_out_s_1(i) = '1') then
398
                        Memory_Access_out.ack_o(i) <= '1';
399
                        pop_read_data_s(i) <= '0';
400
                else
401
                        Memory_Access_out.ack_o(i) <= '0';
402
                        pop_read_data_s(i) <= '0';
403
                end if;
404
        end loop;
405
end if;
406
end process;
407
 
408
end Structural;
409
 

powered by: WebSVN 2.1.0

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