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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_6_1_beta/] [rtl/] [vhdl/] [p2.vhd] - Blame information for rev 292

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 206 arniml
-- $Id: p2.vhd,v 1.8 2005-11-01 21:27:55 arniml Exp $
7 4 arniml
--
8 129 arniml
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
9
--
10 4 arniml
-- All rights reserved
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/cvsweb.shtml/t48/
44
--
45
-------------------------------------------------------------------------------
46
 
47
library ieee;
48
use ieee.std_logic_1164.all;
49
 
50
use work.t48_pack.word_t;
51
use work.t48_pack.nibble_t;
52
 
53 179 arniml
entity t48_p2 is
54 4 arniml
 
55
  port (
56
    -- Global Interface -------------------------------------------------------
57 206 arniml
    clk_i         : in  std_logic;
58
    res_i         : in  std_logic;
59
    en_clk_i      : in  boolean;
60
    xtal_i        : in  std_logic;
61 4 arniml
    -- T48 Bus Interface ------------------------------------------------------
62 206 arniml
    data_i        : in  word_t;
63
    data_o        : out word_t;
64
    write_p2_i    : in  boolean;
65
    write_exp_i   : in  boolean;
66
    read_p2_i     : in  boolean;
67
    read_reg_i    : in  boolean;
68
    read_exp_i    : in  boolean;
69 4 arniml
    -- Port 2 Interface -------------------------------------------------------
70 206 arniml
    output_pch_i  : in  boolean;
71
    pch_i         : in  nibble_t;
72
    p2_i          : in  word_t;
73
    p2_o          : out word_t;
74
    p2l_low_imp_o : out std_logic;
75
    p2h_low_imp_o : out std_logic
76 4 arniml
  );
77
 
78 179 arniml
end t48_p2;
79 4 arniml
 
80
 
81
use work.t48_pack.clk_active_c;
82
use work.t48_pack.res_active_c;
83
use work.t48_pack.bus_idle_level_c;
84
 
85 179 arniml
architecture rtl of t48_p2 is
86 4 arniml
 
87
  -- the port output register
88
  signal p2_q   : word_t;
89
 
90 206 arniml
  -- the low impedance markers
91
  signal l_low_imp_q,
92
         h_low_imp_q      : std_logic;
93 4 arniml
 
94 206 arniml
  signal en_clk_q         : boolean;
95
  signal l_low_imp_del_q,
96
         h_low_imp_del_q  : std_logic;
97
  signal output_pch_q     : boolean;
98 4 arniml
 
99
begin
100
 
101
  -----------------------------------------------------------------------------
102
  -- Process p2_regs
103
  --
104
  -- Purpose:
105
  --   Implements the port output and expander registers.
106
  --
107
  p2_regs: process (res_i, clk_i)
108
  begin
109
    if res_i = res_active_c then
110 32 arniml
      p2_q          <= (others => '1');
111 206 arniml
      l_low_imp_q   <= '0';
112
      h_low_imp_q   <= '0';
113 4 arniml
 
114
    elsif clk_i'event and clk_i = clk_active_c then
115
      if en_clk_i then
116 206 arniml
        -- default: reset low impedance marker
117
        l_low_imp_q <= '0';
118
        h_low_imp_q <= '0';
119 4 arniml
 
120
        if write_p2_i then
121 206 arniml
          -- write whole P2
122
          p2_q        <= data_i;
123
          l_low_imp_q <= '1';
124
          h_low_imp_q <= '1';
125 4 arniml
 
126 206 arniml
        elsif write_exp_i then
127
          -- write lower nibble of P2
128
          p2_q(nibble_t'range) <= data_i(nibble_t'range);
129
          l_low_imp_q          <= '1';
130
 
131 4 arniml
        end if;
132
 
133
      end if;
134
 
135
    end if;
136
 
137
  end process p2_regs;
138
  --
139
  -----------------------------------------------------------------------------
140
 
141
 
142 23 arniml
  -----------------------------------------------------------------------------
143
  -- Process p2_port
144
  --
145
  -- Purpose:
146
  --   Generates the output byte vector for Port 2.
147 206 arniml
  --   It is a synchronous process clocked with XTAL. This ensures that
148
  --   P2 data and low impedance markers are free of glitches and stabilize
149
  --   during the same clock/machine state.
