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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_0/] [rtl/] [vhdl/] [system/] [t8039.vhd] - Blame information for rev 220

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 62 arniml
-------------------------------------------------------------------------------
2
--
3
-- T8039 Microcontroller System
4
--
5 220 arniml
-- $Id: t8039.vhd,v 1.6 2006-06-20 00:47:08 arniml Exp $
6 62 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 t8039 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 t8039;
69
 
70
 
71 156 arniml
use work.t48_system_comp_pack.t8039_notri;
72 62 arniml
 
73
architecture struct of t8039 is
74
 
75
  signal t0_s             : std_logic;
76
  signal t0_dir_s         : std_logic;
77
  signal db_s             : std_logic_vector( 7 downto 0);
78
  signal db_dir_s         : std_logic;
79
  signal p2_s             : std_logic_vector( 7 downto 0);
80 211 arniml
  signal p2l_low_imp_s    : std_logic;
81
  signal p2h_low_imp_s    : std_logic;
82 62 arniml
  signal p1_s             : std_logic_vector( 7 downto 0);
83
  signal p1_low_imp_s     : std_logic;
84
 
85 220 arniml
  signal vdd_s            : std_logic;
86
 
87 62 arniml
begin
88
 
89 220 arniml
  vdd_s <= '1';
90
 
91 156 arniml
  t8039_notri_b : t8039_notri
92 62 arniml
    generic map (
93 156 arniml
      -- we don't need explicit gating of input ports
94
      -- this is done implicitely by the bidirectional pads
95
      gate_port_input_g => 0
96 62 arniml
    )
97 156 arniml
 
98 62 arniml
    port map (
99 211 arniml
      xtal_i        => xtal_i,
100 220 arniml
      xtal_en_i     => vdd_s,
101 211 arniml
      reset_n_i     => reset_n_i,
102
      t0_i          => t0_b,
103
      t0_o          => t0_s,
104
      t0_dir_o      => t0_dir_s,
105
      int_n_i       => int_n_i,
106
      ea_i          => ea_i,
107
      rd_n_o        => rd_n_o,
108
      psen_n_o      => psen_n_o,
109
      wr_n_o        => wr_n_o,
110
      ale_o         => ale_o,
111
      db_i          => db_b,
112
      db_o          => db_s,
113
      db_dir_o      => db_dir_s,
114
      t1_i          => t1_i,
115
      p2_i          => p2_b,
116
      p2_o          => p2_s,
117
      p2l_low_imp_o => p2l_low_imp_s,
118
      p2h_low_imp_o => p2h_low_imp_s,
119
      p1_i          => p1_b,
120
      p1_o          => p1_s,
121
      p1_low_imp_o  => p1_low_imp_s,
122
      prog_n_o      => prog_n_o
123 62 arniml
    );
124
 
125
  -----------------------------------------------------------------------------
126
  -- Process bidirs
127
  --
128
  -- Purpose:
129
  --   Assign bidirectional signals.
130
  --
131
  bidirs: process (t0_b, t0_s, t0_dir_s,
132
                   db_b, db_s, db_dir_s,
133
                   p1_b, p1_s, p1_low_imp_s,
134 211 arniml
                   p2_b, p2_s, p2l_low_imp_s, p2h_low_imp_s)
135 62 arniml
 
136 213 arniml
    function port_bidir_f(port_value : in std_logic_vector;
137
                          low_imp    : in std_logic) return std_logic_vector is
138
      variable result_v : std_logic_vector(port_value'range);
139 62 arniml
    begin
140 213 arniml
      for idx in port_value'high downto port_value'low loop
141
        if low_imp = '1' then
142
          result_v(idx) := port_value(idx);
143
        elsif port_value(idx) = '0' then
144
          result_v(idx) := '0';
145
        else
146
          result_v(idx) := 'Z';
147
        end if;
148
      end loop;
149 62 arniml
 
150 213 arniml
      return result_v;
151 62 arniml
    end;
152
 
153
  begin
154
    -- Test 0 -----------------------------------------------------------------
155
    if t0_dir_s = '1' then
156
      t0_b <= t0_s;
157
    else
158
      t0_b <= 'Z';
159
    end if;
160
 
161
    -- Data Bus ---------------------------------------------------------------
162
    if db_dir_s = '1' then
163
      db_b <= db_s;
164
    else
165
      db_b <= (others => 'Z');
166
    end if;
167
 
168
    -- Port 1 -----------------------------------------------------------------
169 213 arniml
    p1_b <= port_bidir_f(port_value => p1_s,
170
                         low_imp => p1_low_imp_s);
171 62 arniml
 
172
    -- Port 2 -----------------------------------------------------------------
173 213 arniml
    p2_b(3 downto 0) <= port_bidir_f(port_value => p2_s(3 downto 0),
174
                                     low_imp    => p2l_low_imp_s);
175
    p2_b(7 downto 4) <= port_bidir_f(port_value => p2_s(7 downto 4),
176
                                     low_imp    => p2h_low_imp_s);
177 62 arniml
 
178
  end process bidirs;
179
  --
180
  -----------------------------------------------------------------------------
181
 
182
end struct;
183
 
184
 
185
-------------------------------------------------------------------------------
186
-- File History:
187
--
188
-- $Log: not supported by cvs2svn $
189 220 arniml
-- Revision 1.5  2005/11/02 23:41:43  arniml
190
-- properly drive P1 and P2 with low impedance markers
191
--
192 213 arniml
-- Revision 1.4  2005/11/01 21:37:45  arniml
193
-- wire signals for P2 low impedance marker issue
194
--
195 211 arniml
-- Revision 1.3  2004/12/03 19:43:12  arniml
196
-- added hierarchy t8039_notri
197
--
198 62 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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