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

Subversion Repositories t400

[/] [t400/] [trunk/] [rtl/] [vhdl/] [t400_io_l.vhd] - Blame information for rev 179

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arniml
-------------------------------------------------------------------------------
2
--
3
-- The L port controller.
4
--
5 179 arniml
-- $Id: t400_io_l.vhd 179 2009-04-01 19:48:38Z arniml $
6 2 arniml
--
7
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org)
8
--
9
-- All rights reserved
10
--
11
-- Redistribution and use in source and synthezised forms, with or without
12
-- modification, are permitted provided that the following conditions are met:
13
--
14
-- Redistributions of source code must retain the above copyright notice,
15
-- this list of conditions and the following disclaimer.
16
--
17
-- Redistributions in synthesized form must reproduce the above copyright
18
-- notice, this list of conditions and the following disclaimer in the
19
-- documentation and/or other materials provided with the distribution.
20
--
21
-- Neither the name of the author nor the names of other contributors may
22
-- be used to endorse or promote products derived from this software without
23
-- specific prior written permission.
24
--
25
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
29
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
-- POSSIBILITY OF SUCH DAMAGE.
36
--
37
-- Please report bugs to the author, but before you do so, please
38
-- make sure that this is not a derivative work and that
39
-- you have the latest version of this file.
40
--
41
-- The latest version of this file can be found at:
42
--      http://www.opencores.org/cvsweb.shtml/t400/
43
--
44
-------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
 
49
use work.t400_opt_pack.all;
50
use work.t400_pack.all;
51
 
52
entity t400_io_l is
53
 
54
  generic (
55
    opt_out_type_7_g : integer := t400_opt_out_type_std_c;
56
    opt_out_type_6_g : integer := t400_opt_out_type_std_c;
57
    opt_out_type_5_g : integer := t400_opt_out_type_std_c;
58
    opt_out_type_4_g : integer := t400_opt_out_type_std_c;
59
    opt_out_type_3_g : integer := t400_opt_out_type_std_c;
60
    opt_out_type_2_g : integer := t400_opt_out_type_std_c;
61
    opt_out_type_1_g : integer := t400_opt_out_type_std_c;
62
    opt_out_type_0_g : integer := t400_opt_out_type_std_c;
63
    opt_microbus_g   : integer := t400_opt_no_microbus_c
64
  );
65
  port (
66
    -- System Interface -------------------------------------------------------
67
    ck_i      : in  std_logic;
68
    ck_en_i   : in  boolean;
69
    por_i     : in  boolean;
70 103 arniml
    in_en_i   : in  boolean;
71 2 arniml
    -- Control Interface ------------------------------------------------------
72
    op_i      : in  io_l_op_t;
73
    en2_i     : in  std_logic;
74
    m_i       : in  dw_t;
75
    a_i       : in  dw_t;
76
    pm_data_i : in  byte_t;
77
    q_o       : out byte_t;
78
    -- Microbus Interface -----------------------------------------------------
79
    cs_n_i    : in  std_logic;
80
    rd_n_i    : in  std_logic;
81
    wr_n_i    : in  std_logic;
82
    -- Port L Interface -------------------------------------------------------
83
    io_l_i    : in  byte_t;
84
    io_l_o    : out byte_t;
85
    io_l_en_o : out byte_t
86
  );
87
 
88
end t400_io_l;
89
 
90
 
91
use work.t400_io_pack.all;
92
 
93
architecture rtl of t400_io_l is
94
 
95
  signal q_q   : byte_t;
96
 
97
  signal en2_s : std_logic;
98
 
99
begin
100
 
101
  -----------------------------------------------------------------------------
102
  -- Process q_reg
103
  --
104
  -- Purpose:
105
  --   Implements the Q register.
106
  --
107
  q_reg: process (ck_i, por_i)
108
  begin
109
    if por_i then
110
      q_q <= (others => '0');
111
    elsif ck_i'event and ck_i = '1' then
112
      if ck_en_i then
113
        case op_i is
114
          -- Load Q from accumulator and data memory --------------------------
115
          when IOL_LOAD_AM =>
116
            q_q(7 downto 4) <= a_i;
