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 145

Go to most recent revision | 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
-- Last update: 2011-12-02
10
-- 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
--
31
-------------------------------------------------------------------------------
32
-- Copyright (c) 2011 
33
-------------------------------------------------------------------------------
34
-- Revisions  :
35
-- Date        Version  Author  Description
36
-- 2011-01-12  1.0      ase     Created
37
-------------------------------------------------------------------------------
38
 
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42
use ieee.numeric_std.all;
43
 
44
use work.ase_noc_pkg.all;
45
use work.ase_mesh1_pkg.all;
46
 
47
entity pkt_codec_mk2 is
48
 
49
  generic (
50
    my_id_g        : natural;
51
    data_width_g   : positive;          -- in bits
52
    cmd_width_g    : positive;          -- in bits
53
    agents_g       : positive;          -- total num of agents
54
    cols_g         : positive;          -- noc size in x dimension
55
    rows_g         : positive;          -- noc size in y dimension
56
    agent_ports_g  : positive;
57
    addr_flit_en_g : natural;           -- put addr from IP to 2nd flit of pkt?
58
    address_mode_g : natural;           -- 3 choices: 0-2
59
    clock_mode_g   : natural;           -- 0: synchr, 1= clk_ip differs from clk_net
60
    rip_addr_g     : natural;           -- remove noc addr at the receiver?
61
    noc_type_g     : natural
62
    );
63
  port (
64
    clk_ip  : in std_logic;
65
    clk_net : in std_logic;
66
    rst_n   : in std_logic;
67
 
68
    -- IP read interface 
69
    ip_cmd_out  : out std_logic_vector(cmd_width_g-1 downto 0);
70
    ip_data_out : out std_logic_vector(data_width_g-1 downto 0);
71
    ip_stall_in : in  std_logic;
72
 
73
    -- IP write interface
74
    ip_cmd_in    : in  std_logic_vector(cmd_width_g-1 downto 0);
75
    ip_data_in   : in  std_logic_vector(data_width_g-1 downto 0);
76
    ip_stall_out : out std_logic;
77
 
78
    -- NoC write interface
79
    net_cmd_out  : out std_logic_vector(cmd_width_g-1 downto 0);
80
    net_data_out : out std_logic_vector(data_width_g-1 downto 0);
81
    net_stall_in : in  std_logic;
82
 
83
    -- NoC read interface
84
    net_cmd_in    : in  std_logic_vector(cmd_width_g-1 downto 0);
85
    net_data_in   : in  std_logic_vector(data_width_g-1 downto 0);
86
    net_stall_out : out std_logic
87
    );
88
 
89
end entity pkt_codec_mk2;
90
 
91
 
92
 
93
architecture structural of pkt_codec_mk2 is
94
 
95
  -----------------------------------------------------------------------------
96
  -- SIGNALS
97
  -----------------------------------------------------------------------------
98
 
99
  -- from ip to net path
100
  -- cdc -> at
101
  signal net_cmd_from_cdc  : std_logic_vector(cmd_width_g-1 downto 0);
102
  signal net_data_from_cdc : std_logic_vector(data_width_g-1 downto 0);
103
  signal net_stall_to_cdc  : std_logic;
104
  -- at -> ag
105
  signal net_cmd_from_at   : std_logic_vector(cmd_width_g-1 downto 0);
106
  signal net_data_from_at  : std_logic_vector(data_width_g-1 downto 0);
107
  signal net_stall_to_at   : std_logic;
108
  signal orig_addr_from_at : std_logic_vector(data_width_g-1 downto 0);
109
 
110
  -- from net to ip path
111
  -- ar -> cdc
112
  signal ip_cmd_from_ar  : std_logic_vector(cmd_width_g-1 downto 0);
113
  signal ip_data_from_ar : std_logic_vector(data_width_g-1 downto 0);
114
  signal ip_stall_to_ar  : std_logic;
115
 
116
 
117
-------------------------------------------------------------------------------
118
begin  -- architecture structural
119
-------------------------------------------------------------------------------
120
 
121
 
122
  -----------------------------------------------------------------------------
123
  -- CLOCK DOMAIN CROSSING (cdc) at both ends (sender + receiver)
124
  -----------------------------------------------------------------------------
125
 
126
  cdc_1 : entity work.cdc
