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 211

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 211 arniml
-- $Id: t8048_notri.vhd,v 1.4 2005-11-01 21:38:48 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
    reset_n_i     : in  std_logic;
59
    t0_i          : in  std_logic;
60
    t0_o          : out std_logic;
61
    t0_dir_o      : out std_logic;
62
    int_n_i       : in  std_logic;
63
    ea_i          : in  std_logic;
64
    rd_n_o        : out std_logic;
65
    psen_n_o      : out std_logic;
66
    wr_n_o        : out std_logic;
67
    ale_o         : out std_logic;
68
    db_i          : in  std_logic_vector( 7 downto 0);
69
    db_o          : out std_logic_vector( 7 downto 0);
70
    db_dir_o      : out std_logic;
71
    t1_i          : in  std_logic;
72
    p2_i          : in  std_logic_vector( 7 downto 0);
73
    p2_o          : out std_logic_vector( 7 downto 0);
74
    p2l_low_imp_o : out std_logic;
75
    p2h_low_imp_o : out std_logic;
76
    p1_i          : in  std_logic_vector( 7 downto 0);
77
    p1_o          : out std_logic_vector( 7 downto 0);
78
    p1_low_imp_o  : out std_logic;
79
    prog_n_o      : out std_logic
80 148 arniml
  );
81
 
82
end t8048_notri;
83
 
84
 
85
library ieee;
86
use ieee.numeric_std.all;
87
 
88
use work.t48_core_comp_pack.t48_core;
89
use work.t48_core_comp_pack.syn_rom;
90
use work.t48_core_comp_pack.syn_ram;
91
 
92
architecture struct of t8048_notri is
93
 
94
  -- Address width of internal ROM
95
  constant rom_addr_width_c : natural := 10;
96
 
97
  signal xtal3_s          : std_logic;
98
  signal dmem_addr_s      : std_logic_vector( 7 downto 0);
99
  signal dmem_we_s        : std_logic;
100
  signal dmem_data_from_s : std_logic_vector( 7 downto 0);
101
  signal dmem_data_to_s   : std_logic_vector( 7 downto 0);
102
  signal pmem_addr_s      : std_logic_vector(11 downto 0);
103
  signal pmem_data_s      : std_logic_vector( 7 downto 0);
104
 
105
  signal ea_s             : std_logic;
106
 
107 153 arniml
  signal p1_in_s,
108
         p1_out_s         : std_logic_vector( 7 downto 0);
109
  signal p2_in_s,
110
         p2_out_s         : std_logic_vector( 7 downto 0);
111
 
112 148 arniml
begin
113
 
114 153 arniml
  -----------------------------------------------------------------------------
115
  -- Check generics for valid values.
116
  -----------------------------------------------------------------------------
117
  -- pragma translate_off
118
  assert gate_port_input_g = 0 or gate_port_input_g = 1
119
    report "gate_port_input_g must be either 1 or 0!"
120
    severity failure;
121
  -- pragma translate_on
122
 
123
 
124 148 arniml
  t48_core_b : t48_core
125
    generic map (
126
      xtal_div_3_g        => 1,
127
      register_mnemonic_g => 1,
128
      include_port1_g     => 1,
129
      include_port2_g     => 1,
130
      include_bus_g       => 1,
131
      include_timer_g     => 1,
132
      sample_t1_state_g   => 4
133
    )
