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/] [addr_translation.vhd] - Blame information for rev 162

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : Address translation unit
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : addr_translation.vhd
6
-- Author     : Lasse Lehtonen
7
-- Company    : 
8
-- Created    : 2011-10-12
9 147 lanttu
-- Last update: 2012-05-04
10 145 lanttu
-- Platform   : 
11
-- Standard   : VHDL'87
12
-------------------------------------------------------------------------------
13
-- Description:
14
--
15
-- Translates various addressing styles to network adresses and also
16
-- handles inserting the original address behind the network address flit.
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
-- addr_flit_en_g 0 : Nothing done
25
-- addr_flit_en_g 1 : Places the original address to the second flit
26
--
27
-------------------------------------------------------------------------------
28
-- Copyright (c) 2011 
29
-------------------------------------------------------------------------------
30
-- Revisions  :
31
-- Date        Version  Author  Description
32
-- 2011-10-12  1.0      lehton87        Created
33
-------------------------------------------------------------------------------
34
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
 
38
entity addr_translation is
39
 
40
  generic (
41
    my_id_g        : natural;
42
    cmd_width_g    : positive;
43
    data_width_g   : positive;
44
    address_mode_g : natural;
45
    cols_g         : positive;
46
    rows_g         : positive;
47
    agents_g       : positive;
48
    agent_ports_g  : positive;
49
    addr_flit_en_g : natural;
50 147 lanttu
    noc_type_g     : natural;
51
    len_width_g    : natural            -- 2012-05-04
52 145 lanttu
    );
53
  port (
54
    clk           : in  std_logic;
55
    rst_n         : in  std_logic;
56
    -- from IP side
57
    ip_cmd_in     : in  std_logic_vector(cmd_width_g-1 downto 0);
58
    ip_data_in    : in  std_logic_vector(data_width_g-1 downto 0);
59
    ip_stall_out  : out std_logic;
60 147 lanttu
    ip_len_in     : in  std_logic_vector(len_width_g-1 downto 0);  -- 2012-05-04
61 145 lanttu
    -- to NET
62
    net_cmd_out   : out std_logic_vector(cmd_width_g-1 downto 0);
63
    net_data_out  : out std_logic_vector(data_width_g-1 downto 0);
64
    net_stall_in  : in  std_logic;
65
    orig_addr_out : out std_logic_vector(data_width_g-1 downto 0));
66
 
67
end addr_translation;
68
 
69
 
70
architecture rtl of addr_translation is
71
 
72 147 lanttu
  signal addr_to_lut   : std_logic_vector(data_width_g-1 downto 0);
73 145 lanttu
  signal addr_from_lut : std_logic_vector(data_width_g-1 downto 0);
74
  signal orig_addr_r   : std_logic_vector(data_width_g-1 downto 0);
75
 
76
begin  -- rtl
77
 
78 147 lanttu
  safe_p : process (ip_cmd_in, ip_data_in)
79 145 lanttu
  begin  -- process safe_p
80
    if ip_cmd_in = "01" then
81
      addr_to_lut <= ip_data_in;
82
    else
83
      addr_to_lut <= (others => '0');
84
    end if;
85
  end process safe_p;
86 147 lanttu
 
87 145 lanttu
  addr_lut_1 : entity work.address_lut
88
    generic map (
89
      my_id_g        => my_id_g,
90
      data_width_g   => data_width_g,
91
      address_mode_g => address_mode_g,
92
      cols_g         => cols_g,
93
      rows_g         => rows_g,
94
      agent_ports_g  => agent_ports_g,
95
      agents_g       => agents_g,
96 147 lanttu
      noc_type_g     => noc_type_g,
97
      len_width_g    => len_width_g     -- 2012-05-04
98 145 lanttu
      )
99
    port map (
100
      addr_in  => addr_to_lut,
101 147 lanttu
      len_in   => ip_len_in,            -- 2012-05-04
102 145 lanttu
      addr_out => addr_from_lut
103
      );
104
 
105
  net_cmd_out   <= ip_cmd_in;
106
  ip_stall_out  <= net_stall_in;
107
  orig_addr_out <= orig_addr_r;
108
 
109
  oa_p : process (clk, rst_n)
110
  begin  -- process oa_p
111 147 lanttu
    if rst_n = '0' then                 -- asynchronous reset (active low)
112 145 lanttu
      orig_addr_r <= (others => '0');
113
    elsif clk'event and clk = '1' then  -- rising clock edge
114
      if ip_cmd_in = "01" then
115
        orig_addr_r <= ip_data_in;
116
      end if;
117
    end if;
118
  end process oa_p;
119
 
120
  mux_p : process (ip_cmd_in, addr_from_lut, ip_data_in)
121
  begin  -- process mux_p
122
    if ip_cmd_in = "01" then
123
      net_data_out <= addr_from_lut;
124
    else
125
      net_data_out <= ip_data_in;
126
    end if;
127
  end process mux_p;
128
 
129
 
130
 
131
end rtl;

powered by: WebSVN 2.1.0

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