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

Subversion Repositories t48

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

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

Line No. Rev Author Line
1 4 arniml
-------------------------------------------------------------------------------
2
--
3
-- T48 Microcontroller Core
4
--
5 220 arniml
-- $Id: t48_core.vhd,v 1.11 2006-06-20 00:46:04 arniml Exp $
6 4 arniml
--
7 162 arniml
-- Copyright (c) 2004, 2005, Arnim Laeuger (arniml@opencores.org)
8 4 arniml
--
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
-- Limitations :
45
-- =============
46
--
47
-- Compared to the original MCS-48 architecture, the following limitations
48
-- apply:
49
--
50 28 arniml
--   * Nibble-wide instructions addressing expander port implemented but
51 86 arniml
--     not verified in detail.
52 4 arniml
--
53
--   * Single-step mode not implemented.
54
--     Not selected for future implementation.
55
--
56
--   * Reading of internal Program Memory not implemented.
57
--     Not selected for future implementation.
58
--
59
-------------------------------------------------------------------------------
60
 
61
library ieee;
62
use ieee.std_logic_1164.all;
63
 
64
entity t48_core is
65
 
66
  generic (
67
    -- divide XTAL1 by 3 to derive Clock States
68
    xtal_div_3_g          : integer := 1;
69
    -- store mnemonic in flip-flops (registered-out)
70
    register_mnemonic_g   : integer := 1;
71
    -- include the port 1 module
72
    include_port1_g       : integer := 1;
73
    -- include the port 2 module
74
    include_port2_g       : integer := 1;
75
    -- include the BUS module
76
    include_bus_g         : integer := 1;
77
    -- include the timer module
78
    include_timer_g       : integer := 1;
79
    -- state in which T1 is sampled (3 or 4)
80
    sample_t1_state_g     : integer := 4
81
  );
82
 
83
  port (
84
    -- T48 Interface ----------------------------------------------------------
85 208 arniml
    xtal_i        : in  std_logic;
86 220 arniml
    xtal_en_i     : in  std_logic;
87 208 arniml
    reset_i       : in  std_logic;
88
    t0_i          : in  std_logic;
89
    t0_o          : out std_logic;
90
    t0_dir_o      : out std_logic;
91
    int_n_i       : in  std_logic;
92
    ea_i          : in  std_logic;
93
    rd_n_o        : out std_logic;
94
    psen_n_o      : out std_logic;
95
    wr_n_o        : out std_logic;
96
    ale_o         : out std_logic;
97
    db_i          : in  std_logic_vector( 7 downto 0);
98
    db_o          : out std_logic_vector( 7 downto 0);
99
    db_dir_o      : out std_logic;
100
    t1_i          : in  std_logic;
101
    p2_i          : in  std_logic_vector( 7 downto 0);
102
    p2_o          : out std_logic_vector( 7 downto 0);
103
    p2l_low_imp_o : out std_logic;
104
    p2h_low_imp_o : out std_logic;
105
    p1_i          : in  std_logic_vector( 7 downto 0);
106
    p1_o          : out std_logic_vector( 7 downto 0);
107
    p1_low_imp_o  : out std_logic;
108
    prog_n_o      : out std_logic;
109 4 arniml
    -- Core Interface ---------------------------------------------------------
110 208 arniml
    clk_i         : in  std_logic;
111
    en_clk_i      : in  std_logic;
112
    xtal3_o       : out std_logic;
113
    dmem_addr_o   : out std_logic_vector( 7 downto 0);
114
    dmem_we_o     : out std_logic;
115
    dmem_data_i   : in  std_logic_vector( 7 downto 0);
116
    dmem_data_o   : out std_logic_vector( 7 downto 0);
117
    pmem_addr_o   : out std_logic_vector(11 downto 0);
118
    pmem_data_i   : in  std_logic_vector( 7 downto 0)
119 4 arniml
  );
120
 
121
end t48_core;
122
 
123
 
124 179 arniml
use work.t48_alu_pack.alu_op_t;
125
use work.t48_cond_branch_pack.branch_conditions_t;
126
use work.t48_cond_branch_pack.comp_value_t;
127
use work.t48_dmem_ctrl_pack.dmem_addr_ident_t;
128
use work.t48_pmem_ctrl_pack.pmem_addr_ident_t;
129 4 arniml
use work.t48_comp_pack.all;
130
use work.t48_pack.bus_idle_level_c;
131
use work.t48_pack.word_t;
132
use work.t48_pack.pmem_addr_t;
133
use work.t48_pack.mstate_t;
134
use work.t48_pack.to_stdLogic;
135
use work.t48_pack.to_boolean;
136
 
