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/] [ase_mesh1/] [1.0/] [vhd/] [ase_mesh1.vhd] - Blame information for rev 147

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : 2D mesh mk1 by ase
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : ase_mesh1.vhdl
6
-- Author     : Lasse Lehtonen (ase)
7
-- Company    : 
8
-- Created    : 2010-06-14
9 147 lanttu
-- Last update: 2012-06-14
10 145 lanttu
-- Platform   : 
11
-- Standard   : VHDL'93
12
-------------------------------------------------------------------------------
13
-- Description: Instantiate variable-sized network from rows*cols routers
14
-------------------------------------------------------------------------------
15
-- Copyright (c) 2010 
16
-------------------------------------------------------------------------------
17
-- Revisions  :
18
-- Date        Version  Author  Description
19
-- 2010-06-14  1.0      ase     Created
20
-------------------------------------------------------------------------------
21
 
22
library ieee;
23
use ieee.std_logic_1164.all;
24
 
25
entity ase_mesh1 is
26
 
27
  generic (
28 147 lanttu
    n_rows_g    : positive := 4;        -- Number of rows
29
    n_cols_g    : positive := 4;        -- Number of columns
30 145 lanttu
    cmd_width_g : positive := 2;        -- Width of the cmd line in bits
31 147 lanttu
    bus_width_g : positive := 32;       -- Width of the data bus in bits
32
    fifo_depth_g : natural := 4
33 145 lanttu
    );
34
  port (
35 147 lanttu
    clk   : in std_logic;
36
    rst_n : in std_logic;
37 145 lanttu
 
38
    data_in   : in  std_logic_vector(n_rows_g*n_cols_g*bus_width_g-1 downto 0);
39
    cmd_in    : in  std_logic_vector(n_rows_g*n_cols_g*cmd_width_g-1 downto 0);
40
    stall_out : out std_logic_vector(n_rows_g*n_cols_g-1 downto 0);
41
 
42 147 lanttu
    data_out : out std_logic_vector(n_rows_g*n_cols_g*bus_width_g-1 downto 0);
43
    cmd_out  : out std_logic_vector(n_rows_g*n_cols_g*cmd_width_g-1 downto 0);
44
    stall_in : in  std_logic_vector(n_rows_g*n_cols_g-1 downto 0));
45
 
46 145 lanttu
end entity ase_mesh1;
47
 
48
 
49
architecture structural of ase_mesh1 is
50
 
51
  -- row data
52 147 lanttu
  -- All signals named as <source><destination>name,
53 145 lanttu
  -- e.g. sn_data means "data going from south to north"
54 147 lanttu
  type r_data_type is array (0 to n_rows_g*2-1) of
55 145 lanttu
    std_logic_vector(n_cols_g*bus_width_g-1 downto 0);
56 147 lanttu
  type r_cmd_type is array (0 to n_rows_g*2-1) of
57
    std_logic_vector(2*n_cols_g-1 downto 0);
58
  type r_bit_type is array (0 to n_rows_g*2-1) of
59 145 lanttu
    std_logic_vector(n_cols_g-1 downto 0);
60
 
61
  signal sn_data  : r_data_type;
62 147 lanttu
  signal sn_cmd   : r_cmd_type;
63 145 lanttu
  signal sn_stall : r_bit_type;
64
 
65
  signal ns_data  : r_data_type;
66 147 lanttu
  signal ns_cmd   : r_cmd_type;
67 145 lanttu
  signal ns_stall : r_bit_type;
68
 
69
  -- col data
70 147 lanttu
  type c_data_type is array (0 to n_cols_g*2-1) of
71 145 lanttu
    std_logic_vector(n_rows_g*bus_width_g-1 downto 0);
72 147 lanttu
  type c_cmd_type is array (0 to n_cols_g*2-1) of
73
    std_logic_vector(2*n_rows_g-1 downto 0);
74
  type c_bit_type is array (0 to n_cols_g*2-1) of
75 145 lanttu
    std_logic_vector(n_rows_g-1 downto 0);
76
 
77
  signal ew_data  : c_data_type;
78 147 lanttu
  signal ew_cmd   : c_cmd_type;
79 145 lanttu
  signal ew_stall : c_bit_type;
80
 
81
  signal we_data  : c_data_type;
82 147 lanttu
  signal we_cmd   : c_cmd_type;
83 145 lanttu
  signal we_stall : c_bit_type;
84
 
85
 
86
begin  -- architecture structural
87
 
