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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : Packet Codec MK2
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : pkt_codec_mk2.vhd
6
-- Author     : Lasse Lehtonen
7
-- Company    : 
8
-- Created    : 2011-01-12
9 147 lanttu
-- Last update: 2012-06-14
10 145 lanttu
-- Platform   : 
11
-- Standard   : VHDL'93
12
-------------------------------------------------------------------------------
13
-- Description: Helps connecting IPs to network-on-chip
14
-- 
15
-- Contains 4 sub-blocks: clk domain crossing (cdc) and 3 units for handling
16
-- the addresses.
17
-- 
18
-- Generics
19
-- 
20
-- address_mode_g 0 : IP gives raw network address
21
-- address_mode_g 1 : IP gives integer ID numbers as target address
22
-- address_mode_g 2 : IP gives memory mapped addresses
23
--
24
-- clock_mode_g 0 : Use one clock for both ip and the net
25
--                  (clk_ip must be same as clk_net)
26
-- clock_mode_g 1 : Use two asynchronous clocks
27
--
28
-- noc_type_g 0 : ase_noc
29
-- noc_type_g 1 : ase_mesh1
30 147 lanttu
-- noc_type_g 2 : ase_dring1
31
-- noc_type_g 3 : fh_mesh_2d
32 145 lanttu
--
33
-------------------------------------------------------------------------------
34
-- Copyright (c) 2011 
35
-------------------------------------------------------------------------------
36
-- Revisions  :
37
-- Date        Version  Author  Description
38
-- 2011-01-12  1.0      ase     Created
39
-------------------------------------------------------------------------------
40
 
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44
use ieee.numeric_std.all;
45
 
46
use work.ase_noc_pkg.all;
47
use work.ase_mesh1_pkg.all;
48
 
49
entity pkt_codec_mk2 is
50 147 lanttu
 
51 145 lanttu
  generic (
52
    my_id_g        : natural;
53
    data_width_g   : positive;          -- in bits
54
    cmd_width_g    : positive;          -- in bits
55
    agents_g       : positive;          -- total num of agents
56
    cols_g         : positive;          -- noc size in x dimension
57
    rows_g         : positive;          -- noc size in y dimension
58
    agent_ports_g  : positive;
59
    addr_flit_en_g : natural;           -- put addr from IP to 2nd flit of pkt?
60
    address_mode_g : natural;           -- 3 choices: 0-2
61 147 lanttu
    clock_mode_g   : natural;  -- 0: synchr, 1= clk_ip differs from clk_net
62 145 lanttu
    rip_addr_g     : natural;           -- remove noc addr at the receiver?
63 147 lanttu
    noc_type_g     : natural;
64
    len_width_g    : natural := 8;      -- 2012-05-04
65
    fifo_depth_g   : natural := 4
66 145 lanttu
    );
67
  port (
68
    clk_ip  : in std_logic;
69
    clk_net : in std_logic;
70
    rst_n   : in std_logic;
71
 
72
    -- IP read interface 
73
    ip_cmd_out  : out std_logic_vector(cmd_width_g-1 downto 0);
74
    ip_data_out : out std_logic_vector(data_width_g-1 downto 0);
75
    ip_stall_in : in  std_logic;
76
 
77
    -- IP write interface
78
    ip_cmd_in    : in  std_logic_vector(cmd_width_g-1 downto 0);
79
    ip_data_in   : in  std_logic_vector(data_width_g-1 downto 0);
80
    ip_stall_out : out std_logic;
81
 
82 147 lanttu
    ip_len_in : in std_logic_vector(len_width_g-1 downto 0);  -- 2012-05-04
83
 
84 145 lanttu
    -- NoC write interface
85
    net_cmd_out  : out std_logic_vector(cmd_width_g-1 downto 0);
86
    net_data_out : out std_logic_vector(data_width_g-1 downto 0);
87
    net_stall_in : in  std_logic;
88
 
89
    -- NoC read interface
90
    net_cmd_in    : in  std_logic_vector(cmd_width_g-1 downto 0);
91
    net_data_in   : in  std_logic_vector(data_width_g-1 downto 0);
92
    net_stall_out : out std_logic
93
    );
94
 
95
end entity pkt_codec_mk2;
96
 
97
 
98
 
99
architecture structural of pkt_codec_mk2 is
100
 
101
  -----------------------------------------------------------------------------
102
  -- SIGNALS
103
  -----------------------------------------------------------------------------
104
 
105
  -- from ip to net path
106
  -- cdc -> at
107
  signal net_cmd_from_cdc  : std_logic_vector(cmd_width_g-1 downto 0);
108
  signal net_data_from_cdc : std_logic_vector(data_width_g-1 downto 0);
109
  signal net_stall_to_cdc  : std_logic;
110 147 lanttu
  -- 2012-05-04
111
  signal net_len_from_cdc  : std_logic_vector(len_width_g-1 downto 0);
112 145 lanttu
  -- at -> ag
113
  signal net_cmd_from_at   : std_logic_vector(cmd_width_g-1 downto 0);
114
  signal net_data_from_at  : std_logic_vector(data_width_g-1 downto 0);
115
  signal net_stall_to_at   : std_logic;
116
  signal orig_addr_from_at : std_logic_vector(data_width_g-1 downto 0);
117
 
118
  -- from net to ip path
119
  -- ar -> cdc
120
  signal ip_cmd_from_ar  : std_logic_vector(cmd_width_g-1 downto 0);
121
  signal ip_data_from_ar : std_logic_vector(data_width_g-1 downto 0);
122
  signal ip_stall_to_ar  : std_logic;
123
 
