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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_mal_control.vhd] - Blame information for rev 50

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

Line No. Rev Author Line
1 42 lmaarsen
--------------------------------------------------------------------------------
2
----                                                                        ----
3
---- Ethernet Switch on Configurable Logic IP Core                          ----
4
----                                                                        ----
5
---- This file is part of the ESoCL project                                 ----
6
---- http://www.opencores.org/cores/esoc/                                   ----
7
----                                                                        ----
8
---- Description: see design description ESoCL_dd_71022001.pdf              ----
9
----                                                                        ----
10
---- To Do: see roadmap description ESoCL_dd_71022001.pdf                   ----
11
----        and/or release bulleting ESoCL_rb_71022001.pdf                  ----
12
----                                                                        ----
13
---- Author(s): L.Maarsen                                                   ----
14
---- Bert Maarsen, lmaarsen@opencores.org                                   ----
15
----                                                                        ----
16
--------------------------------------------------------------------------------
17
----                                                                        ----
18
---- Copyright (C) 2009 Authors and OPENCORES.ORG                           ----
19
----                                                                        ----
20
---- This source file may be used and distributed without                   ----
21
---- restriction provided that this copyright statement is not              ----
22
---- removed from the file and that any derivative work contains            ----
23
---- the original copyright notice and the associated disclaimer.           ----
24
----                                                                        ----
25
---- This source file is free software; you can redistribute it             ----
26
---- and/or modify it under the terms of the GNU Lesser General             ----
27
---- Public License as published by the Free Software Foundation;           ----
28
---- either version 2.1 of the License, or (at your option) any             ----
29
---- later version.                                                         ----
30
----                                                                        ----
31
---- This source is distributed in the hope that it will be                 ----
32
---- useful, but WITHOUT ANY WARRANTY; without even the implied             ----
33
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR                ----
34
---- PURPOSE. See the GNU Lesser General Public License for more            ----
35
---- details.                                                               ----
36
----                                                                        ----
37
---- You should have received a copy of the GNU Lesser General              ----
38
---- Public License along with this source; if not, download it             ----
39
---- from http://www.opencores.org/lgpl.shtml                               ----
40
----                                                                        ----
41
--------------------------------------------------------------------------------
42
-- Object        : Entity work.esoc_port_mal_control
43
-- Last modified : Mon Apr 14 12:49:06 2014.
44
--------------------------------------------------------------------------------
45
 
46
 
47
 
48
library ieee, std, work;
49
use ieee.std_logic_1164.all;
50
use std.textio.all;
51
use ieee.numeric_std.all;
52
use work.package_esoc_configuration.all;
53
 
54
entity esoc_port_mal_control is
55
  generic(
56
    esoc_port_nr : integer := 0);
57
  port(
58
    clk_control            : in     STD_LOGIC;
59
    ctrl_address           : in     std_logic_vector(15 downto 0);
60
    ctrl_rd                : in     std_logic := '0';
61
    ctrl_rddata            : out    std_logic_vector(31 downto 0);
62
    ctrl_wait              : out    STD_LOGIC;
63
    ctrl_wr                : in     std_logic;
64
    ctrl_wrdata            : in     std_logic_vector(31 downto 0);
65
    force_vlan_default_in  : out    std_logic;
66
    force_vlan_default_out : out    std_logic;
67
    magic_sleep_n          : out    STD_LOGIC := '1';
68
    magic_wakeup           : in     STD_LOGIC;
69
    port_vlan_default      : out    std_logic_vector(15 downto 0);
70
    reset                  : in     STD_LOGIC;
71
    xoff_gen               : out    STD_LOGIC;
72
    xon_gen                : out    STD_LOGIC);
73
end entity esoc_port_mal_control;
74
 
75
--------------------------------------------------------------------------------
76
-- Object        : Architecture work.esoc_port_mal_control.esoc_port_mal_control
77
-- Last modified : Mon Apr 14 12:49:06 2014.
78
--------------------------------------------------------------------------------
79
 
80
 
81
---------------------------------------------------------------------------------------------------------------
82
-- architecture and declarations
83
---------------------------------------------------------------------------------------------------------------
84
architecture esoc_port_mal_control of esoc_port_mal_control is
85
 
86
---------------------------------------------------------------------------------------------------------------
87
-- registers
88
---------------------------------------------------------------------------------------------------------------
89
constant reg_port_mal_vlan_default_add: integer                                := 385;
90
signal reg_port_mal_vlan_default: std_logic_vector(31 downto 0);
91
constant reg_port_mal_vlan_default_rst: std_logic_vector(31 downto 0)          := X"00000001";
92
  alias          reg_port_mal_vlan_default_force_out: std_logic is reg_port_mal_vlan_default(31);
93
  alias          reg_port_mal_vlan_default_force_in : std_logic is reg_port_mal_vlan_default(30);
94
 
