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 53

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 42 lmaarsen
--------------------------------------------------------------------------------
2 53 lmaarsen
--
3
-- This VHDL file was generated by EASE/HDL 7.4 Revision 4 from HDL Works B.V.
4
--
5
-- Ease library  : work
6
-- HDL library   : work
7
-- Host name     : S212065
8
-- User name     : df768
9
-- Time stamp    : Tue Aug 19 08:05:18 2014
10
--
11
-- Designed by   : L.Maarsen
12
-- Company       : LogiXA
13
-- Project info  : eSoC
14
--
15 42 lmaarsen
--------------------------------------------------------------------------------
16 53 lmaarsen
 
17 42 lmaarsen
--------------------------------------------------------------------------------
18
-- Object        : Entity work.esoc_port_mal_control
19
-- Last modified : Mon Apr 14 12:49:06 2014.
20
--------------------------------------------------------------------------------
21
 
22
 
23
 
24
library ieee, std, work;
25
use ieee.std_logic_1164.all;
26
use std.textio.all;
27
use ieee.numeric_std.all;
28
use work.package_esoc_configuration.all;
29
 
30
entity esoc_port_mal_control is
31
  generic(
32
    esoc_port_nr : integer := 0);
33
  port(
34
    clk_control            : in     STD_LOGIC;
35
    ctrl_address           : in     std_logic_vector(15 downto 0);
36
    ctrl_rd                : in     std_logic := '0';
37
    ctrl_rddata            : out    std_logic_vector(31 downto 0);
38
    ctrl_wait              : out    STD_LOGIC;
39
    ctrl_wr                : in     std_logic;
40
    ctrl_wrdata            : in     std_logic_vector(31 downto 0);
41
    force_vlan_default_in  : out    std_logic;
42
    force_vlan_default_out : out    std_logic;
43
    magic_sleep_n          : out    STD_LOGIC := '1';
44
    magic_wakeup           : in     STD_LOGIC;
45
    port_vlan_default      : out    std_logic_vector(15 downto 0);
46
    reset                  : in     STD_LOGIC;
47
    xoff_gen               : out    STD_LOGIC;
48
    xon_gen                : out    STD_LOGIC);
49
end entity esoc_port_mal_control;
50
 
51
--------------------------------------------------------------------------------
52
-- Object        : Architecture work.esoc_port_mal_control.esoc_port_mal_control
53
-- Last modified : Mon Apr 14 12:49:06 2014.
54
--------------------------------------------------------------------------------
55
 
56
 
57
---------------------------------------------------------------------------------------------------------------
58
-- architecture and declarations
59
---------------------------------------------------------------------------------------------------------------
60
architecture esoc_port_mal_control of esoc_port_mal_control is
61
 
62
---------------------------------------------------------------------------------------------------------------
63
-- registers
64
---------------------------------------------------------------------------------------------------------------
65
constant reg_port_mal_vlan_default_add: integer                                := 385;
66
signal reg_port_mal_vlan_default: std_logic_vector(31 downto 0);
67
constant reg_port_mal_vlan_default_rst: std_logic_vector(31 downto 0)          := X"00000001";
68
  alias          reg_port_mal_vlan_default_force_out: std_logic is reg_port_mal_vlan_default(31);
69
  alias          reg_port_mal_vlan_default_force_in : std_logic is reg_port_mal_vlan_default(30);
70
 
71
constant reg_port_mal_stat_ctrl_add           : integer                        := 384;
72
signal   reg_port_mal_stat_ctrl               : std_logic_vector(31 downto 0);
73
constant reg_port_mal_stat_ctrl_rst           : std_logic_vector(31 downto 0) := X"00000001";
74
  alias          reg_port_mal_stat_ctrl_xon_gen     : std_logic is reg_port_mal_stat_ctrl(3);
75
  alias          reg_port_mal_stat_ctrl_xoff_gen    : std_logic is reg_port_mal_stat_ctrl(2);
76
  alias          reg_port_mal_stat_ctrl_magic_wakeup: std_logic is reg_port_mal_stat_ctrl(1);
77
  alias          reg_port_mal_stat_ctrl_magic_sleep : std_logic is reg_port_mal_stat_ctrl(0);
