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

Subversion Repositories t48

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

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

powered by: WebSVN 2.1.0

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