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 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 220 arniml
-- $Id: p2.vhd,v 1.9 2006-06-20 00:46:04 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 220 arniml
    xtal_en_i     : in  boolean;
62 4 arniml
    -- T48 Bus Interface ------------------------------------------------------
63 206 arniml
    data_i        : in  word_t;
64
    data_o        : out word_t;
65
    write_p2_i    : in  boolean;
66
    write_exp_i   : in  boolean;
67
    read_p2_i     : in  boolean;
68
    read_reg_i    : in  boolean;
69
    read_exp_i    : in  boolean;
70 4 arniml
    -- Port 2 Interface -------------------------------------------------------
71 206 arniml
    output_pch_i  : in  boolean;
72
    pch_i         : in  nibble_t;
73
    p2_i          : in  word_t;
74
    p2_o          : out word_t;
75
    p2l_low_imp_o : out std_logic;
76
    p2h_low_imp_o : out std_logic
77 4 arniml
  );
78
 
79 179 arniml
end t48_p2;
80 4 arniml
 
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 179 arniml
architecture rtl of t48_p2 is
87 4 arniml
 
88
  -- the port output register
89
  signal p2_q   : word_t;
90
 
91 206 arniml
  -- the low impedance markers
92
  signal l_low_imp_q,
93
         h_low_imp_q      : std_logic;
94 4 arniml
 
95 206 arniml
  signal en_clk_q         : boolean;
96
  signal l_low_imp_del_q,
97
         h_low_imp_del_q  : std_logic;
98
  signal output_pch_q     : boolean;
99 4 arniml
 
100
begin
101
 
102
  -----------------------------------------------------------------------------
103
  -- Process p2_regs
104
  --
105
  -- Purpose:
106
  --   Implements the port output and expander registers.
107
  --
108
  p2_regs: process (res_i, clk_i)
109
  begin
110
    if res_i = res_active_c then
111 32 arniml
      p2_q          <= (others => '1');
112 206 arniml
      l_low_imp_q   <= '0';
113
      h_low_imp_q   <= '0';
114 4 arniml
 
115
    elsif clk_i'event and clk_i = clk_active_c then
116
      if en_clk_i then
117 206 arniml
        -- default: reset low impedance marker
118
        l_low_imp_q <= '0';
119
        h_low_imp_q <= '0';
120 4 arniml
 
121
        if write_p2_i then
122 206 arniml
          -- write whole P2
123
          p2_q        <= data_i;
124
          l_low_imp_q <= '1';
125
          h_low_imp_q <= '1';
126 4 arniml
 
127 206 arniml
        elsif write_exp_i then
128
          -- write lower nibble of P2
129
          p2_q(nibble_t'range) <= data_i(nibble_t'range);
130
          l_low_imp_q          <= '1';
131
 
132 4 arniml
        end if;
133
 
134
      end if;
135
 
136
    end if;
137
 
138
  end process p2_regs;
139
  --
140
  -----------------------------------------------------------------------------
141
 
142
 
143 23 arniml
  -----------------------------------------------------------------------------
144
  -- Process p2_port
145
  --
146
  -- Purpose:
147
  --   Generates the output byte vector for Port 2.
148 206 arniml
  --   It is a synchronous process clocked with XTAL. This ensures that
149
  --   P2 data and low impedance markers are free of glitches and stabilize
150
  --   during the same clock/machine state.
151
  --   On the other hand, P2 is delayed by 1 XTAL cycle.
152 23 arniml
  --
153 206 arniml
  p2_port: process (res_i, xtal_i)
154 23 arniml
  begin
155 206 arniml
    if res_i = res_active_c then
156
      p2_o            <= (others => '1');
157
      l_low_imp_del_q <= '0';
158
      h_low_imp_del_q <= '0';
159
      output_pch_q    <= false;
160
      en_clk_q        <= false;
161 4 arniml
 
162 206 arniml
    elsif xtal_i'event and xtal_i = clk_active_c then
163 220 arniml
      if xtal_en_i then
164
        -- delay clock enable by one XTAL period
