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

Subversion Repositories t48

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

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

Line No. Rev Author Line
1 148 arniml
-------------------------------------------------------------------------------
2
--
3
-- T8048 Microcontroller System
4
-- 8048 toplevel without tri-states
5
--
6 220 arniml
-- $Id: t8048_notri.vhd,v 1.5 2006-06-20 00:47:08 arniml Exp $
7 148 arniml
--
8
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
9
--
10
-- All rights reserved
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/cvsweb.shtml/t48/
44
--
45
-------------------------------------------------------------------------------
46
 
47
library ieee;
48
use ieee.std_logic_1164.all;
49
 
50
entity t8048_notri is
51
 
52 153 arniml
  generic (
53
    gate_port_input_g : integer := 1
54
  );
55
 
56 148 arniml
  port (
57 211 arniml
    xtal_i        : in  std_logic;
58 220 arniml
    xtal_en_i     : in  std_logic;
59 211 arniml
    reset_n_i     : in  std_logic;
60
    t0_i          : in  std_logic;
61
    t0_o          : out std_logic;
62
    t0_dir_o      : out std_logic;
63
    int_n_i       : in  std_logic;
64
    ea_i          : in  std_logic;
65
    rd_n_o        : out std_logic;
66
    psen_n_o      : out std_logic;
67
    wr_n_o        : out std_logic;
68
    ale_o         : out std_logic;
69
    db_i          : in  std_logic_vector( 7 downto 0);
70
    db_o          : out std_logic_vector( 7 downto 0);
71
    db_dir_o      : out std_logic;
72
    t1_i          : in  std_logic;
73
    p2_i          : in  std_logic_vector( 7 downto 0);
74
    p2_o          : out std_logic_vector( 7 downto 0);
75
    p2l_low_imp_o : out std_logic;
76
    p2h_low_imp_o : out std_logic;
77
    p1_i          : in  std_logic_vector( 7 downto 0);
78
    p1_o          : out std_logic_vector( 7 downto 0);
79
    p1_low_imp_o  : out std_logic;
80
    prog_n_o      : out std_logic
81 148 arniml
  );
82
 
83
end t8048_notri;
84
 
85
 
86
library ieee;
87
use ieee.numeric_std.all;
88
 
89
use work.t48_core_comp_pack.t48_core;
90
use work.t48_core_comp_pack.syn_rom;
91
use work.t48_core_comp_pack.syn_ram;
92
 
93
architecture struct of t8048_notri is
94
 
95
  -- Address width of internal ROM
96
  constant rom_addr_width_c : natural := 10;
97
 
98
  signal xtal3_s          : std_logic;
99
  signal dmem_addr_s      : std_logic_vector( 7 downto 0);
100
  signal dmem_we_s        : std_logic;
101
  signal dmem_data_from_s : std_logic_vector( 7 downto 0);
102
  signal dmem_data_to_s   : std_logic_vector( 7 downto 0);
103
  signal pmem_addr_s      : std_logic_vector(11 downto 0);
104
  signal pmem_data_s      : std_logic_vector( 7 downto 0);
105
 
106
  signal ea_s             : std_logic;
107
 
108 153 arniml
  signal p1_in_s,
109
         p1_out_s         : std_logic_vector( 7 downto 0);
110
  signal p2_in_s,
111
         p2_out_s         : std_logic_vector( 7 downto 0);
112
 
113 148 arniml
begin
114
 
115 153 arniml
  -----------------------------------------------------------------------------
116
  -- Check generics for valid values.
117
  -----------------------------------------------------------------------------
118
  -- pragma translate_off
119
  assert gate_port_input_g = 0 or gate_port_input_g = 1
120
    report "gate_port_input_g must be either 1 or 0!"
121
    severity failure;
122
  -- pragma translate_on
123
 
124
 
125 148 arniml
  t48_core_b : t48_core
126
    generic map (
127
      xtal_div_3_g        => 1,
128
      register_mnemonic_g => 1,
129
      include_port1_g     => 1,
130
      include_port2_g     => 1,
131
      include_bus_g       => 1,
132
      include_timer_g     => 1,
133
      sample_t1_state_g   => 4
134
    )