124 147 lanttu
 
125 145 lanttu
-------------------------------------------------------------------------------
126
begin  -- architecture structural
127
-------------------------------------------------------------------------------
128
 
129 147 lanttu
 
130 145 lanttu
  -----------------------------------------------------------------------------
131
  -- CLOCK DOMAIN CROSSING (cdc) at both ends (sender + receiver)
132
  -----------------------------------------------------------------------------
133
 
134 147 lanttu
 
135 145 lanttu
  cdc_1 : entity work.cdc
136
    generic map (
137
      cmd_width_g  => cmd_width_g,
138
      data_width_g => data_width_g,
139 147 lanttu
      clock_mode_g => clock_mode_g,
140
      len_width_g  => len_width_g,
141
      fifo_depth_g => fifo_depth_g
142 145 lanttu
      )
143
    port map (
144 147 lanttu
      clk_ip  => clk_ip,
145
      clk_net => clk_net,
146
      rst_n   => rst_n,
147 145 lanttu
 
148 147 lanttu
      ip_cmd_out  => ip_cmd_out,
149
      ip_data_out => ip_data_out,
150
      ip_stall_in => ip_stall_in,
151 145 lanttu
 
152 147 lanttu
      ip_cmd_in    => ip_cmd_in,
153
      ip_data_in   => ip_data_in,
154
      ip_stall_out => ip_stall_out,
155 145 lanttu
 
156 147 lanttu
      ip_len_in => ip_len_in,           -- 2012-05-04
157 145 lanttu
 
158 147 lanttu
      net_cmd_out  => net_cmd_from_cdc,
159
      net_data_out => net_data_from_cdc,
160
      net_stall_in => net_stall_to_cdc,
161
 
162
      net_len_out => net_len_from_cdc,  -- 2012-05-04
163
 
164 145 lanttu
      net_cmd_in    => ip_cmd_from_ar,
165
      net_data_in   => ip_data_from_ar,
166
      net_stall_out => ip_stall_to_ar);
167
 
168
  -----------------------------------------------------------------------------
169
  -- ADDRESS TRANSLATION (only at sender side, i.e. from IP to NET)
170
  -----------------------------------------------------------------------------
171
 
172
  addr_translation_1 : entity work.addr_translation
173
    generic map (
174
      my_id_g        => my_id_g,
175
      cmd_width_g    => cmd_width_g,
176
      data_width_g   => data_width_g,
177
      address_mode_g => address_mode_g,
178
      cols_g         => cols_g,
179
      rows_g         => rows_g,
180
      agents_g       => agents_g,
181
      agent_ports_g  => agent_ports_g,
182
      addr_flit_en_g => addr_flit_en_g,
183 147 lanttu
      noc_type_g     => noc_type_g,
184
      len_width_g    => len_width_g
185 145 lanttu
      )
186
    port map (
187 147 lanttu
      clk   => clk_net,
188
      rst_n => rst_n,
189 145 lanttu
 
190 147 lanttu
      ip_cmd_in    => net_cmd_from_cdc,
191
      ip_data_in   => net_data_from_cdc,
192
      ip_stall_out => net_stall_to_cdc,
193
      ip_len_in    => net_len_from_cdc,  -- 2012-05-04
194 145 lanttu
 
195
      net_cmd_out   => net_cmd_from_at,
196
      net_data_out  => net_data_from_at,
197
      net_stall_in  => net_stall_to_at,
198
      orig_addr_out => orig_addr_from_at
199
      );
200
 
201
 
202
  -----------------------------------------------------------------------------
203
  -- ADDRESS GENERATOR  (only at sender side, i.e. from IP to NET)
204
  -----------------------------------------------------------------------------
205
  addr_gen_1 : entity work.addr_gen
206
    generic map (
207
      cmd_width_g    => cmd_width_g,
208
      data_width_g   => data_width_g,
209 147 lanttu
      addr_flit_en_g => addr_flit_en_g,
210
      noc_type_g     => noc_type_g
211 145 lanttu
      )
212
    port map (
213 147 lanttu
      clk   => clk_net,
214
      rst_n => rst_n,
215 145 lanttu
 
216
      ip_cmd_in    => net_cmd_from_at,
217
      ip_data_in   => net_data_from_at,
218
      ip_stall_out => net_stall_to_at,
219
      orig_addr_in => orig_addr_from_at,
220
 
221
      net_cmd_out  => net_cmd_out,
222
      net_data_out => net_data_out,
223
      net_stall_in => net_stall_in
224
      );
225
 
226
 
227
  -----------------------------------------------------------------------------
228
  -- ADDRESS RIPPER / REPLACER  (only at receiver side, i.e. from NET to IP)
229
  -----------------------------------------------------------------------------
230 147 lanttu
 
231 145 lanttu
  addr_rip_1 : entity work.addr_rip
232
    generic map (
233
      cmd_width_g    => cmd_width_g,
234
      data_width_g   => data_width_g,
235
      addr_flit_en_g => addr_flit_en_g,
236
      rip_addr_g     => rip_addr_g
237
      )
238
    port map (
239 147 lanttu
      clk   => clk_net,
240
      rst_n => rst_n,
241 145 lanttu
 
242
      net_cmd_in    => net_cmd_in,
243
      net_data_in   => net_data_in,
244
      net_stall_out => net_stall_out,
245
 
246 147 lanttu
      ip_cmd_out  => ip_cmd_from_ar,
247
      ip_data_out => ip_data_from_ar,
248
      ip_stall_in => ip_stall_to_ar);
249
 
250 145 lanttu
end architecture structural;

powered by: WebSVN 2.1.0

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