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

Subversion Repositories t48

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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