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 145

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
-- Last update: 2012-03-19
10
-- 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
    noc_type_g     : natural
51
    );
52
  port (
53
    clk           : in  std_logic;
54
    rst_n         : in  std_logic;
55
    -- from IP side
56
    ip_cmd_in     : in  std_logic_vector(cmd_width_g-1 downto 0);
57
    ip_data_in    : in  std_logic_vector(data_width_g-1 downto 0);
58
    ip_stall_out  : out std_logic;
59
    -- to NET
60
    net_cmd_out   : out std_logic_vector(cmd_width_g-1 downto 0);
61
    net_data_out  : out std_logic_vector(data_width_g-1 downto 0);
62
    net_stall_in  : in  std_logic;
63
    orig_addr_out : out std_logic_vector(data_width_g-1 downto 0));
64
 
65
end addr_translation;
66
 
67
 
68
architecture rtl of addr_translation is
69
 
70
  signal addr_to_lut : std_logic_vector(data_width_g-1 downto 0);
71
  signal addr_from_lut : std_logic_vector(data_width_g-1 downto 0);
72
  signal orig_addr_r   : std_logic_vector(data_width_g-1 downto 0);
73
 
74
begin  -- rtl
75
 
76
  safe_p: process (ip_cmd_in, ip_data_in)
77
  begin  -- process safe_p
78
    if ip_cmd_in = "01" then
79
      addr_to_lut <= ip_data_in;
80
    else
81
      addr_to_lut <= (others => '0');
82
    end if;
83
  end process safe_p;
84
 
85
  addr_lut_1 : entity work.address_lut
86
    generic map (
87
      my_id_g        => my_id_g,
88
      data_width_g   => data_width_g,
89
      address_mode_g => address_mode_g,
90
      cols_g         => cols_g,
91
      rows_g         => rows_g,
92
      agent_ports_g  => agent_ports_g,
93
      agents_g       => agents_g,
94
      noc_type_g     => noc_type_g
95
      )
96
    port map (
97
      addr_in  => addr_to_lut,
98
      addr_out => addr_from_lut
99
      );
100
 
101
  net_cmd_out   <= ip_cmd_in;
102
  ip_stall_out  <= net_stall_in;
103
  orig_addr_out <= orig_addr_r;
104
 
105
  oa_p : process (clk, rst_n)
106
  begin  -- process oa_p
107
    if rst_n = '0' then                -- asynchronous reset (active low)
108
      orig_addr_r <= (others => '0');
109
    elsif clk'event and clk = '1' then  -- rising clock edge
110
      if ip_cmd_in = "01" then
111
        orig_addr_r <= ip_data_in;
112
      end if;
113
    end if;
114
  end process oa_p;
115
 
116
  mux_p : process (ip_cmd_in, addr_from_lut, ip_data_in)
117
  begin  -- process mux_p
118
    if ip_cmd_in = "01" then
119
      net_data_out <= addr_from_lut;
120
    else
121
      net_data_out <= ip_data_in;
122
    end if;
123
  end process mux_p;
124
 
125
 
126
 
127
end rtl;

powered by: WebSVN 2.1.0

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