137
architecture struct of t48_core is
138
 
139
  signal t48_data_s : word_t;
140
 
141 220 arniml
  signal xtal_en_s  : boolean;
142 4 arniml
  signal en_clk_s   : boolean;
143
 
144
  -- ALU signals
145
  signal alu_data_s           : word_t;
146
  signal alu_write_accu_s     : boolean;
147
  signal alu_write_shadow_s   : boolean;
148
  signal alu_write_temp_reg_s : boolean;
149
  signal alu_read_alu_s       : boolean;
150
  signal alu_carry_s          : std_logic;
151
  signal alu_aux_carry_s      : std_logic;
152
  signal alu_op_s             : alu_op_t;
153
  signal alu_use_carry_s      : boolean;
154 28 arniml
  signal alu_da_high_s        : boolean;
155
  signal alu_da_overflow_s    : boolean;
156 38 arniml
  signal alu_accu_low_s       : boolean;
157 28 arniml
  signal alu_p06_temp_reg_s   : boolean;
158
  signal alu_p60_temp_reg_s   : boolean;
159 4 arniml
 
160
  -- BUS signals
161
  signal bus_write_bus_s  : boolean;
162
  signal bus_read_bus_s   : boolean;
163
  signal bus_output_pcl_s : boolean;
164
  signal bus_bidir_bus_s  : boolean;
165
  signal bus_data_s       : word_t;
166
 
167
  -- Clock Controller signals
168
  signal clk_multi_cycle_s  : boolean;
169
  signal clk_assert_psen_s  : boolean;
170
  signal clk_assert_prog_s  : boolean;
171
  signal clk_assert_rd_s    : boolean;
172
  signal clk_assert_wr_s    : boolean;
173
  signal clk_mstate_s       : mstate_t;
174
  signal clk_second_cycle_s : boolean;
175
  signal psen_s             : boolean;
176
  signal prog_s             : boolean;
177
  signal rd_s               : boolean;
178
  signal wr_s               : boolean;
179
  signal ale_s              : boolean;
180
  signal xtal3_s            : boolean;
181
 
182
  -- Conditional Branch Logic signals
183
  signal cnd_compute_take_s : boolean;
184
  signal cnd_branch_cond_s  : branch_conditions_t;
185
  signal cnd_take_branch_s  : boolean;
186
  signal cnd_comp_value_s   : comp_value_t;
187
  signal cnd_f1_s           : std_logic;
188
  signal cnd_tf_s           : std_logic;
189
 
190
  -- Data Memory Controller signals
191
  signal dm_write_dmem_addr_s : boolean;
192
  signal dm_write_dmem_s      : boolean;
193
  signal dm_read_dmem_s       : boolean;
194
  signal dm_addr_type_s       : dmem_addr_ident_t;
195
  signal dm_data_s            : word_t;
196
 
197
  -- Decoder signals
198
  signal dec_data_s           : word_t;
199
 
200
  -- Port 1 signals
201
  signal p1_write_p1_s : boolean;
202
  signal p1_read_p1_s  : boolean;
203
  signal p1_read_reg_s : boolean;
204
  signal p1_data_s     : word_t;
205
 
206
  -- Port 2 signals
207
  signal p2_write_p2_s   : boolean;
208
  signal p2_write_exp_s  : boolean;
209
  signal p2_read_p2_s    : boolean;
210
  signal p2_read_reg_s   : boolean;
211 24 arniml
  signal p2_read_exp_s   : boolean;
212 4 arniml
  signal p2_output_pch_s : boolean;
213
  signal p2_data_s       : word_t;
214
 
215
  -- Program Memory Controller signals
216
  signal pm_write_pcl_s       : boolean;
217
  signal pm_read_pcl_s        : boolean;
218
  signal pm_write_pch_s       : boolean;
219
  signal pm_read_pch_s        : boolean;
220
  signal pm_read_pmem_s       : boolean;
221
  signal pm_inc_pc_s          : boolean;
222
  signal pm_write_pmem_addr_s : boolean;
223
  signal pm_data_s            : word_t;
