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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_6__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 179 arniml
-- $Id: p2.vhd,v 1.7 2005-06-11 10:08:43 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
    clk_i        : in  std_logic;
58
    res_i        : in  std_logic;
59
    en_clk_i     : in  boolean;
60
    -- T48 Bus Interface ------------------------------------------------------
61
    data_i       : in  word_t;
62
    data_o       : out word_t;
63
    write_p2_i   : in  boolean;
64
    write_exp_i  : in  boolean;
65
    read_p2_i    : in  boolean;
66
    read_reg_i   : in  boolean;
67 23 arniml
    read_exp_i   : in  boolean;
68 4 arniml
    -- Port 2 Interface -------------------------------------------------------
69
    output_pch_i : in  boolean;
70
    output_exp_i : in  boolean;
71
    pch_i        : in  nibble_t;
72
    p2_i         : in  word_t;
73
    p2_o         : out word_t;
74 32 arniml
    p2_low_imp_o : out std_logic
75 4 arniml
  );
76
 
77 179 arniml
end t48_p2;
78 4 arniml
 
79
 
80
use work.t48_pack.clk_active_c;
81
use work.t48_pack.res_active_c;
82
use work.t48_pack.bus_idle_level_c;
83
 
84 179 arniml
architecture rtl of t48_p2 is
85 4 arniml
 
86
  -- the port output register
87
  signal p2_q   : word_t;
88
 
89
  -- the low impedance marker
90 32 arniml
  signal low_imp_q : std_logic;
91 4 arniml
 
92
  -- the expander register
93 23 arniml
  signal exp_q  : nibble_t;
94 4 arniml
 
95
begin
96
 
97
  -----------------------------------------------------------------------------
98
  -- Process p2_regs
99
  --
100
  -- Purpose:
101
  --   Implements the port output and expander registers.
102
  --
103
  p2_regs: process (res_i, clk_i)
104
  begin
105
    if res_i = res_active_c then
106 32 arniml
      p2_q          <= (others => '1');
107
      low_imp_q     <= '0';
108
      exp_q         <= (others => '0');
109 4 arniml
 
110
    elsif clk_i'event and clk_i = clk_active_c then
111
      if en_clk_i then
112
 
113
        if write_p2_i then
114 32 arniml
          p2_q      <= data_i;
115
          low_imp_q <= '1';
116 4 arniml
        else
117 32 arniml
          low_imp_q <= '0';
118 4 arniml
        end if;
119
 
120
        if write_exp_i then
121 32 arniml
          exp_q     <= data_i(exp_q'range);
122 4 arniml
        end if;
123
 
124
      end if;
125
 
126
    end if;
127
 
128
  end process p2_regs;
129
  --
130
  -----------------------------------------------------------------------------
131
 
132
 
133 23 arniml
  -----------------------------------------------------------------------------
134
  -- Process p2_port
135
  --
136
  -- Purpose:
137
  --   Generates the output byte vector for Port 2.
138
  --
139
  p2_port: process (p2_q,
140
                    exp_q,
141
                    output_exp_i,
142
                    pch_i,
143
                    output_pch_i)
144
  begin
145
    p2_o                   <= p2_q;
146 4 arniml
 
147 23 arniml
    if output_exp_i then
148
      p2_o(nibble_t'range) <= exp_q;
149
    end if;
150 4 arniml
 
151 23 arniml
    if output_pch_i then
152
      p2_o(nibble_t'range) <= pch_i;
153
    end if;
154
 
155
  end process p2_port;
156
  --
157 4 arniml
  -----------------------------------------------------------------------------
158 23 arniml
 
159
 
160
  -----------------------------------------------------------------------------
161
  -- Process p2_data
162
  --
163
  -- Purpose:
164
  --   Generates the T48 bus data.
165
  --
166
  p2_data: process (read_p2_i,
167
                    p2_i,
168
                    read_reg_i,
169
                    p2_q,
170
                    read_exp_i)
171
  begin
172
    data_o   <= (others => bus_idle_level_c);
173
 
174
    if read_p2_i then
175 98 arniml
      if read_reg_i then
176
        data_o <= p2_q;
177
      elsif read_exp_i then
178
        data_o <= "0000" & p2_i(nibble_t'range);
179
      else
180
        data_o <= p2_i;
181
      end if;
182 23 arniml
    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 179 arniml
-- Revision 1.6  2004/07/11 16:51:33  arniml
202
-- cleanup copyright notice
203
--
204 129 arniml
-- Revision 1.5  2004/05/17 13:52:46  arniml
205
-- Fix bug "ANL and ORL to P1/P2 read port status instead of port output register"
206
--
207 98 arniml
-- Revision 1.4  2004/04/24 23:44:25  arniml
208
-- move from std_logic_arith to numeric_std
209
--
210 77 arniml
-- Revision 1.3  2004/03/29 19:39:58  arniml
211
-- rename pX_limp to pX_low_imp
212
--
213 32 arniml
-- Revision 1.2  2004/03/28 13:11:43  arniml
214
-- rework Port 2 expander handling
215
--
216 23 arniml
-- Revision 1.1  2004/03/23 21:31:53  arniml
217
-- initial check-in
218 4 arniml
--
219
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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