150
  --   On the other hand, P2 is delayed by 1 XTAL cycle.
151 23 arniml
  --
152 206 arniml
  p2_port: process (res_i, xtal_i)
153 23 arniml
  begin
154 206 arniml
    if res_i = res_active_c then
155
      p2_o            <= (others => '1');
156
      l_low_imp_del_q <= '0';
157
      h_low_imp_del_q <= '0';
158
      output_pch_q    <= false;
159
      en_clk_q        <= false;
160 4 arniml
 
161 206 arniml
    elsif xtal_i'event and xtal_i = clk_active_c then
162
      -- delay clock enable by one XTAL period
163
      en_clk_q               <= en_clk_i;
164 4 arniml
 
165 206 arniml
      p2_o                   <= p2_q;
166
      output_pch_q           <= output_pch_i;
167
 
168
      if output_pch_i then
169
        p2_o(nibble_t'range) <= pch_i;
170
      end if;
171
 
172
      -- generate low impedance trigger for one XTAL clock period after
173
      -- global clock enable when
174
      -- a) switching to or from PCH
175
      -- b) l_low_imp_q is active
176
      if en_clk_q and
177
         ((output_pch_q xor output_pch_i) or
178
          l_low_imp_q = '1') then
179
        l_low_imp_del_q <= '1';
180
      else
181
        l_low_imp_del_q <= '0';
182
      end if;
183
 
184
      -- generate low impedance trigger for on XTAL clock period after
185
      -- global clock enable when
186
      -- h_low_imp_q is active
187
      if en_clk_q and
188
         h_low_imp_q = '1' then
189
        h_low_imp_del_q <= '1';
190
      else
191
        h_low_imp_del_q <= '0';
192
      end if;
193
 
194 23 arniml
    end if;
195
 
196
  end process p2_port;
197
  --
198 4 arniml
  -----------------------------------------------------------------------------
199 23 arniml
 
200
 
201
  -----------------------------------------------------------------------------
202
  -- Process p2_data
203
  --
204
  -- Purpose:
205
  --   Generates the T48 bus data.
206
  --
207
  p2_data: process (read_p2_i,
208
                    p2_i,
209
                    read_reg_i,
210
                    p2_q,
211
                    read_exp_i)
212
  begin
213
    data_o   <= (others => bus_idle_level_c);
214
 
215
    if read_p2_i then
216 98 arniml
      if read_reg_i then
217
        data_o <= p2_q;
218
      elsif read_exp_i then
219
        data_o <= "0000" & p2_i(nibble_t'range);
220
      else
221
        data_o <= p2_i;
222
      end if;
223 23 arniml
    end if;
224
 
225
  end process p2_data;
226
  --
227
  -----------------------------------------------------------------------------
228
 
229
 
230
  -----------------------------------------------------------------------------
231 4 arniml
  -- Output Mapping.
232
  -----------------------------------------------------------------------------
233 206 arniml
  p2l_low_imp_o <= l_low_imp_del_q;
234
  p2h_low_imp_o <= h_low_imp_del_q;
235 4 arniml
 
236
end rtl;
237
 
238
 
239
-------------------------------------------------------------------------------
240
-- File History:
241
--
242
-- $Log: not supported by cvs2svn $
243 206 arniml
-- Revision 1.7  2005/06/11 10:08:43  arniml
244
-- introduce prefix 't48_' for all packages, entities and configurations
245
--
246 179 arniml
-- Revision 1.6  2004/07/11 16:51:33  arniml
247
-- cleanup copyright notice
248
--
249 129 arniml
-- Revision 1.5  2004/05/17 13:52:46  arniml
250
-- Fix bug "ANL and ORL to P1/P2 read port status instead of port output register"
251
--
252 98 arniml
-- Revision 1.4  2004/04/24 23:44:25  arniml
253
-- move from std_logic_arith to numeric_std
254
--
255 77 arniml
-- Revision 1.3  2004/03/29 19:39:58  arniml
256
-- rename pX_limp to pX_low_imp
257
--
258 32 arniml
-- Revision 1.2  2004/03/28 13:11:43  arniml
259
-- rework Port 2 expander handling
260
--
261 23 arniml
-- Revision 1.1  2004/03/23 21:31:53  arniml
262
-- initial check-in
263 4 arniml
--
264
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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