78
 
79
---------------------------------------------------------------------------------------------------------------
80
-- signals
81
---------------------------------------------------------------------------------------------------------------
82
signal ctrl_rddata_i: std_logic_vector(ctrl_rddata'high downto 0);
83
signal ctrl_wait_i: std_logic;
84
signal ctrl_bus_enable: std_logic;
85
 
86
begin
87
 
88
--=============================================================================================================
89
-- Process                : access registers when addressed or provide data from other units to the ctrl_rddata_i bus
90
-- Description  : 
91
--=============================================================================================================    
92
registers:  process(clk_control, reset)
93
            begin
94
              if reset = '1' then
95
 
96
                reg_port_mal_vlan_default <= reg_port_mal_vlan_default_rst;
97
 
98
                -- all ports have weight 1 after reset
99
                reg_port_mal_stat_ctrl <= reg_port_mal_stat_ctrl_rst;
100
                ctrl_rddata_i   <= (others => '0');
101
                ctrl_wait_i     <= '1';
102
                ctrl_bus_enable <= '0';
103
 
104
              elsif clk_control'event and clk_control = '1' then
105
                reg_port_mal_stat_ctrl_magic_wakeup <= magic_wakeup;
106
                ctrl_wait_i     <= '1';
107
                ctrl_bus_enable <= '0';
108
 
109
                -- continu if memory space of this entity is addressed
110
                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
111
                  -- claim the bus for ctrl_wait and ctrl_rddata
112
                  ctrl_bus_enable <= '1';
113
 
114
                  -- 
115
                        -- READ CYCLE started, unit addressed?
116
                        --
117
                        if ctrl_rd = '1' then
118
                                -- Check register address and provide data when addressed
119
                          case to_integer(unsigned(ctrl_address))- esoc_port_nr * esoc_port_base_offset is
120
                      when reg_port_mal_vlan_default_add  =>  ctrl_rddata_i <= reg_port_mal_vlan_default;
121
                                                              ctrl_wait_i <= '0';
122
 
123
                      when reg_port_mal_stat_ctrl_add     =>  ctrl_rddata_i <= reg_port_mal_stat_ctrl;
124
                                                              ctrl_wait_i <= '0';
125
 
126
                      when others                         =>  NULL;
127
                    end case;
128
 
129
                  --
130
                  -- WRITE CYCLE started, unit addressed?
131
                  --
132
                  elsif ctrl_wr = '1' then
133
                        -- Check address and accept data when addressed
134
                        case to_integer(unsigned(ctrl_address))- esoc_port_nr * esoc_port_base_offset is
135
                      when reg_port_mal_vlan_default_add => reg_port_mal_vlan_default <= ctrl_wrdata;
136
                                                            ctrl_wait_i <= '0';
137
 
138
                      when reg_port_mal_stat_ctrl_add    =>  reg_port_mal_stat_ctrl <= ctrl_wrdata;
139
                                                            ctrl_wait_i <= '0';
140
 
141
                      when others                        =>  NULL;
142
                    end case;
143
                  end if;
144
                end if;
145
              end if;
146
            end process;
147
 
148
            -- Create tristate outputs
149
            ctrl_wait       <= ctrl_wait_i    when ctrl_bus_enable = '1' else 'Z';
150
            ctrl_rddata     <= ctrl_rddata_i  when ctrl_bus_enable = '1' else (others => 'Z');
151
 
152
            -- use register content
153
            force_vlan_default_out  <= reg_port_mal_vlan_default_force_out;
154
            force_vlan_default_in   <= reg_port_mal_vlan_default_force_in;
155
 
156
            port_vlan_default       <= reg_port_mal_vlan_default(port_vlan_default'high downto 0);
157
 
158
            magic_sleep_n                 <= reg_port_mal_stat_ctrl_magic_sleep;
159
            xoff_gen                      <= reg_port_mal_stat_ctrl_xoff_gen;
160
                                    xon_gen                       <= reg_port_mal_stat_ctrl_xon_gen;
161
 
162
end architecture esoc_port_mal_control ; -- of esoc_port_mal_control
163
 

powered by: WebSVN 2.1.0

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