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

Subversion Repositories loadbalancer

[/] [loadbalancer/] [trunk/] [int2ext/] [vlan2ext.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 atalla
--------------------------------------------------------
2
        LIBRARY IEEE;
3
        USE IEEE.STD_LOGIC_1164.ALL;
4
        use ieee.numeric_std.all;
5
        use IEEE.STD_LOGIC_ARITH.ALL;
6
        use IEEE.STD_LOGIC_UNSIGNED.ALL;
7
        USE WORK.CONFIG.ALL;
8
-------------------------------
9
        ENTITY vlan2ext IS
10
        GENERIC(DATA_WIDTH :INTEGER := 64;
11
                        CTRL_WIDTH :INTEGER := 8);
12
        PORT(
13
        SIGNAL          in_data                         :       IN      STD_LOGIC_VECTOR(63 DOWNTO 0)    ;
14
        SIGNAL          in_ctrl                         :       IN      STD_LOGIC_VECTOR(7 DOWNTO 0)     ;
15
    SIGNAL              in_wr                           :       IN              STD_LOGIC       ;
16
 
17
        SIGNAL          exit_port                       :       OUT     STD_LOGIC_VECTOR(7 DOWNTO 0)     ;
18
        SIGNAL          done                            :       OUT     STD_LOGIC       ;
19
 
20
    --- Misc
21
 
22
    SIGNAL              reset                           :       IN              STD_LOGIC       ;
23
    SIGNAL              clk                             :       IN              STD_LOGIC
24
        );
25
        END ENTITY vlan2ext;
26
 
27
 ------------------------------------------------------
28
        ARCHITECTURE behavior OF vlan2ext IS
29
------------ one hot encoding state definition
30
        TYPE state_type is (READ_HEADER, READ_WORD_1, READ_WORD_2);
31
        ATTRIBUTE enum_encoding: STRING;
32
        ATTRIBUTE enum_encoding of state_type : type is "onehot";
33
 
34
        SIGNAL state, state_NEXT : state_type;
35
 
36
        SIGNAL          exit_port_p                     :       STD_LOGIC_VECTOR(7 DOWNTO 0);
37
        SIGNAL          vlan_rdy                        :       STD_LOGIC;
38
 
39
 
40
 
41
 
42
        BEGIN
43
---------------------------------------------   
44
        PROCESS(reset,clk)
45
                BEGIN
46
                        IF (reset ='1') THEN
47
                                state <=READ_HEADER;
48
                        ELSIF clk'EVENT AND clk ='1' THEN
49
                                state<=state_next;
50
                        END IF;
51
                END PROCESS;
52
 
53
                PROCESS(state , in_ctrl , in_wr)
54
                BEGIN
55
                                                                                                        state_next                                 <=  state;
56
                                                                                                        vlan_rdy                                   <= '0' ;
57
                        CASE state IS
58
                                WHEN READ_HEADER =>
59
                                        IF( in_wr = '1' AND in_ctrl=X"FF"  ) THEN
60
 
61
                                                                                                        state_next                 <=  READ_WORD_1;
62
                                        END IF;
63
                                WHEN READ_WORD_1 =>
64
                                        IF( in_wr = '1') THEN
65
                                                                                                        state_next                <=  READ_WORD_2;
66
                                                END IF;
67
                                WHEN READ_WORD_2 =>
68
 
69
                                        IF(in_wr = '1' ) THEN
70
                                                                                                        vlan_rdy                                  <= '1' ;
71
                                                                                                        state_next                <= READ_HEADER;
72
                                        END IF;
73
                                WHEN OTHERS =>
74
                                                                                                        state_next                <= READ_HEADER;
75
                        END CASE;
76
                END PROCESS;
77
 
78
                PROCESS(clk)
79
                BEGIN
80
                        IF clk'EVENT AND clk ='1'  THEN
81
                                                        done <=vlan_rdy;
82
--                                      IF  vlan_rdy = '1' THEN
83
 
84
                                                        CASE in_data(11 downto 0) IS
85
                                                        WHEN  vlan_array(0) => exit_port  <=  X"01" ;
86
                                                        WHEN  vlan_array(1) => exit_port  <=  X"04" ;
87
                                                        WHEN  vlan_array(2) => exit_port  <=  X"10" ;
88
                                                        WHEN  vlan_array(3) => exit_port  <=  X"40" ;
89
                                                        WHEN  OTHERS =>                   exit_port  <=  X"01" ;
90
                                                        END CASE;
91
--                                                      done <='1';
92
--                                      END IF;
93
                        END IF;
94
                END PROCESS;
95
 
96
 
97
END behavior;
98
 

powered by: WebSVN 2.1.0

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