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

Subversion Repositories t48

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

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 107 arniml
-- $Id: t8039.vhd,v 1.2 2004-05-20 21:53:42 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
use work.t48_core_comp_pack.t48_core;
72
use work.t48_core_comp_pack.syn_rom;
73
use work.t48_core_comp_pack.syn_ram;
74
 
75
architecture struct of t8039 is
76
 
77
  signal t0_s             : std_logic;
78
  signal t0_dir_s         : std_logic;
79
  signal db_s             : std_logic_vector( 7 downto 0);
80
  signal db_dir_s         : std_logic;
81
  signal p2_s             : std_logic_vector( 7 downto 0);
82
  signal p2_low_imp_s     : std_logic;
83
  signal p1_s             : std_logic_vector( 7 downto 0);
84
  signal p1_low_imp_s     : std_logic;
85
  signal xtal3_s          : std_logic;
86
  signal dmem_addr_s      : std_logic_vector( 7 downto 0);
87
  signal dmem_we_s        : std_logic;
88
  signal dmem_data_from_s : std_logic_vector( 7 downto 0);
89
  signal dmem_data_to_s   : std_logic_vector( 7 downto 0);
90
  signal pmem_data_s      : std_logic_vector( 7 downto 0);
91
 
92 107 arniml
  signal vdd_s            : std_logic;
93
 
94 62 arniml
begin
95
 
96
  -- no Program memory available
97
  pmem_data_s <= (others => '0');
98 107 arniml
  vdd_s       <= '1';
99 62 arniml
 
100
  t48_core_b : t48_core
101
    generic map (
102
      xtal_div_3_g        => 1,
103
      register_mnemonic_g => 1,
104
      include_port1_g     => 1,
105
      include_port2_g     => 1,
106
      include_bus_g       => 1,
107
      include_timer_g     => 1,
108
      sample_t1_state_g   => 4
109
    )
110
    port map (
111
      xtal_i       => xtal_i,
112
      reset_i      => reset_n_i,
113
      t0_i         => t0_b,
114
      t0_o         => t0_s,
115
      t0_dir_o     => t0_dir_s,
116
      int_n_i      => int_n_i,
117 107 arniml
      ea_i         => vdd_s,
118 62 arniml
      rd_n_o       => rd_n_o,
119
      psen_n_o     => psen_n_o,
120
      wr_n_o       => wr_n_o,
121
      ale_o        => ale_o,
122
      db_i         => db_b,
123
      db_o         => db_s,
124
      db_dir_o     => db_dir_s,
125
      t1_i         => t1_i,
126
      p2_i         => p2_b,
127
      p2_o         => p2_s,
128
      p2_low_imp_o => p2_low_imp_s,
129
      p1_i         => p1_b,
130
      p1_o         => p1_s,
131
      p1_low_imp_o => p1_low_imp_s,
132
      prog_n_o     => prog_n_o,
133
      clk_i        => xtal_i,
134
      en_clk_i     => xtal3_s,
135
      xtal3_o      => xtal3_s,
136
      dmem_addr_o  => dmem_addr_s,
137
      dmem_we_o    => dmem_we_s,
138
      dmem_data_i  => dmem_data_from_s,
139
      dmem_data_o  => dmem_data_to_s,
140
      pmem_addr_o  => open,
141
      pmem_data_i  => pmem_data_s
142
    );
143
 
144
  -----------------------------------------------------------------------------
145
  -- Process bidirs
146
  --
147
  -- Purpose:
148
  --   Assign bidirectional signals.
149
  --
150
  bidirs: process (t0_b, t0_s, t0_dir_s,
151
                   db_b, db_s, db_dir_s,
152
                   p1_b, p1_s, p1_low_imp_s,
153
                   p2_b, p2_s, p2_low_imp_s)
154
 
155
    function open_collector_f(sig : std_logic) return std_logic is
156
      variable sig_v : std_logic;
157
    begin
158
      sig_v   := 'Z';
159
 
160
      if sig = '0' then
161
        sig_v := '0';
162
      end if;
163
 
164
      return sig_v;
165
    end;
166
 
167
  begin
168
    -- Test 0 -----------------------------------------------------------------
169
    if t0_dir_s = '1' then
170
      t0_b <= t0_s;
171
    else
172
      t0_b <= 'Z';
173
    end if;
174
 
175
    -- Data Bus ---------------------------------------------------------------
176
    if db_dir_s = '1' then
177
      db_b <= db_s;
178
    else
179
      db_b <= (others => 'Z');
180
    end if;
181
 
182
    -- Port 1 -----------------------------------------------------------------
183
    for i in p1_b'range loop
184
      p1_b(i) <= open_collector_f(p1_s(i));
185
    end loop;
186
--     if p1_low_imp_s = '1' then
187
--       p1_b <= p1_s;
188
--     else
189
--       p1_b <= (others => 'Z');
190
--     end if;
191
 
192
    -- Port 2 -----------------------------------------------------------------
193
    for i in p2_b'range loop
194
      p2_b(i) <= open_collector_f(p2_s(i));
195
    end loop;
196
--     if p2_low_imp_s = '1' then
197
--       p2_b <= p2_b_s;
198
--     else
199
--       p2_b <= (others => 'Z');
200
--     end if;
201
 
202
  end process bidirs;
203
  --
204
  -----------------------------------------------------------------------------
205
 
206
  ram_128_b : syn_ram
207
    generic map (
208
      address_width_g => 7
209
    )
210
    port map (
211
      clk_i      => xtal_i,
212
      res_i      => reset_n_i,
213
      ram_addr_i => dmem_addr_s(6 downto 0),
214
      ram_data_i => dmem_data_to_s,
215
      ram_we_i   => dmem_we_s,
216
      ram_data_o => dmem_data_from_s
217
    );
218
 
219
end struct;
220
 
221
 
222
-------------------------------------------------------------------------------
223
-- File History:
224
--
225
-- $Log: not supported by cvs2svn $
226 107 arniml
-- Revision 1.1  2004/04/18 18:51:10  arniml
227
-- initial check-in
228
--
229 62 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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