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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_0/] [rtl/] [vhdl/] [p2.vhd] - Blame information for rev 32

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

Line No. Rev Author Line
1 4 arniml
-------------------------------------------------------------------------------
2
--
3
-- The Port 2 unit.
4
-- Implements the Port 2 logic.
5
--
6 32 arniml
-- $Id: p2.vhd,v 1.3 2004-03-29 19:39:58 arniml Exp $
7 4 arniml
--
8
-- All rights reserved
9
--
10
-- Redistribution and use in source and synthezised forms, with or without
11
-- modification, are permitted provided that the following conditions are met:
12
--
13
-- Redistributions of source code must retain the above copyright notice,
14
-- this list of conditions and the following disclaimer.
15
--
16
-- Redistributions in synthesized form must reproduce the above copyright
17
-- notice, this list of conditions and the following disclaimer in the
18
-- documentation and/or other materials provided with the distribution.
19
--
20
-- Neither the name of the author nor the names of other contributors may
21
-- be used to endorse or promote products derived from this software without
22
-- specific prior written permission.
23
--
24
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
28
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
-- POSSIBILITY OF SUCH DAMAGE.
35
--
36
-- Please report bugs to the author, but before you do so, please
37
-- make sure that this is not a derivative work and that
38
-- you have the latest version of this file.
39
--
40
-- The latest version of this file can be found at:
41
--      http://www.opencores.org/cvsweb.shtml/t48/
42
--
43
-------------------------------------------------------------------------------
44
 
45
library ieee;
46
use ieee.std_logic_1164.all;
47
 
48
use work.t48_pack.word_t;
49
use work.t48_pack.nibble_t;
50
 
51
entity p2 is
52
 
53
  port (
54
    -- Global Interface -------------------------------------------------------
55
    clk_i        : in  std_logic;
56
    res_i        : in  std_logic;
57
    en_clk_i     : in  boolean;
58
    -- T48 Bus Interface ------------------------------------------------------
59
    data_i       : in  word_t;
60
    data_o       : out word_t;
61
    write_p2_i   : in  boolean;
62
    write_exp_i  : in  boolean;
63
    read_p2_i    : in  boolean;
64
    read_reg_i   : in  boolean;
65 23 arniml
    read_exp_i   : in  boolean;
66 4 arniml
    -- Port 2 Interface -------------------------------------------------------
67
    output_pch_i : in  boolean;
68
    output_exp_i : in  boolean;
69
    pch_i        : in  nibble_t;
70
    p2_i         : in  word_t;
71
    p2_o         : out word_t;
72 32 arniml
    p2_low_imp_o : out std_logic
73 4 arniml
  );
74
 
75
end p2;
76
 
77
 
78
library ieee;
79
use ieee.std_logic_arith.conv_integer;
80
use ieee.std_logic_arith.unsigned;
81
 
82
use work.t48_pack.clk_active_c;
83
use work.t48_pack.res_active_c;
84
use work.t48_pack.bus_idle_level_c;
85
 
86
architecture rtl of p2 is
87
 
88
  -- the port output register
89
  signal p2_q   : word_t;
90
 
91
  -- the low impedance marker
92 32 arniml
  signal low_imp_q : std_logic;
93 4 arniml
 
94
  -- the expander register
95 23 arniml
  signal exp_q  : nibble_t;
96 4 arniml
 
97
begin
98
 
99
  -----------------------------------------------------------------------------
100
  -- Process p2_regs
101
  --
102
  -- Purpose:
103
  --   Implements the port output and expander registers.
104
  --
105
  p2_regs: process (res_i, clk_i)
106
  begin
107
    if res_i = res_active_c then
108 32 arniml
      p2_q          <= (others => '1');
109
      low_imp_q     <= '0';
110
      exp_q         <= (others => '0');
111 4 arniml
 
112
    elsif clk_i'event and clk_i = clk_active_c then
113
      if en_clk_i then
114
 
115
        if write_p2_i then
116 32 arniml
          p2_q      <= data_i;
117
          low_imp_q <= '1';
118 4 arniml
        else
119 32 arniml
          low_imp_q <= '0';
120 4 arniml
        end if;
121
 
122
        if write_exp_i then
123 32 arniml
          exp_q     <= data_i(exp_q'range);
124 4 arniml
        end if;
125
 
126
      end if;
127
 
128
    end if;
129
 
130
  end process p2_regs;
131
  --
132
  -----------------------------------------------------------------------------
133
 
134
 
135 23 arniml
  -----------------------------------------------------------------------------
136
  -- Process p2_port
137
  --
138
  -- Purpose:
139
  --   Generates the output byte vector for Port 2.
140
  --
141
  p2_port: process (p2_q,
142
                    exp_q,
143
                    output_exp_i,
144
                    pch_i,
145
                    output_pch_i)
146
  begin
147
    p2_o                   <= p2_q;
148 4 arniml
 
149 23 arniml
    if output_exp_i then
150
      p2_o(nibble_t'range) <= exp_q;
151
    end if;
152 4 arniml
 
153 23 arniml
    if output_pch_i then
154
      p2_o(nibble_t'range) <= pch_i;
155
    end if;
156
 
157
  end process p2_port;
158
  --
159 4 arniml
  -----------------------------------------------------------------------------
160 23 arniml
 
161
 
162
  -----------------------------------------------------------------------------
163
  -- Process p2_data
164
  --
165
  -- Purpose:
166
  --   Generates the T48 bus data.
167
  --
168
  p2_data: process (read_p2_i,
169
                    p2_i,
170
                    read_reg_i,
171
                    p2_q,
172
                    read_exp_i)
173
  begin
174
    data_o   <= (others => bus_idle_level_c);
175
 
176
    if read_p2_i then
177
      data_o <= p2_i;
178
    elsif read_reg_i then
179
      data_o <= p2_q;
180
    elsif read_exp_i then
181
      data_o <= "0000" & p2_i(nibble_t'range);
182
    end if;
183
 
184
  end process p2_data;
185
  --
186
  -----------------------------------------------------------------------------
187
 
188
 
189
  -----------------------------------------------------------------------------
190 4 arniml
  -- Output Mapping.
191
  -----------------------------------------------------------------------------
192 32 arniml
  p2_low_imp_o <= low_imp_q;
193 4 arniml
 
194
end rtl;
195
 
196
 
197
-------------------------------------------------------------------------------
198
-- File History:
199
--
200
-- $Log: not supported by cvs2svn $
201 32 arniml
-- Revision 1.2  2004/03/28 13:11:43  arniml
202
-- rework Port 2 expander handling
203
--
204 23 arniml
-- Revision 1.1  2004/03/23 21:31:53  arniml
205
-- initial check-in
206 4 arniml
--
207
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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