127
    generic map (
128
      cmd_width_g  => cmd_width_g,
129
      data_width_g => data_width_g,
130
      clock_mode_g => clock_mode_g
131
      )
132
    port map (
133
      clk_ip        => clk_ip,
134
      clk_net       => clk_net,
135
      rst_n         => rst_n,
136
 
137
      ip_cmd_out    => ip_cmd_out,
138
      ip_data_out   => ip_data_out,
139
      ip_stall_in   => ip_stall_in,
140
 
141
      ip_cmd_in     => ip_cmd_in,
142
      ip_data_in    => ip_data_in,
143
      ip_stall_out  => ip_stall_out,
144
 
145
      net_cmd_out   => net_cmd_from_cdc,
146
      net_data_out  => net_data_from_cdc,
147
      net_stall_in  => net_stall_to_cdc,
148
 
149
      net_cmd_in    => ip_cmd_from_ar,
150
      net_data_in   => ip_data_from_ar,
151
      net_stall_out => ip_stall_to_ar);
152
 
153
  -----------------------------------------------------------------------------
154
  -- ADDRESS TRANSLATION (only at sender side, i.e. from IP to NET)
155
  -----------------------------------------------------------------------------
156
 
157
  addr_translation_1 : entity work.addr_translation
158
    generic map (
159
      my_id_g        => my_id_g,
160
      cmd_width_g    => cmd_width_g,
161
      data_width_g   => data_width_g,
162
      address_mode_g => address_mode_g,
163
      cols_g         => cols_g,
164
      rows_g         => rows_g,
165
      agents_g       => agents_g,
166
      agent_ports_g  => agent_ports_g,
167
      addr_flit_en_g => addr_flit_en_g,
168
      noc_type_g     => noc_type_g
169
      )
170
    port map (
171
      clk           => clk_net,
172
      rst_n         => rst_n,
173
 
174
      ip_cmd_in     => net_cmd_from_cdc,
175
      ip_data_in    => net_data_from_cdc,
176
      ip_stall_out  => net_stall_to_cdc,
177
 
178
      net_cmd_out   => net_cmd_from_at,
179
      net_data_out  => net_data_from_at,
180
      net_stall_in  => net_stall_to_at,
181
      orig_addr_out => orig_addr_from_at
182
      );
183
 
184
 
185
  -----------------------------------------------------------------------------
186
  -- ADDRESS GENERATOR  (only at sender side, i.e. from IP to NET)
187
  -----------------------------------------------------------------------------
188
 
189
  addr_gen_1 : entity work.addr_gen
190
    generic map (
191
      cmd_width_g    => cmd_width_g,
192
      data_width_g   => data_width_g,
193
      addr_flit_en_g => addr_flit_en_g
194
      )
195
    port map (
196
      clk          => clk_net,
197
      rst_n        => rst_n,
198
 
199
      ip_cmd_in    => net_cmd_from_at,
200
      ip_data_in   => net_data_from_at,
201
      ip_stall_out => net_stall_to_at,
202
      orig_addr_in => orig_addr_from_at,
203
 
204
      net_cmd_out  => net_cmd_out,
205
      net_data_out => net_data_out,
206
      net_stall_in => net_stall_in
207
      );
208
 
209
 
210
  -----------------------------------------------------------------------------
211
  -- ADDRESS RIPPER / REPLACER  (only at receiver side, i.e. from NET to IP)
212
  -----------------------------------------------------------------------------
213
 
214
  addr_rip_1 : entity work.addr_rip
215
    generic map (
216
      cmd_width_g    => cmd_width_g,
217
      data_width_g   => data_width_g,
218
      addr_flit_en_g => addr_flit_en_g,
219
      rip_addr_g     => rip_addr_g
220
      )
221
    port map (
222
      clk           => clk_net,
223
      rst_n         => rst_n,
224
 
225
      net_cmd_in    => net_cmd_in,
226
      net_data_in   => net_data_in,
227
      net_stall_out => net_stall_out,
228
 
229
      ip_cmd_out    => ip_cmd_from_ar,
230
      ip_data_out   => ip_data_from_ar,
231
      ip_stall_in   => ip_stall_to_ar);
232
 
233
end architecture structural;

powered by: WebSVN 2.1.0

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