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

Subversion Repositories t48

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 arniml
-------------------------------------------------------------------------------
2
--
3
-- T8048 Microcontroller System
4
--
5 295 arniml
-- $Id: t8048.vhd 295 2009-04-01 19:32:48Z arniml $
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 220 arniml
  signal vdd_s            : std_logic;
89
 
90 7 arniml
begin
91
 
92 220 arniml
  vdd_s <= '1';
93
 
94 150 arniml
  t8048_notri_b : t8048_notri
95 153 arniml
    generic map (
96
      -- we don't need explicit gating of input ports
97
      -- this is done implicitely by the bidirectional pads
98
      gate_port_input_g => 0
99
    )
100
 
101 7 arniml
    port map (
102 211 arniml
      xtal_i        => xtal_i,
103 220 arniml
      xtal_en_i     => vdd_s,
104 211 arniml
      reset_n_i     => reset_n_i,
105
      t0_i          => t0_b,
106
      t0_o          => t0_s,
107
      t0_dir_o      => t0_dir_s,
108
      int_n_i       => int_n_i,
109
      ea_i          => ea_i,
110
      rd_n_o        => rd_n_o,
111
      psen_n_o      => psen_n_o,
112
      wr_n_o        => wr_n_o,
113
      ale_o         => ale_o,
114
      db_i          => db_b,
115
      db_o          => db_s,
116
      db_dir_o      => db_dir_s,
117
      t1_i          => t1_i,
118
      p2_i          => p2_b,
119
      p2_o          => p2_s,
120
      p2l_low_imp_o => p2l_low_imp_s,
121
      p2h_low_imp_o => p2h_low_imp_s,
122
      p1_i          => p1_b,
123
      p1_o          => p1_s,
124
      p1_low_imp_o  => p1_low_imp_s,
125
      prog_n_o      => prog_n_o
126 7 arniml
    );
127
 
128
  -----------------------------------------------------------------------------
129
  -- Process bidirs
130
  --
131
  -- Purpose:
132
  --   Assign bidirectional signals.
133
  --
134
  bidirs: process (t0_b, t0_s, t0_dir_s,
135
                   db_b, db_s, db_dir_s,
136 32 arniml
                   p1_b, p1_s, p1_low_imp_s,
137 211 arniml
                   p2_b, p2_s, p2l_low_imp_s, p2h_low_imp_s)
138 7 arniml
 
139 213 arniml
    function port_bidir_f(port_value : in std_logic_vector;
140
                          low_imp    : in std_logic) return std_logic_vector is
141
      variable result_v : std_logic_vector(port_value'range);
142 7 arniml
    begin
143 213 arniml
      for idx in port_value'high downto port_value'low loop
144
        if low_imp = '1' then
145
          result_v(idx) := port_value(idx);
146
        elsif port_value(idx) = '0' then
147
          result_v(idx) := '0';
148
        else
149
          result_v(idx) := 'Z';
150
        end if;
151
      end loop;
152 7 arniml
 
153 213 arniml
      return result_v;
154 7 arniml
    end;
155
 
156
  begin
157
    -- Test 0 -----------------------------------------------------------------
158
    if t0_dir_s = '1' then
159
      t0_b <= t0_s;
160
    else
161
      t0_b <= 'Z';
162
    end if;
163
 
164
    -- Data Bus ---------------------------------------------------------------
165
    if db_dir_s = '1' then
166
      db_b <= db_s;
167
    else
168
      db_b <= (others => 'Z');
169
    end if;
170
 
171
    -- Port 1 -----------------------------------------------------------------
172 213 arniml
    p1_b <= port_bidir_f(port_value => p1_s,
173
                         low_imp => p1_low_imp_s);
174 7 arniml
 
175
    -- Port 2 -----------------------------------------------------------------
176 213 arniml
    p2_b(3 downto 0) <= port_bidir_f(port_value => p2_s(3 downto 0),
177
                                     low_imp    => p2l_low_imp_s);
178
    p2_b(7 downto 4) <= port_bidir_f(port_value => p2_s(7 downto 4),
179
                                     low_imp    => p2h_low_imp_s);
180 7 arniml
 
181
  end process bidirs;
182
  --
183
  -----------------------------------------------------------------------------
184
 
185 108 arniml
 
186 7 arniml
end struct;

powered by: WebSVN 2.1.0

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