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 4

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
-- $Id: p2.vhd,v 1.1 2004-03-23 21:31:53 arniml Exp $
7
--
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
    -- Port 2 Interface -------------------------------------------------------
66
    output_pch_i : in  boolean;
67
    output_exp_i : in  boolean;
68
    pch_i        : in  nibble_t;
69
    p2_i         : in  word_t;
70
    p2_o         : out word_t;
71
    p2_limp_o    : out std_logic
72
  );
73
 
74
end p2;
75
 
76
 
77
library ieee;
78
use ieee.std_logic_arith.conv_integer;
79
use ieee.std_logic_arith.unsigned;
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
architecture rtl of p2 is
86
 
87
  subtype exp_t  is std_logic_vector(1 downto 0);
88
 
89
  -- 8243 expander address mapping
90
  type     exp_array_t is array (3 downto 0) of nibble_t;
91
  constant exp_c : exp_array_t := ("0100", "0101", "0110", "0111");
92
 
93
  -- the port output register
94
  signal p2_q   : word_t;
95
 
96
  -- the low impedance marker
97
  signal limp_q : std_logic;
98
 
99
  -- the expander register
100
  signal exp_q  : exp_t;
101
  signal exp_s  : nibble_t;
102
 
103
begin
104
 
105
  -----------------------------------------------------------------------------
106
  -- Process p2_regs
107
  --
108
  -- Purpose:
109
  --   Implements the port output and expander registers.
110
  --
111
  p2_regs: process (res_i, clk_i)
112
  begin
113
    if res_i = res_active_c then
114
      p2_q     <= (others => '1');
115
      limp_q   <= '0';
116
      exp_q    <= (others => '0');
117
 
118
    elsif clk_i'event and clk_i = clk_active_c then
119
      if en_clk_i then
120
 
121
        if write_p2_i then
122
          p2_q   <= data_i;
123
          limp_q <= '1';
124
        else
125
          limp_q <= '0';
126
        end if;
127
 
128
        if write_exp_i then
129
          exp_q  <= data_i(exp_q'range);
130
        end if;
131
 
132
      end if;
133
 
134
    end if;
135
 
136
  end process p2_regs;
137
  --
138
  -----------------------------------------------------------------------------
139
 
140
 
141
  exp_s <= exp_c(conv_integer(unsigned(exp_q)));
142
 
143
 
144
  -----------------------------------------------------------------------------
145
  -- Output Mapping.
146
  -----------------------------------------------------------------------------
147
  p2_o      <=   "0000" & exp_s
148
               when output_exp_i else
149
                 "0000" & pch_i
150
               when output_pch_i else
151
                 p2_q;
152
  p2_limp_o <= limp_q;
153
 
154
  data_o    <=   (others => bus_idle_level_c)
155
               when not read_p2_i else
156
                 p2_q
157
               when read_reg_i else
158
                 p2_i;
159
 
160
end rtl;
161
 
162
 
163
-------------------------------------------------------------------------------
164
-- File History:
165
--
166
-- $Log: not supported by cvs2svn $
167
--
168
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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