135
    port map (
136 211 arniml
      xtal_i        => xtal_i,
137 220 arniml
      xtal_en_i     => xtal_en_i,
138 211 arniml
      reset_i       => reset_n_i,
139
      t0_i          => t0_i,
140
      t0_o          => t0_o,
141
      t0_dir_o      => t0_dir_o,
142
      int_n_i       => int_n_i,
143
      ea_i          => ea_s,
144
      rd_n_o        => rd_n_o,
145
      psen_n_o      => psen_n_o,
146
      wr_n_o        => wr_n_o,
147
      ale_o         => ale_o,
148
      db_i          => db_i,
149
      db_o          => db_o,
150
      db_dir_o      => db_dir_o,
151
      t1_i          => t1_i,
152
      p2_i          => p2_in_s,
153
      p2_o          => p2_out_s,
154
      p2l_low_imp_o => p2l_low_imp_o,
155
      p2h_low_imp_o => p2h_low_imp_o,
156
      p1_i          => p1_in_s,
157
      p1_o          => p1_out_s,
158
      p1_low_imp_o  => p1_low_imp_o,
159
      prog_n_o      => prog_n_o,
160
      clk_i         => xtal_i,
161
      en_clk_i      => xtal3_s,
162
      xtal3_o       => xtal3_s,
163
      dmem_addr_o   => dmem_addr_s,
164
      dmem_we_o     => dmem_we_s,
165
      dmem_data_i   => dmem_data_from_s,
166
      dmem_data_o   => dmem_data_to_s,
167
      pmem_addr_o   => pmem_addr_s,
168
      pmem_data_i   => pmem_data_s
169 148 arniml
    );
170
 
171
 
172
  -----------------------------------------------------------------------------
173 153 arniml
  -- Gate port 1 and 2 input bus with respetive output value
174
  -----------------------------------------------------------------------------
175
  gate_ports: if gate_port_input_g = 1 generate
176
    p1_in_s <= p1_i and p1_out_s;
177
    p2_in_s <= p2_i and p2_out_s;
178
  end generate;
179
 
180
  pass_ports: if gate_port_input_g = 0 generate
181
    p1_in_s <= p1_i;
182
    p2_in_s <= p2_i;
183
  end generate;
184
 
185
  p1_o <= p1_out_s;
186
  p2_o <= p2_out_s;
187
 
188
 
189
  -----------------------------------------------------------------------------
190 148 arniml
  -- Process ea
191
  --
192
  -- Purpose:
193
  --   Detects access to external program memory.
194
  --   Either by ea_i = '1' or when program memory address leaves address
195
  --   range of internal ROM.
196
  --
197
  ea: process (ea_i,
198
               pmem_addr_s)
199
  begin
200
    if ea_i = '1' then
201
      -- Forced external access
202
      ea_s <= '1';
203
 
204
    elsif unsigned(pmem_addr_s(11 downto rom_addr_width_c)) = 0 then
205
      -- Internal access
206
      ea_s <= '0';
207
 
208
    else
209
      -- Access to program memory out of internal range
210
      ea_s <= '1';
211
 
212
    end if;
213
 
214
  end process ea;
215
  --
216
  -----------------------------------------------------------------------------
217
 
218
 
219
  rom_1k_b : syn_rom
220
    generic map (
221
      address_width_g => rom_addr_width_c
222
    )
223
    port map (
224
      clk_i      => xtal_i,
225
      rom_addr_i => pmem_addr_s(rom_addr_width_c-1 downto 0),
226
      rom_data_o => pmem_data_s
227
    );
228
 
229
  ram_64_b : syn_ram
230
    generic map (
231
      address_width_g => 6
232
    )
233
    port map (
234
      clk_i      => xtal_i,
235
      res_i      => reset_n_i,
236
      ram_addr_i => dmem_addr_s(5 downto 0),
237
      ram_data_i => dmem_data_to_s,
238
      ram_we_i   => dmem_we_s,
239
      ram_data_o => dmem_data_from_s
240
    );
241
 
242
end struct;
243
 
244
 
245
-------------------------------------------------------------------------------
246
-- File History:
247 149 arniml
--
248
-- $Log: not supported by cvs2svn $
249 220 arniml
-- Revision 1.4  2005/11/01 21:38:48  arniml
250
-- wire signals for P2 low impedance marker issue
251
--
252 211 arniml
-- Revision 1.3  2004/12/02 22:08:42  arniml
253
-- introduced generic gate_port_input_g
254
-- forces masking of P1 and P2 input bus
255
--
256 153 arniml
-- Revision 1.2  2004/12/01 23:08:08  arniml
257
-- update
258
--
259 148 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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