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

Subversion Repositories t48

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 arniml
-------------------------------------------------------------------------------
2
--
3
-- T8048 Microcontroller System
4
--
5 213 arniml
-- $Id: t8048.vhd,v 1.9 2005-11-02 23:41:43 arniml Exp $
6 7 arniml
--
7
-- Copyright (c) 2004, 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/t48/
43
--
44
-------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
 
49
entity t8048 is
50
 
51
  port (
52
    xtal_i    : in    std_logic;
53
    reset_n_i : in    std_logic;
54
    t0_b      : inout std_logic;
55
    int_n_i   : in    std_logic;
56
    ea_i      : in    std_logic;
57
    rd_n_o    : out   std_logic;
58
    psen_n_o  : out   std_logic;
59
    wr_n_o    : out   std_logic;
60
    ale_o     : out   std_logic;
61
    db_b      : inout std_logic_vector( 7 downto 0);
62
    t1_i      : in    std_logic;
63
    p2_b      : inout std_logic_vector( 7 downto 0);
64
    p1_b      : inout std_logic_vector( 7 downto 0);
65
    prog_n_o  : out   std_logic
66
  );
67
 
68
end t8048;
69
 
70
 
71 108 arniml
library ieee;
72
use ieee.numeric_std.all;
73
 
74 150 arniml
use work.t48_system_comp_pack.t8048_notri;
75 7 arniml
 
76
architecture struct of t8048 is
77
 
78
  signal t0_s             : std_logic;
79
  signal t0_dir_s         : std_logic;
80
  signal db_s             : std_logic_vector( 7 downto 0);
81
  signal db_dir_s         : std_logic;
82
  signal p2_s             : std_logic_vector( 7 downto 0);
83 211 arniml
  signal p2l_low_imp_s    : std_logic;
84
  signal p2h_low_imp_s    : std_logic;
85 7 arniml
  signal p1_s             : std_logic_vector( 7 downto 0);
86 32 arniml
  signal p1_low_imp_s     : std_logic;
87 7 arniml
 
88
begin
89
 
90 150 arniml
  t8048_notri_b : t8048_notri
91 153 arniml
    generic map (
92
      -- we don't need explicit gating of input ports
93
      -- this is done implicitely by the bidirectional pads
94
      gate_port_input_g => 0
95
    )
96
 
97 7 arniml
    port map (
98 211 arniml
      xtal_i        => xtal_i,
99
      reset_n_i     => reset_n_i,
100
      t0_i          => t0_b,
101
      t0_o          => t0_s,
102
      t0_dir_o      => t0_dir_s,
103
      int_n_i       => int_n_i,
104
      ea_i          => ea_i,
105
      rd_n_o        => rd_n_o,
106
      psen_n_o      => psen_n_o,
107
      wr_n_o        => wr_n_o,
108
      ale_o         => ale_o,
109
      db_i          => db_b,
110
      db_o          => db_s,
111
      db_dir_o      => db_dir_s,
112
      t1_i          => t1_i,
113
      p2_i          => p2_b,
114
      p2_o          => p2_s,
115
      p2l_low_imp_o => p2l_low_imp_s,
116
      p2h_low_imp_o => p2h_low_imp_s,
117
      p1_i          => p1_b,
118
      p1_o          => p1_s,
119
      p1_low_imp_o  => p1_low_imp_s,
120
      prog_n_o      => prog_n_o
121 7 arniml
    );
122
 
123
  -----------------------------------------------------------------------------
124
  -- Process bidirs
125
  --
126
  -- Purpose:
127
  --   Assign bidirectional signals.
128
  --
129
  bidirs: process (t0_b, t0_s, t0_dir_s,
130
                   db_b, db_s, db_dir_s,
131 32 arniml
                   p1_b, p1_s, p1_low_imp_s,
132 211 arniml
                   p2_b, p2_s, p2l_low_imp_s, p2h_low_imp_s)
133 7 arniml
 
134 213 arniml
    function port_bidir_f(port_value : in std_logic_vector;
135
                          low_imp    : in std_logic) return std_logic_vector is
136
      variable result_v : std_logic_vector(port_value'range);
137 7 arniml
    begin
138 213 arniml
      for idx in port_value'high downto port_value'low loop
139
        if low_imp = '1' then
140
          result_v(idx) := port_value(idx);
141
        elsif port_value(idx) = '0' then
142
          result_v(idx) := '0';
143
        else
144
          result_v(idx) := 'Z';
145
        end if;
146
      end loop;
147 7 arniml
 
148 213 arniml
      return result_v;
149 7 arniml
    end;
150
 
151
  begin
152
    -- Test 0 -----------------------------------------------------------------
153
    if t0_dir_s = '1' then
154
      t0_b <= t0_s;
155
    else
156
      t0_b <= 'Z';
157
    end if;
158
 
159
    -- Data Bus ---------------------------------------------------------------
160
    if db_dir_s = '1' then
161
      db_b <= db_s;
162
    else
163
      db_b <= (others => 'Z');
164
    end if;
165
 
166
    -- Port 1 -----------------------------------------------------------------
167 213 arniml
    p1_b <= port_bidir_f(port_value => p1_s,
168
                         low_imp => p1_low_imp_s);
169 7 arniml
 
170
    -- Port 2 -----------------------------------------------------------------
171 213 arniml
    p2_b(3 downto 0) <= port_bidir_f(port_value => p2_s(3 downto 0),
172
                                     low_imp    => p2l_low_imp_s);
173
    p2_b(7 downto 4) <= port_bidir_f(port_value => p2_s(7 downto 4),
174
                                     low_imp    => p2h_low_imp_s);
175 7 arniml
 
176
  end process bidirs;
177
  --
178
  -----------------------------------------------------------------------------
179
 
180 108 arniml
 
181 7 arniml
end struct;
182
 
183
 
184
-------------------------------------------------------------------------------
185
-- File History:
186
--
187
-- $Log: not supported by cvs2svn $
188 213 arniml
-- Revision 1.8  2005/11/01 21:38:31  arniml
189
-- wire signals for P2 low impedance marker issue
190
--
191 211 arniml
-- Revision 1.7  2004/12/03 19:44:36  arniml
192
-- removed obsolete constant
193
--
194 157 arniml
-- Revision 1.6  2004/12/02 22:08:42  arniml
195
-- introduced generic gate_port_input_g
196
-- forces masking of P1 and P2 input bus
197
--
198 153 arniml
-- Revision 1.5  2004/12/01 23:09:47  arniml
199
-- intruduced hierarchy t8048_notri where all system functionality
200
-- except bidirectional ports is handled
201
--
202 150 arniml
-- Revision 1.4  2004/10/24 09:10:16  arniml
203
-- Fix for:
204
-- P1 constantly in push-pull mode in t8048
205
--
206 138 arniml
-- Revision 1.3  2004/05/20 21:58:26  arniml
207
-- Fix for:
208
-- External Program Memory ignored when EA = 0
209
--
210 108 arniml
-- Revision 1.2  2004/03/29 19:40:14  arniml
211
-- rename pX_limp to pX_low_imp
212
--
213 32 arniml
-- Revision 1.1  2004/03/24 21:32:27  arniml
214
-- initial check-in
215
--
216 7 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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