134
    port map (
135 211 arniml
      xtal_i        => xtal_i,
136
      reset_i       => reset_n_i,
137
      t0_i          => t0_i,
138
      t0_o          => t0_o,
139
      t0_dir_o      => t0_dir_o,
140
      int_n_i       => int_n_i,
141
      ea_i          => ea_s,
142
      rd_n_o        => rd_n_o,
143
      psen_n_o      => psen_n_o,
144
      wr_n_o        => wr_n_o,
145
      ale_o         => ale_o,
146
      db_i          => db_i,
147
      db_o          => db_o,
148
      db_dir_o      => db_dir_o,
149
      t1_i          => t1_i,
150
      p2_i          => p2_in_s,
151
      p2_o          => p2_out_s,
152
      p2l_low_imp_o => p2l_low_imp_o,
153
      p2h_low_imp_o => p2h_low_imp_o,
154
      p1_i          => p1_in_s,
155
      p1_o          => p1_out_s,
156
      p1_low_imp_o  => p1_low_imp_o,
157
      prog_n_o      => prog_n_o,
158
      clk_i         => xtal_i,
159
      en_clk_i      => xtal3_s,
160
      xtal3_o       => xtal3_s,
161
      dmem_addr_o   => dmem_addr_s,
162
      dmem_we_o     => dmem_we_s,
163
      dmem_data_i   => dmem_data_from_s,
164
      dmem_data_o   => dmem_data_to_s,
165
      pmem_addr_o   => pmem_addr_s,
166
      pmem_data_i   => pmem_data_s
167 148 arniml
    );
168
 
169
 
170
  -----------------------------------------------------------------------------
171 153 arniml
  -- Gate port 1 and 2 input bus with respetive output value
172
  -----------------------------------------------------------------------------
173
  gate_ports: if gate_port_input_g = 1 generate
174
    p1_in_s <= p1_i and p1_out_s;
175
    p2_in_s <= p2_i and p2_out_s;
176
  end generate;
177
 
178
  pass_ports: if gate_port_input_g = 0 generate
179
    p1_in_s <= p1_i;
180
    p2_in_s <= p2_i;
181
  end generate;
182
 
183
  p1_o <= p1_out_s;
184
  p2_o <= p2_out_s;
185
 
186
 
187
  -----------------------------------------------------------------------------
188 148 arniml
  -- Process ea
189
  --
190
  -- Purpose:
191
  --   Detects access to external program memory.
192
  --   Either by ea_i = '1' or when program memory address leaves address
193
  --   range of internal ROM.
194
  --
195
  ea: process (ea_i,
196
               pmem_addr_s)
197
  begin
198
    if ea_i = '1' then
199
      -- Forced external access
200
      ea_s <= '1';
201
 
202
    elsif unsigned(pmem_addr_s(11 downto rom_addr_width_c)) = 0 then
203
      -- Internal access
204
      ea_s <= '0';
205
 
206
    else
207
      -- Access to program memory out of internal range
208
      ea_s <= '1';
209
 
210
    end if;
211
 
212
  end process ea;
213
  --
214
  -----------------------------------------------------------------------------
215
 
216
 
217
  rom_1k_b : syn_rom
218
    generic map (
219
      address_width_g => rom_addr_width_c
220
    )
221
    port map (
222
      clk_i      => xtal_i,
223
      rom_addr_i => pmem_addr_s(rom_addr_width_c-1 downto 0),
224
      rom_data_o => pmem_data_s
225
    );
226
 
227
  ram_64_b : syn_ram
228
    generic map (
229
      address_width_g => 6
230
    )
231
    port map (
232
      clk_i      => xtal_i,
233
      res_i      => reset_n_i,
234
      ram_addr_i => dmem_addr_s(5 downto 0),
235
      ram_data_i => dmem_data_to_s,
236
      ram_we_i   => dmem_we_s,
237
      ram_data_o => dmem_data_from_s
238
    );
239
 
240
end struct;
241
 
242
 
243
-------------------------------------------------------------------------------
244
-- File History:
245 149 arniml
--
246
-- $Log: not supported by cvs2svn $
247 211 arniml
-- Revision 1.3  2004/12/02 22:08:42  arniml
248
-- introduced generic gate_port_input_g
249
-- forces masking of P1 and P2 input bus
250
--
251 153 arniml
-- Revision 1.2  2004/12/01 23:08:08  arniml
252
-- update
253
--
254 148 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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