95
constant reg_port_mal_stat_ctrl_add           : integer                        := 384;
96
signal   reg_port_mal_stat_ctrl               : std_logic_vector(31 downto 0);
97
constant reg_port_mal_stat_ctrl_rst           : std_logic_vector(31 downto 0) := X"00000001";
98
  alias          reg_port_mal_stat_ctrl_xon_gen     : std_logic is reg_port_mal_stat_ctrl(3);
99
  alias          reg_port_mal_stat_ctrl_xoff_gen    : std_logic is reg_port_mal_stat_ctrl(2);
100
  alias          reg_port_mal_stat_ctrl_magic_wakeup: std_logic is reg_port_mal_stat_ctrl(1);
101
  alias          reg_port_mal_stat_ctrl_magic_sleep : std_logic is reg_port_mal_stat_ctrl(0);
102
 
103
---------------------------------------------------------------------------------------------------------------
104
-- signals
105
---------------------------------------------------------------------------------------------------------------
106
signal ctrl_rddata_i: std_logic_vector(ctrl_rddata'high downto 0);
107
signal ctrl_wait_i: std_logic;
108
signal ctrl_bus_enable: std_logic;
109
 
110
begin
111
 
112
--=============================================================================================================
113
-- Process                : access registers when addressed or provide data from other units to the ctrl_rddata_i bus
114
-- Description  : 
115
--=============================================================================================================    
116
registers:  process(clk_control, reset)
117
            begin
118
              if reset = '1' then
119
 
120
                reg_port_mal_vlan_default <= reg_port_mal_vlan_default_rst;
121
 
122
                -- all ports have weight 1 after reset
123
                reg_port_mal_stat_ctrl <= reg_port_mal_stat_ctrl_rst;
124
                ctrl_rddata_i   <= (others => '0');
125
                ctrl_wait_i     <= '1';
126
                ctrl_bus_enable <= '0';
127
 
128
              elsif clk_control'event and clk_control = '1' then
129
                reg_port_mal_stat_ctrl_magic_wakeup <= magic_wakeup;
130
                ctrl_wait_i     <= '1';
131
                ctrl_bus_enable <= '0';
132
 
133
                -- continu if memory space of this entity is addressed
134
                if (to_integer(unsigned(ctrl_address)) >= esoc_port_nr * esoc_port_base_offset + esoc_port_mal_base) and (to_integer(unsigned(ctrl_address)) < esoc_port_nr * esoc_port_base_offset + esoc_port_mal_base + esoc_port_mal_size) then
135
                  -- claim the bus for ctrl_wait and ctrl_rddata
136
                  ctrl_bus_enable <= '1';
137
 
138
                  -- 
139
                        -- READ CYCLE started, unit addressed?
140
                        --
141
                        if ctrl_rd = '1' then
142
                                -- Check register address and provide data when addressed
143
                          case to_integer(unsigned(ctrl_address))- esoc_port_nr * esoc_port_base_offset is
144
                      when reg_port_mal_vlan_default_add  =>  ctrl_rddata_i <= reg_port_mal_vlan_default;
145
                                                              ctrl_wait_i <= '0';
146
 
147
                      when reg_port_mal_stat_ctrl_add     =>  ctrl_rddata_i <= reg_port_mal_stat_ctrl;
148
                                                              ctrl_wait_i <= '0';
149
 
150
                      when others                         =>  NULL;
151
                    end case;
152
 
153
                  --
154
                  -- WRITE CYCLE started, unit addressed?
155
                  --
156
                  elsif ctrl_wr = '1' then
157
                        -- Check address and accept data when addressed
158
                        case to_integer(unsigned(ctrl_address))- esoc_port_nr * esoc_port_base_offset is
159
                      when reg_port_mal_vlan_default_add => reg_port_mal_vlan_default <= ctrl_wrdata;
160
                                                            ctrl_wait_i <= '0';
161
 
162
                      when reg_port_mal_stat_ctrl_add    =>  reg_port_mal_stat_ctrl <= ctrl_wrdata;
163
                                                            ctrl_wait_i <= '0';
164
 
165
                      when others                        =>  NULL;
166
                    end case;
167
                  end if;
168
                end if;
169
              end if;
170
            end process;
171
 
172
            -- Create tristate outputs
173
            ctrl_wait       <= ctrl_wait_i    when ctrl_bus_enable = '1' else 'Z';
174
            ctrl_rddata     <= ctrl_rddata_i  when ctrl_bus_enable = '1' else (others => 'Z');
175
 
176
            -- use register content
177
            force_vlan_default_out  <= reg_port_mal_vlan_default_force_out;
178
            force_vlan_default_in   <= reg_port_mal_vlan_default_force_in;
179
 
180
            port_vlan_default       <= reg_port_mal_vlan_default(port_vlan_default'high downto 0);
181
 
182
            magic_sleep_n                 <= reg_port_mal_stat_ctrl_magic_sleep;
183
            xoff_gen                      <= reg_port_mal_stat_ctrl_xoff_gen;
184
                                    xon_gen                       <= reg_port_mal_stat_ctrl_xon_gen;
185
 
186
end architecture esoc_port_mal_control ; -- of esoc_port_mal_control
187
 

powered by: WebSVN 2.1.0

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