OpenCores
URL https://opencores.org/ocsvn/loadbalancer/loadbalancer/trunk

Subversion Repositories loadbalancer

[/] [loadbalancer/] [trunk/] [ARP/] [arp_top.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 atalla
--------------------------------------------------------
2
 
3
        LIBRARY IEEE;
4
        USE IEEE.STD_LOGIC_1164.ALL;
5
-------------------------------
6
        ENTITY arp_top IS
7
        GENERIC(DATA_WIDTH :INTEGER := 64;
8
                        CTRL_WIDTH :INTEGER := 8);
9
        PORT(
10
        SIGNAL in_data :IN   STD_LOGIC_VECTOR(63 DOWNTO 0);
11
        SIGNAL in_ctrl : IN   STD_LOGIC_VECTOR(7 DOWNTO 0);
12
    SIGNAL in_wr :IN STD_LOGIC;
13
        SIGNAL in_rdy : OUT STD_LOGIC;
14
 
15
        SIGNAL out_data :OUT   STD_LOGIC_VECTOR(63 DOWNTO 0);
16
        SIGNAL out_ctrl : OUT   STD_LOGIC_VECTOR(7 DOWNTO 0);
17
    SIGNAL out_wr : OUT STD_LOGIC;
18
        SIGNAL out_rdy : IN STD_LOGIC;
19
 
20
 
21
    --- Misc
22
    SIGNAL en :IN STD_LOGIC;
23
    SIGNAL reset :IN STD_LOGIC;
24
    SIGNAL clk   :IN STD_LOGIC
25
        );
26
        END ENTITY;
27
 ------------------------------------------------------
28
 
29
        ARCHITECTURE behavior OF arp_top IS
30
                -------COMPONENET SMALL FIFO
31
                COMPONENT  small_fifo IS
32
        GENERIC(WIDTH :INTEGER := 72;
33
                        MAX_DEPTH_BITS :INTEGER := 3);
34
        PORT(
35
 
36
 
37
     SIGNAL din : IN STD_LOGIC_VECTOR(71 DOWNTO 0);--input [WIDTH-1:0] din,     // Data in
38
     SIGNAL wr_en : IN STD_LOGIC;--input          wr_en,   // Write enable
39
 
40
     SIGNAL rd_en : IN STD_LOGIC;--input          rd_en,   // Read the next word 
41
 
42
     SIGNAL dout :OUT STD_LOGIC_VECTOR(71 DOWNTO 0);--output reg [WIDTH-1:0]  dout,    // Data out
43
     SIGNAL full : OUT STD_LOGIC;--output         full,
44
     SIGNAL nearly_full : OUT STD_LOGIC;--output         nearly_full,
45
     SIGNAL empty : OUT STD_LOGIC;--output         empty,
46
 
47
 
48
    SIGNAL reset :IN STD_LOGIC;
49
    SIGNAL clk   :IN STD_LOGIC
50
 
51
        );
52
        END COMPONENT;
53
-------COMPONENET SMALL FIFO
54
        component arp_parser
55
 
56
        GENERIC(DATA_WIDTH :INTEGER := 64;
57
                        CTRL_WIDTH :INTEGER := 8);
58
 
59
        PORT(
60
        SIGNAL in_data :IN   STD_LOGIC_VECTOR(63 DOWNTO 0);
61
        SIGNAL in_ctrl : IN   STD_LOGIC_VECTOR(7 DOWNTO 0);
62
    SIGNAL in_wr :IN STD_LOGIC;
63
 
64
        SIGNAL header : OUT STD_LOGIC_VECTOR(63 DOWNTO 0);
65
     --- ethr  header
66
    SIGNAL src_mac : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
67
        SIGNAL SHA :OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
68
        SIGNAL SPA :OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
69
        SIGNAL THA : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
70
        SIGNAL TPA : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
71
    --- Misc
72
    SIGNAL done :OUT STD_LOGIC;
73
    SIGNAL reset :IN STD_LOGIC;
74
    SIGNAL clk   :IN STD_LOGIC
75
        );
76
 
77
        end component;
78
    component arp_response
79
 
80
        GENERIC(DATA_WIDTH :INTEGER := 64;
81
                        CTRL_WIDTH :INTEGER := 8);
82
 
83
        PORT(
84
        SIGNAL out_data : OUT   STD_LOGIC_VECTOR(63 DOWNTO 0);
85
        SIGNAL out_ctrl : OUT  STD_LOGIC_VECTOR(7 DOWNTO 0);
86
   SIGNAL out_wr : OUT STD_LOGIC;
87
        SIGNAL header : IN STD_LOGIC_VECTOR(63 DOWNTO 0);
88
    SIGNAL src_mac : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
89
        SIGNAL SHA :IN STD_LOGIC_VECTOR(47 DOWNTO 0);
90
        SIGNAL SPA :IN STD_LOGIC_VECTOR(31 DOWNTO 0);
91
        SIGNAL THA : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
92
        SIGNAL TPA : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
93
    --- Misc
94
    SIGNAL rdy :IN STD_LOGIC;
95
    SIGNAL reset :IN STD_LOGIC;
96
    SIGNAL clk   :IN STD_LOGIC
97
        );
98
 
99
        end component;
100
--------------------------------WIRES
101
 
102
        SIGNAL header :  STD_LOGIC_VECTOR(63 DOWNTO 0);
103
    SIGNAL src_mac :  STD_LOGIC_VECTOR(47 DOWNTO 0);
104
        SIGNAL SHA : STD_LOGIC_VECTOR(47 DOWNTO 0);
105
        SIGNAL SPA : STD_LOGIC_VECTOR(31 DOWNTO 0);
106
        SIGNAL THA :  STD_LOGIC_VECTOR(47 DOWNTO 0);
107
        SIGNAL TPA :  STD_LOGIC_VECTOR(31 DOWNTO 0);
108
    --- Misc
109
    SIGNAL rdy : STD_LOGIC;
110
    --------------------------------------------------------------
111
     SIGNAL wr_en : STD_LOGIC;
112
     SIGNAL data_in :STD_LOGIC_VECTOR(71 DOWNTO 0);
113
         SIGNAL rd_en : STD_LOGIC;
114
         SIGNAL rd_en_p : STD_LOGIC;
115
     SIGNAL dout : STD_LOGIC_VECTOR(71 DOWNTO 0);
116
     SIGNAL fifo_data :STD_LOGIC_VECTOR(63 DOWNTO 0);--output reg [WIDTH-1:0]  dout,    // Data out
117
         SIGNAL fifo_ctrl :STD_LOGIC_VECTOR(7 DOWNTO 0);--output reg [WIDTH-1:0]  dout,    // Data out
118
     SIGNAL full : STD_LOGIC;--output         full,
119
     SIGNAL nearly_full : STD_LOGIC;--output         nearly_full,
120
     SIGNAL empty : STD_LOGIC;--output         empty,
121
 
122
 
123
 
124
-------------------------------------------
125
        BEGIN
126
        -------PORT MAP SMALL FIFO
127
                small_fifo_Inst :  small_fifo
128
        GENERIC MAP(WIDTH  => 72,
129
                        MAX_DEPTH_BITS  => 3)
130
        PORT MAP(
131
 
132
 
133
      din =>(data_in),
134
      wr_en =>wr_en,
135
 
136
      rd_en => rd_en,
137
 
138
      dout =>dout,
139
      full =>full,
140
      nearly_full =>nearly_full,
141
      empty => empty,
142
 
143
 
144
     reset => reset ,
145
     clk  => clk
146
 
147
        );
148
 
149
-------PORT MAP SMALL FIFO
150
                wr_en <= in_wr and en;
151
                in_rdy <=  NOT nearly_full;
152
                rd_en <= out_rdy AND (NOT empty);
153
                fifo_data <=dout(71 DOWNTO 8);
154
                fifo_ctrl <=DOUT(7 DOWNTO 0);
155
                data_in<=in_data & in_ctrl;
156
                PROCESS(clk)
157
                BEGIN
158
                        IF clk'EVENT AND clk ='1' THEN
159
                        rd_en_p <=rd_en;
160
                        END IF;
161
                END PROCESS;
162
 
163
--      in_rdy <=out_rdy;
164
        arp_parser1 : arp_parser
165
        generic map
166
        (               DATA_WIDTH  => 64,
167
                        CTRL_WIDTH  => 8)
168
 
169
        PORT MAP(
170
        in_data =>fifo_data,
171
        in_ctrl =>fifo_ctrl,
172
    in_wr =>rd_en_p,
173
 
174
        header =>header,
175
     --- ethr  header
176
    src_mac =>src_mac,
177
        SHA =>SHA,
178
        SPA =>SPA,
179
        THA =>THA,
180
        TPA =>TPA,
181
    --- Misc
182
    done =>rdy,
183
    reset =>reset,
184
    clk   =>clk
185
        );
186
                arp_response1 : arp_response
187
        generic map
188
        (               DATA_WIDTH  => 64,
189
                        CTRL_WIDTH  => 8)
190
 
191
        PORT MAP(
192
        out_data =>out_data,
193
        out_ctrl =>out_ctrl,
194
    out_wr =>out_wr,
195
 
196
        header =>header,
197
     --- ethr  header
198
    src_mac =>src_mac,
199
        SHA =>SHA,
200
        SPA =>SPA,
201
        THA =>THA,
202
        TPA =>TPA,
203
    --- Misc
204
    rdy =>rdy,
205
    reset =>reset,
206
    clk   =>clk
207
        );
208
 
209
END behavior;
210
 

powered by: WebSVN 2.1.0

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