224
  signal pm_addr_type_s       : pmem_addr_ident_t;
225
  signal pmem_addr_s          : pmem_addr_t;
226
 
227
  -- PSW signals
228
  signal psw_read_psw_s        : boolean;
229
  signal psw_read_sp_s         : boolean;
230
  signal psw_write_psw_s       : boolean;
231
  signal psw_write_sp_s        : boolean;
232
  signal psw_carry_s           : std_logic;
233
  signal psw_aux_carry_s       : std_logic;
234
  signal psw_f0_s              : std_logic;
235
  signal psw_bs_s              : std_logic;
236
  signal psw_special_data_s    : std_logic;
237
  signal psw_inc_stackp_s      : boolean;
238
  signal psw_dec_stackp_s      : boolean;
239
  signal psw_write_carry_s     : boolean;
240
  signal psw_write_aux_carry_s : boolean;
241
  signal psw_write_f0_s        : boolean;
242
  signal psw_write_bs_s        : boolean;
243
  signal psw_data_s            : word_t;
244
 
245
  -- Timer signals
246
  signal tim_overflow_s    : boolean;
247
  signal tim_of_s          : std_logic;
248
  signal tim_read_timer_s  : boolean;
249
  signal tim_write_timer_s : boolean;
250
  signal tim_start_t_s     : boolean;
251
  signal tim_start_cnt_s   : boolean;
252
  signal tim_stop_tcnt_s   : boolean;
253
  signal tim_data_s        : word_t;
254
 
255
begin
256
 
257
  -----------------------------------------------------------------------------
258
  -- Check generics for valid values.
259
  -----------------------------------------------------------------------------
260
  -- pragma translate_off
261
  assert include_timer_g = 0 or include_timer_g = 1
262
    report "include_timer_g must be either 1 or 0!"
263
    severity failure;
264
 
265
  assert include_port1_g = 0 or include_port1_g = 1
266
    report "include_port1_g must be either 1 or 0!"
267
    severity failure;
268
 
269
  assert include_port2_g = 0 or include_port2_g = 1
270
    report "include_port2_g must be either 1 or 0!"
271
    severity failure;
272
 
273
  assert include_bus_g   = 0 or include_bus_g = 1
274
    report "include_bus_g must be either 1 or 0!"
275
    severity failure;
276
  -- pragma translate_on
277
 
278
 
279 220 arniml
  xtal_en_s <= to_boolean(xtal_en_i);
280
  en_clk_s  <= to_boolean(en_clk_i);
281 4 arniml
 
282 179 arniml
  alu_b : t48_alu
283 4 arniml
    port map (
284
      clk_i              => clk_i,
285
      res_i              => reset_i,
286
      en_clk_i           => en_clk_s,
287
      data_i             => t48_data_s,
288
      data_o             => alu_data_s,
289
      write_accu_i       => alu_write_accu_s,
290
      write_shadow_i     => alu_write_shadow_s,
291
      write_temp_reg_i   => alu_write_temp_reg_s,
292
      read_alu_i         => alu_read_alu_s,
293
      carry_i            => psw_carry_s,
294
      carry_o            => alu_carry_s,
295
      aux_carry_o        => alu_aux_carry_s,
296
      alu_op_i           => alu_op_s,
297 28 arniml
      use_carry_i        => alu_use_carry_s,
298
      da_high_i          => alu_da_high_s,
299
      da_overflow_o      => alu_da_overflow_s,
300 38 arniml
      accu_low_i         => alu_accu_low_s,
301 28 arniml
      p06_temp_reg_i     => alu_p06_temp_reg_s,
302
      p60_temp_reg_i     => alu_p60_temp_reg_s
303 4 arniml
    );
304
 
305 179 arniml
  bus_mux_b : t48_bus_mux
306 4 arniml
    port map (
307
      alu_data_i => alu_data_s,
308
      bus_data_i => bus_data_s,
309
      dec_data_i => dec_data_s,
310
      dm_data_i  => dm_data_s,
311
      pm_data_i  => pm_data_s,
312
      p1_data_i  => p1_data_s,
313
      p2_data_i  => p2_data_s,
314
      psw_data_i => psw_data_s,
315
      tim_data_i => tim_data_s,
316
      data_o     => t48_data_s
317
    );
318
 
319 179 arniml
  clock_ctrl_b : t48_clock_ctrl
