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 277

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

powered by: WebSVN 2.1.0

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