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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.communication/] [packet_codec/] [1.0/] [vhd/] [addr_lut_pkg.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
3
--
4
-- This source file may be used and distributed without
5
-- restriction provided that this copyright statement is not
6
-- removed from the file and that any derivative work contains
7
-- the original copyright notice and the associated disclaimer.
8
--
9
-- This source file is free software; you can redistribute it
10
-- and/or modify it under the terms of the GNU Lesser General
11
-- Public License as published by the Free Software Foundation;
12
-- either version 2.1 of the License, or (at your option) any
13
-- later version.
14
--
15
-- This source is distributed in the hope that it will be
16
-- useful, but WITHOUT ANY WARRANTY; without even the implied
17
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18
-- PURPOSE.  See the GNU Lesser General Public License for more
19
-- details.
20
--
21
-- You should have received a copy of the GNU Lesser General
22
-- Public License along with this source; if not, download it
23
-- from http://www.opencores.org/lgpl.shtml
24
-------------------------------------------------------------------------------
25
 
26
library ieee;
27
use ieee.std_logic_1164.all;
28
use ieee.numeric_std.all;
29
use ieee.std_logic_arith.all;
30
use ieee.std_logic_unsigned.all;
31
 
32
--use work.txt_util.all;
33
 
34
-------------------------------------------------------------------------------
35
package addr_lut_pkg is
36
-------------------------------------------------------------------------------
37
 
38
 
39
-- Number of net types
40
  constant n_net_types_c : integer := 4;
41
 
42
  constant addr_w_c     : integer := 36;
43
  constant out_addr_w_c : integer := 36;
44
 
45
  type addr_rec is record
46
    in_addr : std_logic_vector(addr_w_c-1 downto 0);
47
    mask    : std_logic_vector(addr_w_c-1 downto 0);
48
  end record;
49
 
50
  constant n_addr_ranges_c : integer := 17;
51
 
52
  type address_array is array (0 to n_addr_ranges_c-1) of addr_rec;
53
 
54
  type number_record is record
55
    x : integer;
56
    y : integer;
57
    z : integer;
58
  end record;
59
 
60
  type number_array is array (0 to n_net_types_c-1, 0 to n_addr_ranges_c-1) of number_record;
61
 
62
  type res_addr_array is array (0 to n_addr_ranges_c-1) of std_logic_vector(out_addr_w_c-1 downto 0);
63
 
64
  -- Function for initializing address table
65
  -- nodes have at most three coordinates (x,y,z)
66
  -- that are translated differently according to net_type.
67
  -- All nets do not have 3 coordinates, e.g. 2D-mesh has only 2
68
  function gen_result_addresses (
69
    constant numb_arr : number_array;
70
    constant net_type : integer range 0 to n_net_types_c-1)
71
    return res_addr_array;
72
 
73
  function get_num (
74
    constant addr     : std_logic_vector(addr_w_c-1 downto 0);
75
    constant net_type : integer)
76
    return number_record;
77
 
78
 
79
  -- Input addresses: received addr is compared against this table.
80
  constant addr_table_c : address_array :=
81
    (
82
      (x"00b000100", x"0ffffff00"),
83
      (x"00b000300", x"0ffffff00"),
84
      (x"00b000500", x"0ffffff00"),
85
      (x"00b000700", x"0ffffff00"),
86
      (x"00b000900", x"0ffffff00"),
87
      (x"00b000b00", x"0ffffff00"),
88
      (x"00b000d00", x"0ffffff00"),
89
      (x"00b000f00", x"0ffffff00"),
90
      (x"00b001100", x"0ffffff00"),
91
      (x"00b001300", x"0ffffff00"),
92
      (x"00bfffe00", x"0fffffe00"),
93
      (x"109000000", x"1ff000000"),
94
      (x"009000000", x"1ff000000"),
95
      (x"00bfedd00", x"0ffffff00"),
96
      (x"00bfedf00", x"0ffffff00"),
97
      (x"00bfefd00", x"0ffffff00"),
98
      (x"00bfeff00", x"0ffffff00")
99
      );
100
 
101
 
102
  constant num_table_c : number_array :=
103
    (
104
      (                                 -- HIBI (useless, reserved)
105
        (0, -1, -1),                     --MASTER     
106
        (1, -1, -1),                     --Slave1
107
        (2, -1, -1),                     --Slave2
108
        (3, -1, -1),                     --Slave3
109
        (4, -1, -1),                     --Slave4
110
        (5, -1, -1),                     --Slave5
111
        (6, -1, -1),                     --Slave6
112
        (7, -1, -1),                     --Slave7
113
        (8, -1, -1),                     --Slave8
114
        (9, -1, -1),                     --Slave9
115
        (10, -1, -1),                     --SDRAM_msg
116
        (11, -1, -1),                     --SDRAM_data
117
        (12, -1, -1),                     --RTM
118
        (13, -1, -1),                     --ME 2
119
        (14, -1, -1),                     --ME 1
120
        (15, -1, -1),                     --dctQidct 2
121
        (16, -1, -1)                      --dctQidct 1      
122
        ),
123
      (                                 -- MESH:      
124
        (0, 0, -1),                     --MASTER     
125
        (1, 0, -1),                     --Slave1
126
        (2, 0, -1),                     --Slave2
127
        (3, 0, -1),                     --Slave3
128
        (0, 1, -1),                     --Slave4
129
        (1, 1, -1),                     --Slave5
130
        (2, 1, -1),                     --Slave6
131
        (3, 1, -1),                     --Slave7
132
        (0, 2, -1),                     --Slave8
133
        (1, 2, -1),                     --Slave9
134
        (2, 2, -1),                     --SDRAM_msg
135
        (3, 2, -1),                     --SDRAM_data
136
        (0, 3, -1),                     --RTM
137
        (1, 3, -1),                     --ME 2
138
        (2, 3, -1),                     --ME 1
139
        (3, 3, -1),                     --dctQidct 2
140
        (0, 4, -1)                      --dctQidct 1      
141
        ),
142
      (                                 -- Octagon:
143
        (0, 0, 0),                      --MASTER     
144
        (0, 0, 0),                      --Slave1
145
        (0, 0, 0),                      --Slave2
146
        (0, 0, 0),                      --Slave3
147
        (0, 0, 0),                      --Slave4
148
        (0, 0, 0),                      --Slave5
149
        (0, 0, 0),                      --Slave6
150
        (0, 0, 0),                      --Slave7
151
        (0, 0, 0),                      --Slave8
152
        (0, 0, 0),                      --Slave9
153
        (0, 0, 0),                      --RTM
154
        (0, 0, 0),                      --SDRAM_msg
155
        (0, 0, 0),                      --SDRAM_data
156
        (0, 0, 0),                      --ME 2
157
        (0, 0, 0),                      --ME 1
158
        (0, 0, 0),                      --dctQidct 2
159
        (0, 0, 0)                       --dctQidct 1 
160
        ),
161
      (                                 -- Crossbar:
162
        (0, 0, 0),                      --MASTER     
163
        (0, 0, 1),                      --Slave1
164
        (0, 0, 2),                      --Slave2
165
        (0, 0, 3),                      --Slave3
166
        (0, 0, 4),                      --Slave4
167
        (0, 0, 5),                      --Slave5
168
        (0, 0, 6),                      --Slave6
169
        (0, 0, 7),                      --Slave7
170
        (0, 0, 8),                      --Slave8
171
        (0, 0, 9),                      --Slave9
172
        (0, 0, 10),                     --RTM
173
        (0, 0, 11),                     --SDRAM_msg
174
        (0, 0, 12),                     --SDRAM_data
175
        (0, 0, 13),                     --ME 2
176
        (0, 0, 14),                     --ME 1
177
        (0, 0, 15),                     --dctQidct 2
178
        (0, 0, 16)                      --dctQidct 1 
179
        )
180
      );
181
 
182
end addr_lut_pkg;
183
 
184
-------------------------------------------------------------------------------
185
package body addr_lut_pkg is
186
-------------------------------------------------------------------------------
187
 
188
  function gen_result_addresses (
189
    constant numb_arr : number_array;
190
    constant net_type : integer range 0 to n_net_types_c-1)
191
    return res_addr_array is
192
    variable x, y, z : integer;
193
    variable results : res_addr_array;
194
  begin  -- gen_addr
195
 
196
    for i in 0 to n_addr_ranges_c-1 loop
197
 
198
      x := numb_arr(net_type, i).x;
199
      y := numb_arr(net_type, i).y;
200
      z := numb_arr(net_type, i).z;
201
 
202
      case net_type is
203
 
204
        when 0 =>
205
          assert false report "HIBI NOT IN USE" severity failure;
206
 
207
        when 1 =>                       -- MESH: Uses X and Y
208
          assert out_addr_w_c mod 2 = 0 report "out_addr_w_c must be even" severity failure;
209
          results(i) := conv_std_logic_vector(x + y*(2**(out_addr_w_c/2)), out_addr_w_c);
210
 
211
        when 2 =>
212
          results(i) := conv_std_logic_vector(x+y+z, out_addr_w_c);
213
 
214
        when 3 =>
215
          results(i) := conv_std_logic_vector(z, out_addr_w_c);
216
 
217
      end case;
218
    end loop;  -- i
219
    return results;
220
  end gen_result_addresses;
221
 
222
  -----------------------------------------------------------------------------
223
 
224
  function get_num (
225
    constant addr     : std_logic_vector(addr_w_c-1 downto 0);
226
    constant net_type : integer
227
    )
228
    return number_record is
229
  --  variable addr_v  : std_logic_vector(addr_w_c-1 downto 0);
230
    variable numbers : number_record;
231
 
232
  begin  -- get_num
233
 
234
    numbers.x := -1;
235
    numbers.y := -1;
236
    numbers.z := -1;
237
 
238
--    addr_v := conv_std_logic_vector(addr, addr_w_c);
239
 
240
    for i in 0 to n_addr_ranges_c-1 loop
241
      if (addr and addr_table_c(i).mask) = addr_table_c(i).in_addr then
242
 
243
        numbers := num_table_c(net_type, i);
244
 
245
      end if;
246
 
247
    end loop;  -- i
248
 
249
--    assert numbers.x /= -1 or numbers.y /= -1 or numbers.z /= -1
250
--      report "Mesh address did not map correctly (" & hstr(addr) & ")"
251
--      severity failure;
252
 
253
    return numbers;
254
  end get_num;
255
 
256
 
257
end addr_lut_pkg;

powered by: WebSVN 2.1.0

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