320 4 arniml
    generic map (
321
      xtal_div_3_g   => xtal_div_3_g
322
    )
323
    port map (
324
      clk_i          => clk_i,
325
      xtal_i         => xtal_i,
326 220 arniml
      xtal_en_i      => xtal_en_s,
327 4 arniml
      res_i          => reset_i,
328
      en_clk_i       => en_clk_s,
329
      xtal3_o        => xtal3_s,
330 162 arniml
      t0_o           => t0_o,
331 4 arniml
      multi_cycle_i  => clk_multi_cycle_s,
332
      assert_psen_i  => clk_assert_psen_s,
333
      assert_prog_i  => clk_assert_prog_s,
334
      assert_rd_i    => clk_assert_rd_s,
335
      assert_wr_i    => clk_assert_wr_s,
336
      mstate_o       => clk_mstate_s,
337
      second_cycle_o => clk_second_cycle_s,
338
      ale_o          => ale_s,
339
      psen_o         => psen_s,
340
      prog_o         => prog_s,
341
      rd_o           => rd_s,
342
      wr_o           => wr_s
343
    );
344
 
345 179 arniml
  cond_branch_b : t48_cond_branch
346 4 arniml
    port map (
347
      clk_i          => clk_i,
348
      res_i          => reset_i,
349
      en_clk_i       => en_clk_s,
350
      compute_take_i => cnd_compute_take_s,
351
      branch_cond_i  => cnd_branch_cond_s,
352
      take_branch_o  => cnd_take_branch_s,
353
      accu_i         => alu_data_s,
354
      t0_i           => To_X01Z(t0_i),
355
      t1_i           => To_X01Z(t1_i),
356
      int_n_i        => int_n_i,
357
      f0_i           => psw_f0_s,
358
      f1_i           => cnd_f1_s,
359
      tf_i           => cnd_tf_s,
360
      carry_i        => psw_carry_s,
361
      comp_value_i   => cnd_comp_value_s
362
    );
363
 
364
  use_db_bus: if include_bus_g = 1 generate
365 179 arniml
    db_bus_b : t48_db_bus