88
  -- De-activate the signals "coming from outside"
89 147 lanttu
  ns_data(0)             <= (others => '0');
90
  ns_cmd(0)              <= (others => '0');
91
  ns_stall(n_rows_g*2-1) <= (others => '0');
92 145 lanttu
 
93 147 lanttu
  we_data(0)             <= (others => '0');
94
  we_cmd(0)              <= (others => '0');
95
  we_stall(n_cols_g*2-1) <= (others => '0');
96 145 lanttu
 
97 147 lanttu
  sn_data(n_rows_g*2-1) <= (others => '0');
98
  sn_cmd(n_rows_g*2-1)  <= (others => '0');
99
  sn_stall(0)           <= (others => '0');
100 145 lanttu
 
101 147 lanttu
  ew_data(n_cols_g*2-1) <= (others => '0');
102
  ew_cmd(n_cols_g*2-1)  <= (others => '0');
103
  ew_stall(0)           <= (others => '0');
104 145 lanttu
 
105
 
106
  -- Instantiate rows*cols routers
107
  row : for r in 0 to n_rows_g-1 generate
108
    col : for c in 0 to n_cols_g-1 generate
109
 
110 147 lanttu
 
111
      col_fifo : if r < n_rows_g-1 generate
112
        ns_link_fifo : entity work.link_fifo
113
          generic map (
114
            cmd_width_g  => cmd_width_g,
115
            data_width_g => bus_width_g,
116
            depth_g      => fifo_depth_g)
117
          port map (
118
            clk       => clk,
119
            rst_n     => rst_n,
120
            cmd_in    => ns_cmd(r*2+1)(c*2+1 downto c*2),
121
            data_in   => ns_data(r*2+1)((c+1)*bus_width_g-1 downto c*bus_width_g),
122
            stall_out => ns_stall(r*2+1)(c),
123
            cmd_out   => ns_cmd((r+1)*2)(c*2+1 downto c*2),
124
            data_out  => ns_data((r+1)*2)((c+1)*bus_width_g-1 downto c*bus_width_g),
125
            stall_in  => ns_stall((r+1)*2)(c));
126
        sn_link_fifo : entity work.link_fifo
127
          generic map (
128
            cmd_width_g  => cmd_width_g,
129
            data_width_g => bus_width_g,
130
            depth_g      => fifo_depth_g)
131
          port map (
132
            clk       => clk,
133
            rst_n     => rst_n,
134
            cmd_in    => sn_cmd((r+1)*2)(c*2+1 downto c*2),
135
            data_in   => sn_data((r+1)*2)((c+1)*bus_width_g-1 downto c*bus_width_g),
136
            stall_out => sn_stall((r+1)*2)(c),
137
            cmd_out   => sn_cmd((r)*2+1)(c*2+1 downto c*2),
138
            data_out  => sn_data((r)*2+1)((c+1)*bus_width_g-1 downto c*bus_width_g),
139
            stall_in  => sn_stall((r)*2+1)(c));
140
      end generate col_fifo;
141
 
142
      row_fifo : if c < n_cols_g-1 generate
143
        we_link_fifo : entity work.link_fifo
144
          generic map (
145
            cmd_width_g  => cmd_width_g,
146
            data_width_g => bus_width_g,
147
            depth_g      => fifo_depth_g)
148
          port map (
149
            clk       => clk,
150
            rst_n     => rst_n,
151
            cmd_in    => we_cmd(c*2+1)(r*2+1 downto r*2),
152
            data_in   => we_data(c*2+1)((r+1)*bus_width_g-1 downto r*bus_width_g),
153
            stall_out => we_stall(c*2+1)(r),
154
            cmd_out   => we_cmd((c+1)*2)(r*2+1 downto r*2),
155
            data_out  => we_data((c+1)*2)((r+1)*bus_width_g-1 downto r*bus_width_g),
156
            stall_in  => we_stall((c+1)*2)(r));
157
        ew_link_fifo : entity work.link_fifo
158
          generic map (
159
            cmd_width_g  => cmd_width_g,
160
            data_width_g => bus_width_g,
161
            depth_g      => fifo_depth_g)
162
          port map (
163
            clk       => clk,
164
            rst_n     => rst_n,
165
            cmd_in    => ew_cmd((c+1)*2)(r*2+1 downto r*2),
166
            data_in   => ew_data((c+1)*2)((r+1)*bus_width_g-1 downto r*bus_width_g),
167
            stall_out => ew_stall((c+1)*2)(r),
168
            cmd_out   => ew_cmd((c)*2+1)(r*2+1 downto r*2),
169
            data_out  => ew_data((c)*2+1)((r+1)*bus_width_g-1 downto r*bus_width_g),
170
            stall_in  => ew_stall((c)*2+1)(r));
