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 145

Go to most recent revision | 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
-- Last update: 2011-12-02
10
-- 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
    n_rows_g    : positive := 4;        -- Nuber of rows
29
    n_cols_g    : positive := 4;        -- Nuber of columns
30
    cmd_width_g : positive := 2;        -- Width of the cmd line in bits
31
    bus_width_g : positive := 32        -- Width of the data bus in bits
32
    );
33
  port (
34
    clk       : in  std_logic;
35
    rst_n     : in  std_logic;
36
 
37
    data_in   : in  std_logic_vector(n_rows_g*n_cols_g*bus_width_g-1 downto 0);
38
    cmd_in    : in  std_logic_vector(n_rows_g*n_cols_g*cmd_width_g-1 downto 0);
39
    stall_out : out std_logic_vector(n_rows_g*n_cols_g-1 downto 0);
40
 
41
    data_out  : out std_logic_vector(n_rows_g*n_cols_g*bus_width_g-1 downto 0);
42
    cmd_out   : out std_logic_vector(n_rows_g*n_cols_g*cmd_width_g-1 downto 0);
43
    stall_in  : in  std_logic_vector(n_rows_g*n_cols_g-1 downto 0));
44
 
45
end entity ase_mesh1;
46
 
47
 
48
architecture structural of ase_mesh1 is
49
 
50
  -- row data
51
  -- All signals amed as <source><destination>name,
52
  -- e.g. sn_data means "data going from south to north"
53
  type r_data_type is array (0 to n_rows_g) of
54
    std_logic_vector(n_cols_g*bus_width_g-1 downto 0);
55
  type r_bit_type is array (0 to n_rows_g) of
56
    std_logic_vector(n_cols_g-1 downto 0);
57
 
58
  signal sn_data  : r_data_type;
59
  signal sn_av    : r_bit_type;
60
  signal sn_da    : r_bit_type;
61
  signal sn_stall : r_bit_type;
62
 
63
  signal ns_data  : r_data_type;
64
  signal ns_av    : r_bit_type;
65
  signal ns_da    : r_bit_type;
66
  signal ns_stall : r_bit_type;
67
 
68
  -- col data
69
  type c_data_type is array (0 to n_cols_g) of
70
    std_logic_vector(n_rows_g*bus_width_g-1 downto 0);
71
  type c_bit_type is array (0 to n_cols_g) of
72
    std_logic_vector(n_rows_g-1 downto 0);
73
 
74
  signal ew_data  : c_data_type;
75
  signal ew_av    : c_bit_type;
76
  signal ew_da    : c_bit_type;
77
  signal ew_stall : c_bit_type;
78
 
79
  signal we_data  : c_data_type;
80
  signal we_av    : c_bit_type;
81
  signal we_da    : c_bit_type;
82
  signal we_stall : c_bit_type;
83
 
84
 
85
begin  -- architecture structural
86
 
87
  -- De-activate the signals "coming from outside"
88
  ns_data(0)         <= (others => '0');
89
  ns_av(0)           <= (others => '0');
90
  ns_da(0)           <= (others => '0');
91
  ns_stall(n_rows_g) <= (others => '0');
92
 
93
  we_data(0)         <= (others => '0');
94
  we_av(0)           <= (others => '0');
95
  we_da(0)           <= (others => '0');
96
  we_stall(n_cols_g) <= (others => '0');
97
 
98
  sn_data(n_rows_g) <= (others => '0');
99
  sn_av(n_rows_g)   <= (others => '0');
100
  sn_da(n_rows_g)   <= (others => '0');
101
  sn_stall(0)       <= (others => '0');
102
 
103
  ew_data(n_cols_g) <= (others => '0');
104
  ew_av(n_cols_g)   <= (others => '0');
105
  ew_da(n_cols_g)   <= (others => '0');
106
  ew_stall(0)       <= (others => '0');
107
 
108
 
109
  -- Instantiate rows*cols routers
110
  row : for r in 0 to n_rows_g-1 generate
111
    col : for c in 0 to n_cols_g-1 generate
112
 
113
      i_router : entity work.ase_mesh1_router(rtl)
114
        generic map (
115
          n_rows_g    => n_rows_g,
116
          n_cols_g    => n_cols_g,
117
          bus_width_g => bus_width_g)
118
        port map (
119
          clk   => clk,
120
          rst_n => rst_n,
121
 
122
          a_data_in   => data_in(((r*n_cols_g)+c+1)*bus_width_g-1 downto
123
                                 ((r*n_cols_g)+c)*bus_width_g),
124
          a_da_in     => cmd_in(2*((r*n_cols_g)+c)+1),
125
          a_av_in     => cmd_in(2*((r*n_cols_g)+c)),
126
          a_stall_out => stall_out((r*n_cols_g)+c),
127
          a_data_out  => data_out(((r*n_cols_g)+c+1)*bus_width_g-1 downto
128
                                  ((r*n_cols_g)+c)*bus_width_g),
129
          a_da_out    => cmd_out(2*((r*n_cols_g)+c)+1),
130
          a_av_out    => cmd_out(2*((r*n_cols_g)+c)),
131
          a_stall_in  => stall_in((r*n_cols_g)+c),
132
 
133
          n_data_in   => ns_data(r)((c+1)*bus_width_g-1 downto c*bus_width_g),
134
          n_da_in     => ns_da(r)(c),
135
          n_av_in     => ns_av(r)(c),
136
          n_stall_out => ns_stall(r)(c),
137
          n_data_out  => sn_data(r)((c+1)*bus_width_g-1 downto c*bus_width_g),
138
          n_da_out    => sn_da(r)(c),
139
          n_av_out    => sn_av(r)(c),
140
          n_stall_in  => sn_stall(r)(c),
141
 
142
          e_data_in   => ew_data(c+1)((r+1)*bus_width_g-1 downto r*bus_width_g),
143
          e_da_in     => ew_da(c+1)(r),
144
          e_av_in     => ew_av(c+1)(r),
145
          e_stall_out => ew_stall(c+1)(r),
146
          e_data_out  => we_data(c+1)((r+1)*bus_width_g-1 downto r*bus_width_g),
147
          e_da_out    => we_da(c+1)(r),
148
          e_av_out    => we_av(c+1)(r),
149
          e_stall_in  => we_stall(c+1)(r),
150
 
151
          s_data_in   => sn_data(r+1)((c+1)*bus_width_g-1 downto c*bus_width_g),
152
          s_da_in     => sn_da(r+1)(c),
153
          s_av_in     => sn_av(r+1)(c),
154
          s_stall_out => sn_stall(r+1)(c),
155
          s_data_out  => ns_data(r+1)((c+1)*bus_width_g-1 downto c*bus_width_g),
156
          s_da_out    => ns_da(r+1)(c),
157
          s_av_out    => ns_av(r+1)(c),
158
          s_stall_in  => ns_stall(r+1)(c),
159
 
160
          w_data_in   => we_data(c)((r+1)*bus_width_g-1 downto r*bus_width_g),
161
          w_da_in     => we_da(c)(r),
162
          w_av_in     => we_av(c)(r),
163
          w_stall_out => we_stall(c)(r),
164
          w_data_out  => ew_data(c)((r+1)*bus_width_g-1 downto r*bus_width_g),
165
          w_da_out    => ew_da(c)(r),
166
          w_av_out    => ew_av(c)(r),
167
          w_stall_in  => ew_stall(c)(r));
168
 
169
    end generate col;
170
  end generate row;
171
 
172
 
173
 
174
end architecture structural;

powered by: WebSVN 2.1.0

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