366 4 arniml
      port map (
367
        clk_i        => clk_i,
368
        res_i        => reset_i,
369
        en_clk_i     => en_clk_s,
370
        ea_i         => ea_i,
371
        data_i       => t48_data_s,
372
        data_o       => bus_data_s,
373
        write_bus_i  => bus_write_bus_s,
374
        read_bus_i   => bus_read_bus_s,
375
        output_pcl_i => bus_output_pcl_s,
376
        bidir_bus_i  => bus_bidir_bus_s,
377
        pcl_i        => pmem_addr_s(word_t'range),
378
        db_i         => db_i,
379
        db_o         => db_o,
380
        db_dir_o     => db_dir_o
381
      );
382
  end generate;
383
 
384
  skip_db_bus: if include_bus_g = 0 generate
385
    bus_data_s <= (others => bus_idle_level_c);
386
    db_o       <= (others => '0');
387
    db_dir_o   <= '0';
388
  end generate;
389
 
390 179 arniml
  decoder_b : t48_decoder
391 4 arniml
    generic map (
392
      register_mnemonic_g => register_mnemonic_g
393
    )
394
    port map (
395
      clk_i                  => clk_i,
396
      res_i                  => reset_i,
397
      en_clk_i               => en_clk_s,
398 208 arniml
      xtal_i                 => xtal_i,
399 220 arniml
      xtal_en_i              => xtal_en_s,
400 4 arniml
      ea_i                   => ea_i,
401
      ale_i                  => ale_s,
402
      int_n_i                => int_n_i,
403
      t0_dir_o               => t0_dir_o,
404
      data_i                 => t48_data_s,
405
      data_o                 => dec_data_s,
406
      alu_write_accu_o       => alu_write_accu_s,
407
      alu_write_shadow_o     => alu_write_shadow_s,
408
      alu_write_temp_reg_o   => alu_write_temp_reg_s,
409
      alu_read_alu_o         => alu_read_alu_s,
410
      bus_write_bus_o        => bus_write_bus_s,
411
      bus_read_bus_o         => bus_read_bus_s,
412
      dm_write_dmem_addr_o   => dm_write_dmem_addr_s,
413
      dm_write_dmem_o        => dm_write_dmem_s,
414
      dm_read_dmem_o         => dm_read_dmem_s,
415
      p1_write_p1_o          => p1_write_p1_s,
416
      p1_read_p1_o           => p1_read_p1_s,
417
      pm_write_pcl_o         => pm_write_pcl_s,
418
      p2_write_p2_o          => p2_write_p2_s,
419
      p2_write_exp_o         => p2_write_exp_s,
420
      p2_read_p2_o           => p2_read_p2_s,
421
      pm_read_pcl_o          => pm_read_pcl_s,
422
      pm_write_pch_o         => pm_write_pch_s,
423
      pm_read_pch_o          => pm_read_pch_s,
424
      pm_read_pmem_o         => pm_read_pmem_s,
425
      psw_read_psw_o         => psw_read_psw_s,
426
      psw_read_sp_o          => psw_read_sp_s,
427
      psw_write_psw_o        => psw_write_psw_s,
428
      psw_write_sp_o         => psw_write_sp_s,
429
      alu_carry_i            => alu_carry_s,
430
      alu_op_o               => alu_op_s,
431
      alu_use_carry_o        => alu_use_carry_s,
432 28 arniml
      alu_da_high_o          => alu_da_high_s,
433
      alu_da_overflow_i      => alu_da_overflow_s,
434 38 arniml
      alu_accu_low_o         => alu_accu_low_s,
435 28 arniml
      alu_p06_temp_reg_o     => alu_p06_temp_reg_s,
436
      alu_p60_temp_reg_o     => alu_p60_temp_reg_s,
437 4 arniml
      bus_output_pcl_o       => bus_output_pcl_s,
438
      bus_bidir_bus_o        => bus_bidir_bus_s,
439
      clk_multi_cycle_o      => clk_multi_cycle_s,
440
      clk_assert_psen_o      => clk_assert_psen_s,
441
      clk_assert_prog_o      => clk_assert_prog_s,
442
      clk_assert_rd_o        => clk_assert_rd_s,
443
      clk_assert_wr_o        => clk_assert_wr_s,
444
      clk_mstate_i           => clk_mstate_s,
445
      clk_second_cycle_i     => clk_second_cycle_s,
446
      cnd_compute_take_o     => cnd_compute_take_s,
447
      cnd_branch_cond_o      => cnd_branch_cond_s,
448
      cnd_take_branch_i      => cnd_take_branch_s,
449
      cnd_comp_value_o       => cnd_comp_value_s,
450
      cnd_f1_o               => cnd_f1_s,
451
      cnd_tf_o               => cnd_tf_s,
452
      dm_addr_type_o         => dm_addr_type_s,
453
      tim_read_timer_o       => tim_read_timer_s,
454
      tim_write_timer_o      => tim_write_timer_s,
455
      tim_start_t_o          => tim_start_t_s,
456
      tim_start_cnt_o        => tim_start_cnt_s,
457
      tim_stop_tcnt_o        => tim_stop_tcnt_s,
458
      p1_read_reg_o          => p1_read_reg_s,
459
      p2_read_reg_o          => p2_read_reg_s,
460 24 arniml
      p2_read_exp_o          => p2_read_exp_s,
461 4 arniml
      p2_output_pch_o        => p2_output_pch_s,
462
      pm_inc_pc_o            => pm_inc_pc_s,
463
      pm_write_pmem_addr_o   => pm_write_pmem_addr_s,
464
      pm_addr_type_o         => pm_addr_type_s,
465
      psw_special_data_o     => psw_special_data_s,
466
      psw_carry_i            => psw_carry_s,
467 28 arniml
      psw_aux_carry_i        => psw_aux_carry_s,
468 4 arniml
      psw_f0_i               => psw_f0_s,
469
      psw_inc_stackp_o       => psw_inc_stackp_s,
470
      psw_dec_stackp_o       => psw_dec_stackp_s,
471
      psw_write_carry_o      => psw_write_carry_s,
472
      psw_write_aux_carry_o  => psw_write_aux_carry_s,
473
      psw_write_f0_o         => psw_write_f0_s,
474
      psw_write_bs_o         => psw_write_bs_s,
475
      tim_overflow_i         => tim_overflow_s
476
    );
477
 
478 179 arniml
  dmem_ctrl_b : t48_dmem_ctrl
479 4 arniml
    port map (
480
      clk_i             => clk_i,
481
      res_i             => reset_i,
482
      en_clk_i          => en_clk_s,
483
      data_i            => t48_data_s,
484
      write_dmem_addr_i => dm_write_dmem_addr_s,
485
      write_dmem_i      => dm_write_dmem_s,
486
      read_dmem_i       => dm_read_dmem_s,
487
      addr_type_i       => dm_addr_type_s,
488
      bank_select_i     => psw_bs_s,
489
      data_o            => dm_data_s,
490
      dmem_data_i       => dmem_data_i,
491
      dmem_addr_o       => dmem_addr_o,
492
      dmem_we_o         => dmem_we_o,
493
      dmem_data_o       => dmem_data_o
494
    );
495
 
496
  use_timer: if include_timer_g = 1 generate
497 179 arniml
    timer_b : t48_timer
498 4 arniml
      generic map (
499
        sample_t1_state_g => sample_t1_state_g
500
      )
501
      port map (
502
        clk_i         => clk_i,
503
        res_i         => reset_i,
504
        en_clk_i      => en_clk_s,
505
        t1_i          => To_X01Z(t1_i),
506
        clk_mstate_i  => clk_mstate_s,
507
        data_i        => t48_data_s,
508
        data_o        => tim_data_s,
509
        read_timer_i  => tim_read_timer_s,
510
        write_timer_i => tim_write_timer_s,
511
        start_t_i     => tim_start_t_s,
512
        start_cnt_i   => tim_start_cnt_s,
513
        stop_tcnt_i   => tim_stop_tcnt_s,
514
        overflow_o    => tim_of_s
515
      );
516
  end generate;
517
 
518
  skip_timer: if include_timer_g = 0 generate
519
    tim_data_s <= (others => bus_idle_level_c);
520
    tim_of_s   <= '0';
521
  end generate;
522
 
523
  tim_overflow_s <= to_boolean(tim_of_s);
524
 
525
  use_p1: if include_port1_g = 1 generate
526 179 arniml
    p1_b : t48_p1
527 4 arniml
      port map (
528 32 arniml
        clk_i        => clk_i,
529
        res_i        => reset_i,
530
        en_clk_i     => en_clk_s,
531
        data_i       => t48_data_s,
532
        data_o       => p1_data_s,
533
        write_p1_i   => p1_write_p1_s,
534
        read_p1_i    => p1_read_p1_s,
535
        read_reg_i   => p1_read_reg_s,
536
        p1_i         => p1_i,
537
        p1_o         => p1_o,
538
        p1_low_imp_o => p1_low_imp_o
539 4 arniml
      );
540
  end generate;
541
 
542
  skip_p1: if include_port1_g = 0 generate
543 32 arniml
    p1_data_s    <= (others => bus_idle_level_c);
544
    p1_o         <= (others => '0');
545
    p1_low_imp_o <= '0';
546 4 arniml
  end generate;
547
 
548
  use_p2: if include_port2_g = 1 generate
549 179 arniml
    p2_b : t48_p2
550 4 arniml
      port map (
551 208 arniml
        clk_i         => clk_i,
552
        res_i         => reset_i,
553
        en_clk_i      => en_clk_s,
554
        xtal_i        => xtal_i,
555 220 arniml
        xtal_en_i     => xtal_en_s,
556 208 arniml
        data_i        => t48_data_s,
557
        data_o        => p2_data_s,
558
        write_p2_i    => p2_write_p2_s,
559
        write_exp_i   => p2_write_exp_s,
560
        read_p2_i     => p2_read_p2_s,
561
        read_reg_i    => p2_read_reg_s,
562
        read_exp_i    => p2_read_exp_s,
563
        output_pch_i  => p2_output_pch_s,
564
        pch_i         => pmem_addr_s(11 downto 8),
565
        p2_i          => p2_i,
566
        p2_o          => p2_o,
567
        p2l_low_imp_o => p2l_low_imp_o,
568
        p2h_low_imp_o => p2h_low_imp_o
569 4 arniml
      );
570
  end generate;
571
 
572
  skip_p2: if include_port2_g = 0 generate
573 208 arniml
    p2_data_s     <= (others => bus_idle_level_c);
574
    p2_o          <= (others => '0');
575
    p2l_low_imp_o <= '0';
576
    p2h_low_imp_o <= '0';
577 4 arniml
  end generate;
578
 
579 179 arniml
  pmem_ctrl_b : t48_pmem_ctrl
580 4 arniml
    port map (
581
      clk_i             => clk_i,
582
      res_i             => reset_i,
583
      en_clk_i          => en_clk_s,
584
      data_i            => t48_data_s,
585
      data_o            => pm_data_s,
586
      write_pcl_i       => pm_write_pcl_s,
587
      read_pcl_i        => pm_read_pcl_s,
588
      write_pch_i       => pm_write_pch_s,
589
      read_pch_i        => pm_read_pch_s,
590
      inc_pc_i          => pm_inc_pc_s,
591
      write_pmem_addr_i => pm_write_pmem_addr_s,
592
      addr_type_i       => pm_addr_type_s,
593
      read_pmem_i       => pm_read_pmem_s,
594
      pmem_addr_o       => pmem_addr_s,
595
      pmem_data_i       => pmem_data_i
596
    );
597
 
598 179 arniml
  psw_b : t48_psw
599 4 arniml
    port map (
600
      clk_i              => clk_i,
601
      res_i              => reset_i,
602
      en_clk_i           => en_clk_s,
603
      data_i             => t48_data_s,
604
      data_o             => psw_data_s,
605
      read_psw_i         => psw_read_psw_s,
606
      read_sp_i          => psw_read_sp_s,
607
      write_psw_i        => psw_write_psw_s,
608
      write_sp_i         => psw_write_sp_s,
609
      special_data_i     => psw_special_data_s,
610
      inc_stackp_i       => psw_inc_stackp_s,
611
      dec_stackp_i       => psw_dec_stackp_s,
612
      write_carry_i      => psw_write_carry_s,
613
      write_aux_carry_i  => psw_write_aux_carry_s,
614
      write_f0_i         => psw_write_f0_s,
615
      write_bs_i         => psw_write_bs_s,
616
      carry_o            => psw_carry_s,
617 28 arniml
      aux_carry_i        => alu_aux_carry_s,
618 4 arniml
      aux_carry_o        => psw_aux_carry_s,
619
      f0_o               => psw_f0_s,
620
      bs_o               => psw_bs_s
621
    );
622
 
623
 
624
  -----------------------------------------------------------------------------
625
  -- Output Mapping.
626
  -----------------------------------------------------------------------------
627
  ale_o       <= to_stdLogic(ale_s);
628
  psen_n_o    <= to_stdLogic(not psen_s);
629
  prog_n_o    <= to_stdLogic(not prog_s);
630
  rd_n_o      <= to_stdLogic(not rd_s);
631
  wr_n_o      <= to_stdLogic(not wr_s);
632
  xtal3_o     <= to_stdLogic(xtal3_s);
633
  pmem_addr_o <= pmem_addr_s;
634
 
635
end struct;
636
 
637
 
638
-------------------------------------------------------------------------------
639
-- File History:
640
--
641
-- $Log: not supported by cvs2svn $
642 220 arniml
-- Revision 1.10  2005/11/01 21:32:58  arniml
643
-- wire signals for P2 low impeddance marker issue
644
--
645 208 arniml
-- Revision 1.9  2005/06/11 10:08:43  arniml
646
-- introduce prefix 't48_' for all packages, entities and configurations
647
--
648 179 arniml
-- Revision 1.8  2005/05/04 20:12:37  arniml
649
-- Fix bug report:
650
-- "Wrong clock applied to T0"
651
-- t0_o is generated inside clock_ctrl with a separate flip-flop running
652
-- with xtal_i
653
--
654 162 arniml
-- Revision 1.7  2004/05/01 11:58:04  arniml
655
-- update notice about expander port instructions
656
--
657 86 arniml
-- Revision 1.6  2004/04/07 22:09:03  arniml
658
-- remove unused signals
659
--
660 45 arniml
-- Revision 1.5  2004/04/04 14:18:53  arniml
661
-- add measures to implement XCHD
662
--
663 38 arniml
-- Revision 1.4  2004/03/29 19:39:58  arniml
664
-- rename pX_limp to pX_low_imp
665
--
666 32 arniml
-- Revision 1.3  2004/03/28 21:27:50  arniml
667
-- update wiring for DA support
668
--
669 28 arniml
-- Revision 1.2  2004/03/28 13:13:20  arniml
670
-- connect control signal for Port 2 expander
671
--
672 24 arniml
-- Revision 1.1  2004/03/23 21:31:53  arniml
673
-- initial check-in
674 4 arniml
--
675
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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