165
        en_clk_q               <= en_clk_i;
166 4 arniml
 
167 220 arniml
        p2_o                   <= p2_q;
168
        output_pch_q           <= output_pch_i;
169 206 arniml
 
170 220 arniml
        if output_pch_i then
171
          p2_o(nibble_t'range) <= pch_i;
172
        end if;
173 206 arniml
 
174 220 arniml
        -- generate low impedance trigger for one XTAL clock period after
175
        -- global clock enable when
176
        -- a) switching to or from PCH
177
        -- b) l_low_imp_q is active
178
        if en_clk_q and
179
          ((output_pch_q xor output_pch_i) or
180
           l_low_imp_q = '1') then
181
          l_low_imp_del_q <= '1';
182
        else
183
          l_low_imp_del_q <= '0';
184
        end if;
185 206 arniml
 
186 220 arniml
        -- generate low impedance trigger for on XTAL clock period after
187
        -- global clock enable when
188
        -- h_low_imp_q is active
189
        if en_clk_q and
190
          h_low_imp_q = '1' then
191
          h_low_imp_del_q <= '1';
192
        else
193
          h_low_imp_del_q <= '0';
194
        end if;
195
 
196 206 arniml
      end if;
197 23 arniml
    end if;
198
  end process p2_port;
199
  --
200 4 arniml
  -----------------------------------------------------------------------------
201 23 arniml
 
202
 
203
  -----------------------------------------------------------------------------
204
  -- Process p2_data
205
  --
206
  -- Purpose:
207
  --   Generates the T48 bus data.
208
  --
209
  p2_data: process (read_p2_i,
210
                    p2_i,
211
                    read_reg_i,
212
                    p2_q,
213
                    read_exp_i)
214
  begin
215
    data_o   <= (others => bus_idle_level_c);
216
 
217
    if read_p2_i then
218 98 arniml
      if read_reg_i then
219
        data_o <= p2_q;
220
      elsif read_exp_i then
221
        data_o <= "0000" & p2_i(nibble_t'range);
222
      else
223
        data_o <= p2_i;
224
      end if;
225 23 arniml
    end if;
226
 
227
  end process p2_data;
228
  --
229
  -----------------------------------------------------------------------------
230
 
231
 
232
  -----------------------------------------------------------------------------
233 4 arniml
  -- Output Mapping.
234
  -----------------------------------------------------------------------------
235 206 arniml
  p2l_low_imp_o <= l_low_imp_del_q;
236
  p2h_low_imp_o <= h_low_imp_del_q;
237 4 arniml
 
238
end rtl;
239
 
240
 
241
-------------------------------------------------------------------------------
242
-- File History:
243
--
244
-- $Log: not supported by cvs2svn $
245 220 arniml
-- Revision 1.8  2005/11/01 21:27:55  arniml
246
-- * change low impedance markers for P2
247
--   separate marker for low and high part
248
-- * p2_o output is also registered to prevent combinational
249
--   output to pads
250
--
251 206 arniml
-- Revision 1.7  2005/06/11 10:08:43  arniml
252
-- introduce prefix 't48_' for all packages, entities and configurations
253
--
254 179 arniml
-- Revision 1.6  2004/07/11 16:51:33  arniml
255
-- cleanup copyright notice
256
--
257 129 arniml
-- Revision 1.5  2004/05/17 13:52:46  arniml
258
-- Fix bug "ANL and ORL to P1/P2 read port status instead of port output register"
259
--
260 98 arniml
-- Revision 1.4  2004/04/24 23:44:25  arniml
261
-- move from std_logic_arith to numeric_std
262
--
263 77 arniml
-- Revision 1.3  2004/03/29 19:39:58  arniml
264
-- rename pX_limp to pX_low_imp
265
--
266 32 arniml
-- Revision 1.2  2004/03/28 13:11:43  arniml
267
-- rework Port 2 expander handling
268
--
269 23 arniml
-- Revision 1.1  2004/03/23 21:31:53  arniml
270
-- initial check-in
271 4 arniml
--
272
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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