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

Subversion Repositories t48

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

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

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

powered by: WebSVN 2.1.0

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