171
      end generate row_fifo;
172
 
173 145 lanttu
      i_router : entity work.ase_mesh1_router(rtl)
174
        generic map (
175
          n_rows_g    => n_rows_g,
176
          n_cols_g    => n_cols_g,
177
          bus_width_g => bus_width_g)
178
        port map (
179
          clk   => clk,
180
          rst_n => rst_n,
181
 
182
          a_data_in   => data_in(((r*n_cols_g)+c+1)*bus_width_g-1 downto
183
                                 ((r*n_cols_g)+c)*bus_width_g),
184
          a_da_in     => cmd_in(2*((r*n_cols_g)+c)+1),
185
          a_av_in     => cmd_in(2*((r*n_cols_g)+c)),
186
          a_stall_out => stall_out((r*n_cols_g)+c),
187
          a_data_out  => data_out(((r*n_cols_g)+c+1)*bus_width_g-1 downto
188
                                  ((r*n_cols_g)+c)*bus_width_g),
189
          a_da_out    => cmd_out(2*((r*n_cols_g)+c)+1),
190
          a_av_out    => cmd_out(2*((r*n_cols_g)+c)),
191
          a_stall_in  => stall_in((r*n_cols_g)+c),
192
 
193 147 lanttu
          n_data_in   => ns_data(r*2)((c+1)*bus_width_g-1 downto c*bus_width_g),
194
          n_da_in     => ns_cmd(r*2)(c*2),
195
          n_av_in     => ns_cmd(r*2)(c*2+1),
196
          n_stall_out => ns_stall(r*2)(c),
197
          n_data_out  => sn_data(r*2)((c+1)*bus_width_g-1 downto c*bus_width_g),
198
          n_da_out    => sn_cmd(r*2)(c*2),
199
          n_av_out    => sn_cmd(r*2)(c*2+1),
200
          n_stall_in  => sn_stall(r*2)(c),
201 145 lanttu
 
202 147 lanttu
          e_data_in   => ew_data(c*2+1)((r+1)*bus_width_g-1 downto r*bus_width_g),
203
          e_da_in     => ew_cmd(c*2+1)(r*2),
204
          e_av_in     => ew_cmd(c*2+1)(r*2+1),
205
          e_stall_out => ew_stall(c*2+1)(r),
206
          e_data_out  => we_data(c*2+1)((r+1)*bus_width_g-1 downto r*bus_width_g),
207
          e_da_out    => we_cmd(c*2+1)(r*2),
208
          e_av_out    => we_cmd(c*2+1)(r*2+1),
209
          e_stall_in  => we_stall(c*2+1)(r),
210 145 lanttu
 
211 147 lanttu
          s_data_in   => sn_data(r*2+1)((c+1)*bus_width_g-1 downto c*bus_width_g),
212
          s_da_in     => sn_cmd(r*2+1)(c*2),
213
          s_av_in     => sn_cmd(r*2+1)(c*2+1),
214
          s_stall_out => sn_stall(r*2+1)(c),
215
          s_data_out  => ns_data(r*2+1)((c+1)*bus_width_g-1 downto c*bus_width_g),
216
          s_da_out    => ns_cmd(r*2+1)(c*2),
217
          s_av_out    => ns_cmd(r*2+1)(c*2+1),
218
          s_stall_in  => ns_stall(r*2+1)(c),
219 145 lanttu
 
220 147 lanttu
          w_data_in   => we_data(c*2)((r+1)*bus_width_g-1 downto r*bus_width_g),
221
          w_da_in     => we_cmd(c*2)(r*2),
222
          w_av_in     => we_cmd(c*2)(r*2+1),
223
          w_stall_out => we_stall(c*2)(r),
224
          w_data_out  => ew_data(c*2)((r+1)*bus_width_g-1 downto r*bus_width_g),
225
          w_da_out    => ew_cmd(c*2)(r*2),
226
          w_av_out    => ew_cmd(c*2)(r*2+1),
227
          w_stall_in  => ew_stall(c*2)(r));
228 145 lanttu
 
229
    end generate col;
230
  end generate row;
231
 
232
 
233
 
234
end architecture structural;

powered by: WebSVN 2.1.0

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