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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_2_beta/] [rtl/] [vhdl/] [p2.vhd] - Blame information for rev 294

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 98 arniml
-- $Id: p2.vhd,v 1.5 2004-05-17 13:52:46 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
use work.t48_pack.clk_active_c;
79
use work.t48_pack.res_active_c;
80
use work.t48_pack.bus_idle_level_c;
81
 
82
architecture rtl of p2 is
83
 
84
  -- the port output register
85
  signal p2_q   : word_t;
86
 
87
  -- the low impedance marker
88 32 arniml
  signal low_imp_q : std_logic;
89 4 arniml
 
90
  -- the expander register
91 23 arniml
  signal exp_q  : nibble_t;
92 4 arniml
 
93
begin
94
 
95
  -----------------------------------------------------------------------------
96
  -- Process p2_regs
97
  --
98
  -- Purpose:
99
  --   Implements the port output and expander registers.
100
  --
101
  p2_regs: process (res_i, clk_i)
102
  begin
103
    if res_i = res_active_c then
104 32 arniml
      p2_q          <= (others => '1');
105
      low_imp_q     <= '0';
106
      exp_q         <= (others => '0');
107 4 arniml
 
108
    elsif clk_i'event and clk_i = clk_active_c then
109
      if en_clk_i then
110
 
111
        if write_p2_i then
112 32 arniml
          p2_q      <= data_i;
113
          low_imp_q <= '1';
114 4 arniml
        else
115 32 arniml
          low_imp_q <= '0';
116 4 arniml
        end if;
117
 
118
        if write_exp_i then
119 32 arniml
          exp_q     <= data_i(exp_q'range);
120 4 arniml
        end if;
121
 
122
      end if;
123
 
124
    end if;
125
 
126
  end process p2_regs;
127
  --
128
  -----------------------------------------------------------------------------
129
 
130
 
131 23 arniml
  -----------------------------------------------------------------------------
132
  -- Process p2_port
133
  --
134
  -- Purpose:
135
  --   Generates the output byte vector for Port 2.
136
  --
137
  p2_port: process (p2_q,
138
                    exp_q,
139
                    output_exp_i,
140
                    pch_i,
141
                    output_pch_i)
142
  begin
143
    p2_o                   <= p2_q;
144 4 arniml
 
145 23 arniml
    if output_exp_i then
146
      p2_o(nibble_t'range) <= exp_q;
147
    end if;
148 4 arniml
 
149 23 arniml
    if output_pch_i then
150
      p2_o(nibble_t'range) <= pch_i;
151
    end if;
152
 
153
  end process p2_port;
154
  --
155 4 arniml
  -----------------------------------------------------------------------------
156 23 arniml
 
157
 
158
  -----------------------------------------------------------------------------
159
  -- Process p2_data
160
  --
161
  -- Purpose:
162
  --   Generates the T48 bus data.
163
  --
164
  p2_data: process (read_p2_i,
165
                    p2_i,
166
                    read_reg_i,
167
                    p2_q,
168
                    read_exp_i)
169
  begin
170
    data_o   <= (others => bus_idle_level_c);
171
 
172
    if read_p2_i then
173 98 arniml
      if read_reg_i then
174
        data_o <= p2_q;
175
      elsif read_exp_i then
176
        data_o <= "0000" & p2_i(nibble_t'range);
177
      else
178
        data_o <= p2_i;
179
      end if;
180 23 arniml
    end if;
181
 
182
  end process p2_data;
183
  --
184
  -----------------------------------------------------------------------------
185
 
186
 
187
  -----------------------------------------------------------------------------
188 4 arniml
  -- Output Mapping.
189
  -----------------------------------------------------------------------------
190 32 arniml
  p2_low_imp_o <= low_imp_q;
191 4 arniml
 
192
end rtl;
193
 
194
 
195
-------------------------------------------------------------------------------
196
-- File History:
197
--
198
-- $Log: not supported by cvs2svn $
199 98 arniml
-- Revision 1.4  2004/04/24 23:44:25  arniml
200
-- move from std_logic_arith to numeric_std
201
--
202 77 arniml
-- Revision 1.3  2004/03/29 19:39:58  arniml
203
-- rename pX_limp to pX_low_imp
204
--
205 32 arniml
-- Revision 1.2  2004/03/28 13:11:43  arniml
206
-- rework Port 2 expander handling
207
--
208 23 arniml
-- Revision 1.1  2004/03/23 21:31:53  arniml
209
-- initial check-in
210 4 arniml
--
211
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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