117
            q_q(3 downto 0) <= m_i;
118
 
119
          -- Load Q from program memory ---------------------------------------
120
          when IOL_LOAD_PM =>
121
            q_q <= pm_data_i;
122
 
123
          when others =>
124
            null;
125
        end case;
126
      end if;
127
 
128
      -- Microbus functionality
129 114 arniml
      if opt_microbus_g = t400_opt_microbus_c and
130
         cs_n_i = '0' and wr_n_i = '0' then
131
        q_q <= to_X01(io_l_i);
132 2 arniml
      end if;
133
    end if;
134
  end process q_reg;
135
  --
136
  -----------------------------------------------------------------------------
137
 
138
 
139
  -----------------------------------------------------------------------------
140
  -- Multiplexer providing read data to the system.
141
  -----------------------------------------------------------------------------
142 54 arniml
  q_o <=   to_X01(io_l_i)
143 2 arniml
         when op_i = IOL_OUTPUT_L else
144
           q_q;
145
 
146
 
147
  -----------------------------------------------------------------------------
148
  -- Dedicated output enable when in Microbus mode
149
  -----------------------------------------------------------------------------
150
  en2_s <=   cs_n_i nor rd_n_i
151
           when opt_microbus_g = t400_opt_microbus_c else
152
             en2_i;
153
 
154
  -----------------------------------------------------------------------------
155
  -- Process out_driver
156
  --
157
  -- Purpose:
158
  --   Implements the output driver data and enable.
159
  --
160
  out_driver: process (en2_s,
161
                       q_q)
162
  begin
163
    -- bit 7
164
    io_l_o(7)    <= io_out_f(dat => q_q(7),
165
                             opt => opt_out_type_7_g);
166
    io_l_en_o(7) <= io_en_f (en  => en2_s, dat => q_q(7),
167
                             opt => opt_out_type_7_g);
168
 
169
    -- bit 6
170
    io_l_o(6)    <= io_out_f(dat => q_q(6),
171
                             opt => opt_out_type_6_g);
172
    io_l_en_o(6) <= io_en_f (en  => en2_s, dat => q_q(6),
173
                             opt => opt_out_type_6_g);
174
 
175
    -- bit 5
176
    io_l_o(5)    <= io_out_f(dat => q_q(5),
177
                             opt => opt_out_type_5_g);
178
    io_l_en_o(5) <= io_en_f (en  => en2_s, dat => q_q(5),
179
                             opt => opt_out_type_5_g);
180
 
181
    -- bit 4
182
    io_l_o(4)    <= io_out_f(dat => q_q(4),
183
                             opt => opt_out_type_4_g);
184
    io_l_en_o(4) <= io_en_f (en  => en2_s, dat => q_q(4),
185
                             opt => opt_out_type_4_g);
186
 
187
    -- bit 3
188
    io_l_o(3)    <= io_out_f(dat => q_q(3),
189
                             opt => opt_out_type_3_g);
190
    io_l_en_o(3) <= io_en_f (en  => en2_s, dat => q_q(3),
191
                             opt => opt_out_type_3_g);
192
 
193
    -- bit 2
194
    io_l_o(2)    <= io_out_f(dat => q_q(2),
195
                             opt => opt_out_type_2_g);
196
    io_l_en_o(2) <= io_en_f (en  => en2_s, dat => q_q(2),
197
                             opt => opt_out_type_2_g);
198
 
199
    -- bit 1
200
    io_l_o(1)    <= io_out_f(dat => q_q(1),
201
                             opt => opt_out_type_1_g);
202
    io_l_en_o(1) <= io_en_f (en  => en2_s, dat => q_q(1),
203
                             opt => opt_out_type_1_g);
204
 
205
    -- bit 0
206
    io_l_o(0)    <= io_out_f(dat => q_q(0),
207
                             opt => opt_out_type_0_g);
208
    io_l_en_o(0) <= io_en_f (en  => en2_s, dat => q_q(0),
209
                             opt => opt_out_type_0_g);
210
 
211
  end process out_driver;
212
  --
213
  -----------------------------------------------------------------------------
214
 
215
end rtl;

powered by: WebSVN 2.1.0

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