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

Subversion Repositories t400

[/] [t400/] [trunk/] [rtl/] [vhdl/] [t400_core.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 arniml
-------------------------------------------------------------------------------
2
--
3
-- T400 Microcontroller Core
4
--
5
-- $Id: t400_core.vhd,v 1.1.1.1 2006-05-06 01:56:44 arniml Exp $
6
--
7
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org)
8
--
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/t400/
43
--
44
-- Limitations :
45
-- =============
46
--
47
-- Compared to the original COP400 architecture, the following limitations
48
-- apply:
49
--
50
--   * Features of the COP42x devices are either not yet implemented or
51
--     not verified.
52
--
53
-------------------------------------------------------------------------------
54
 
55
library ieee;
56
use ieee.std_logic_1164.all;
57
 
58
use work.t400_opt_pack.all;
59
 
60
entity t400_core is
61
 
62
  generic (
63
    opt_type_g           : integer := t400_opt_type_420_c;
64
    opt_ck_div_g         : integer := t400_opt_ck_div_16_c;
65
    opt_cko_g            : integer := t400_opt_cko_crystal_c;
66
    opt_l_out_type_7_g   : integer := t400_opt_out_type_std_c;
67
    opt_l_out_type_6_g   : integer := t400_opt_out_type_std_c;
68
    opt_l_out_type_5_g   : integer := t400_opt_out_type_std_c;
69
    opt_l_out_type_4_g   : integer := t400_opt_out_type_std_c;
70
    opt_l_out_type_3_g   : integer := t400_opt_out_type_std_c;
71
    opt_l_out_type_2_g   : integer := t400_opt_out_type_std_c;
72
    opt_l_out_type_1_g   : integer := t400_opt_out_type_std_c;
73
    opt_l_out_type_0_g   : integer := t400_opt_out_type_std_c;
74
    opt_microbus_g       : integer := t400_opt_no_microbus_c;
75
    opt_d_out_type_3_g   : integer := t400_opt_out_type_std_c;
76
    opt_d_out_type_2_g   : integer := t400_opt_out_type_std_c;
77
    opt_d_out_type_1_g   : integer := t400_opt_out_type_std_c;
78
    opt_d_out_type_0_g   : integer := t400_opt_out_type_std_c;
79
    opt_g_out_type_3_g   : integer := t400_opt_out_type_std_c;
80
    opt_g_out_type_2_g   : integer := t400_opt_out_type_std_c;
81
    opt_g_out_type_1_g   : integer := t400_opt_out_type_std_c;
82
    opt_g_out_type_0_g   : integer := t400_opt_out_type_std_c;
83
    opt_so_output_type_g : integer := t400_opt_out_type_std_c;
84
    opt_sk_output_type_g : integer := t400_opt_out_type_std_c
85
  );
86
  port (
87
    ck_i      : in  std_logic;
88
    ck_en_i   : in  std_logic;
89
    por_n_i   : in  std_logic;
90
    reset_n_i : in  std_logic;
91
    cko_i     : in  std_logic;
92
    pm_addr_o : out std_logic_vector(9 downto 0);
93
    pm_data_i : in  std_logic_vector(7 downto 0);
94
    dm_addr_o : out std_logic_vector(5 downto 0);
95
    dm_we_o   : out std_logic;
96
    dm_data_o : out std_logic_vector(3 downto 0);
97
    dm_data_i : in  std_logic_vector(3 downto 0);
98
    io_l_i    : in  std_logic_vector(7 downto 0);
99
    io_l_o    : out std_logic_vector(7 downto 0);
100
    io_l_en_o : out std_logic_vector(7 downto 0);
101
    io_d_o    : out std_logic_vector(3 downto 0);
102
    io_d_en_o : out std_logic_vector(3 downto 0);
103
    io_g_i    : in  std_logic_vector(3 downto 0);
104
    io_g_o    : out std_logic_vector(3 downto 0);
105
    io_g_en_o : out std_logic_vector(3 downto 0);
106
    io_in_i   : in  std_logic_vector(3 downto 0);
107
    si_i      : in  std_logic;
108
    so_o      : out std_logic;
109
    so_en_o   : out std_logic;
110
    sk_o      : out std_logic;
111
    sk_en_o   : out std_logic
112
  );
113
 
114
end t400_core;
115
 
116
 
117
use work.t400_pack.all;
118
use work.t400_comp_pack.all;
119
 
120
architecture struct of t400_core is
121
 
122
  signal ck_en_s         : boolean;
123
  signal por_s           : boolean;
124
  signal res_s           : boolean;
125
 
126
  signal phi1_s          : std_logic;
127
  signal out_en_s        : boolean;
128
  signal in_en_s         : boolean;
129
  signal icyc_en_s       : boolean;
130
 
131
  signal pm_addr_s       : pc_t;
132
 
133
  signal a_s             : dw_t;
134
  signal dec_data_s      : dec_data_t;
135
 
136
  signal pc_to_stack_s,
137
         pc_from_stack_s : pc_t;
138
 
139
  signal q_s             : byte_t;
140
  signal b_s             : b_t;
141
 
142
  signal c_s,
143
         carry_s         : std_logic;
144
 
145
  signal sio_s           : dw_t;
146
 
147
  signal pc_op_s         : pc_op_t;
148
  signal stack_op_s      : stack_op_t;
149
  signal dmem_op_s       : dmem_op_t;
150
  signal b_op_s          : b_op_t;
151
  signal skip_op_s       : skip_op_t;
152
  signal alu_op_s        : alu_op_t;
153
  signal io_l_op_s       : io_l_op_t;
154
  signal io_d_op_s       : io_d_op_t;
155
  signal io_g_op_s       : io_g_op_t;
156
  signal sio_op_s        : sio_op_t;
157
  signal is_lbi_s        : boolean;
158
  signal en_s            : dw_t;
159
 
160
  signal skip_s,
161
         skip_lbi_s      : boolean;
162
 
163
  signal in_s,
164
         il_s            : dw_t;
165
 
166
  signal vdd_s  : std_logic;
167
  signal gnd4_s : dw_t;
168
 
169
begin
170
 
171
  -- dummies
172
  vdd_s  <= '1';
173
  gnd4_s <= (others => '0');
174
  in_s   <= (others => '0');
175
  il_s   <= (others => '0');
176
 
177
  ck_en_s <= ck_en_i = '1';
178
  por_s   <= por_n_i  = '0';
179
 
180
  -----------------------------------------------------------------------------
181
  -- Clock generator
182
  -----------------------------------------------------------------------------
183
  clkgen_b : t400_clkgen
184
    generic map (
185
      opt_ck_div_g => opt_ck_div_g
186
    )
187
    port map (
188
      ck_i      => ck_i,
189
      ck_en_i   => ck_en_s,
190
      por_i     => por_s,
191
      phi1_o    => phi1_s,
192
      out_en_o  => out_en_s,
193
      in_en_o   => in_en_s,
194
      icyc_en_o => icyc_en_s
195
    );
196
 
197
 
198
  -----------------------------------------------------------------------------
199
  -- Reset module
200
  -----------------------------------------------------------------------------
201
  reset_b : t400_reset
202
    port map (
203
      ck_i      => ck_i,
204
      icyc_en_i => icyc_en_s,
205
      por_i     => por_s,
206
      reset_n_i => reset_n_i,
207
      res_o     => res_s
208
    );
209
 
210
 
211
  -----------------------------------------------------------------------------
212
  -- Program memory controller
213
  -----------------------------------------------------------------------------
214
  pmem_ctrl_b : t400_pmem_ctrl
215
    generic map (
216
      opt_type_g => opt_type_g
217
    )
218
    port map (
219
      ck_i       => ck_i,
220
      ck_en_i    => ck_en_s,
221
      por_i      => por_s,
222
      res_i      => res_s,
223
      a_i        => a_s,
224
      m_i        => dm_data_i,
225
      op_i       => pc_op_s,
226
      dec_data_i => dec_data_s,
227
      pc_o       => pc_to_stack_s,
228
      pc_i       => pc_from_stack_s,
229
      pm_addr_o  => pm_addr_s
230
    );
231
  --
232
  pm_addr_o <= std_logic_vector(pm_addr_s);
233
 
234
 
235
  -----------------------------------------------------------------------------
236
  -- Data memory controller
237
  -----------------------------------------------------------------------------
238
  dmem_ctrl_b : t400_dmem_ctrl
239
    generic map (
240
      opt_type_g => opt_type_g
241
    )
242
    port map (
243
      ck_i       => ck_i,
244
      ck_en_i    => ck_en_s,
245
      por_i      => por_s,
246
      res_i      => res_s,
247
      dmem_op_i  => dmem_op_s,
248
      b_op_i     => b_op_s,
249
      dec_data_i => dec_data_s,
250
      a_i        => a_s,
251
      q_high_i   => q_s(7 downto 4),
252
      b_o        => b_s,
253
      dm_addr_o  => dm_addr_o,
254
      dm_data_i  => dm_data_i,
255
      dm_data_o  => dm_data_o,
256
      dm_we_o    => dm_we_o
257
    );
258
 
259
 
260
  -----------------------------------------------------------------------------
261
  -- Decoder
262
  -----------------------------------------------------------------------------
263
  decoder_b : t400_decoder
264
    generic map (
265
      opt_type_g => opt_type_g
266
    )
267
    port map (
268
      ck_i       => ck_i,
269
      ck_en_i    => ck_en_s,
270
      por_i      => por_s,
271
      res_i      => res_s,
272
      out_en_i   => out_en_s,
273
      in_en_i    => in_en_s,
274
      icyc_en_i  => icyc_en_s,
275
      pc_op_o    => pc_op_s,
276
      stack_op_o => stack_op_s,
277
      dmem_op_o  => dmem_op_s,
278
      b_op_o     => b_op_s,
279
      skip_op_o  => skip_op_s,
280
      alu_op_o   => alu_op_s,
281
      io_l_op_o  => io_l_op_s,
282
      io_d_op_o  => io_d_op_s,
283
      io_g_op_o  => io_g_op_s,
284
      sio_op_o   => sio_op_s,
285
      dec_data_o => dec_data_s,
286
      is_lbi_o   => is_lbi_s,
287
      en_o       => en_s,
288
      skip_i     => skip_s,
289
      skip_lbi_i => skip_lbi_s,
290
      pm_addr_i  => pm_addr_s,
291
      pm_data_i  => pm_data_i
292
    );
293
 
294
 
295
  -----------------------------------------------------------------------------
296
  -- Skip logic
297
  -----------------------------------------------------------------------------
298
  skip_b : t400_skip
299
    port map (
300
      ck_i       => ck_i,
301
      ck_en_i    => ck_en_s,
302
      por_i      => por_s,
303
      res_i      => res_s,
304
      op_i       => skip_op_s,
305
      dec_data_i => dec_data_s,
306
      carry_i    => carry_s,
307
      c_i        => c_s,
308
      bd_i       => b_s(bd_range_t),
309
      is_lbi_i   => is_lbi_s,
310
      a_i        => a_s,
311
      m_i        => dm_data_i,
312
      g_i        => io_g_i,
313
      tim_c_i    => gnd4_s(0),
314
      skip_o     => skip_s,
315
      skip_lbi_o => skip_lbi_s
316
    );
317
 
318
 
319
  -----------------------------------------------------------------------------
320
  -- ALU
321
  -----------------------------------------------------------------------------
322
  alu_b : t400_alu
323
    port map (
324
      ck_i       => ck_i,
325
      ck_en_i    => ck_en_s,
326
      por_i      => por_s,
327
      res_i      => res_s,
328
      op_i       => alu_op_s,
329
      m_i        => dm_data_i,
330
      dec_data_i => dec_data_s,
331
      q_low_i    => q_s(3 downto 0),
332
      b_i        => b_s,
333
      g_i        => io_g_i,
334
      in_i       => in_s,
335
      il_i       => il_s,
336
      sio_i      => sio_s,
337
      a_o        => a_s,
338
      carry_o    => carry_s,
339
      c_o        => c_s
340
    );
341
 
342
 
343
  -----------------------------------------------------------------------------
344
  -- Stack module
345
  -----------------------------------------------------------------------------
346
  stack_b : t400_stack
347
    generic map (
348
      opt_type_g => opt_type_g
349
    )
350
    port map (
351
      ck_i    => ck_i,
352
      ck_en_i => ck_en_s,
353
      por_i   => por_s,
354
      op_i    => stack_op_s,
355
      pc_i    => pc_to_stack_s,
356
      pc_o    => pc_from_stack_s
357
    );
358
 
359
 
360
  -----------------------------------------------------------------------------
361
  -- IO L module
362
  -----------------------------------------------------------------------------
363
  io_l_b : t400_io_l
364
    generic map (
365
      opt_out_type_7_g => opt_l_out_type_7_g,
366
      opt_out_type_6_g => opt_l_out_type_6_g,
367
      opt_out_type_5_g => opt_l_out_type_5_g,
368
      opt_out_type_4_g => opt_l_out_type_4_g,
369
      opt_out_type_3_g => opt_l_out_type_3_g,
370
      opt_out_type_2_g => opt_l_out_type_2_g,
371
      opt_out_type_1_g => opt_l_out_type_1_g,
372
      opt_out_type_0_g => opt_l_out_type_0_g,
373
      opt_microbus_g   => opt_microbus_g
374
    )
375
    port map (
376
      ck_i      => ck_i,
377
      ck_en_i   => ck_en_s,
378
      por_i     => por_s,
379
      op_i      => io_l_op_s,
380
      en2_i     => en_s(2),
381
      m_i       => dm_data_i,
382
      a_i       => a_s,
383
      pm_data_i => pm_data_i,
384
      q_o       => q_s,
385
      cs_n_i    => vdd_s,
386
      rd_n_i    => vdd_s,
387
      wr_n_i    => vdd_s,
388
      io_l_i    => io_l_i,
389
      io_l_o    => io_l_o,
390
      io_l_en_o => io_l_en_o
391
    );
392
 
393
 
394
  -----------------------------------------------------------------------------
395
  -- IO D module
396
  -----------------------------------------------------------------------------
397
  io_d_b : t400_io_d
398
    generic map (
399
      opt_out_type_3_g => opt_d_out_type_3_g,
400
      opt_out_type_2_g => opt_d_out_type_2_g,
401
      opt_out_type_1_g => opt_d_out_type_1_g,
402
      opt_out_type_0_g => opt_d_out_type_0_g
403
    )
404
    port map (
405
      ck_i      => ck_i,
406
      ck_en_i   => ck_en_s,
407
      por_i     => por_s,
408
      res_i     => res_s,
409
      op_i      => io_d_op_s,
410
      bd_i      => b_s(bd_range_t),
411
      io_d_o    => io_d_o,
412
      io_d_en_o => io_d_en_o
413
    );
414
 
415
 
416
  -----------------------------------------------------------------------------
417
  -- IO G modle
418
  -----------------------------------------------------------------------------
419
  io_g_b : t400_io_g
420
    generic map (
421
      opt_out_type_3_g => opt_g_out_type_3_g,
422
      opt_out_type_2_g => opt_g_out_type_2_g,
423
      opt_out_type_1_g => opt_g_out_type_1_g,
424
      opt_out_type_0_g => opt_g_out_type_0_g
425
    )
426
    port map (
427
      ck_i       => ck_i,
428
      ck_en_i    => ck_en_s,
429
      por_i      => por_s,
430
      res_i      => res_s,
431
      op_i       => io_g_op_s,
432
      m_i        => dm_data_i,
433
      dec_data_i => dec_data_s,
434
      io_g_o     => io_g_o,
435
      io_g_en_o  => io_g_en_o
436
    );
437
 
438
 
439
  -----------------------------------------------------------------------------
440
  -- SIO module
441
  -----------------------------------------------------------------------------
442
  sio_b : t400_sio
443
    generic map (
444
      opt_so_output_type_g => opt_so_output_type_g,
445
      opt_sk_output_type_g => opt_sk_output_type_g
446
    )
447
    port map (
448
      ck_i       => ck_i,
449
      ck_en_i    => ck_en_s,
450
      por_i      => por_s,
451
      res_i      => res_s,
452
      phi1_i     => phi1_s,
453
      out_en_i   => out_en_s,
454
      in_en_i    => in_en_s,
455
      op_i       => sio_op_s,
456
      en0_i      => en_s(0),
457
      en3_i      => en_s(3),
458
      a_i        => a_s,
459
      c_i        => c_s,
460
      sio_o      => sio_s,
461
      si_i       => si_i,
462
      so_o       => so_o,
463
      so_en_o    => so_en_o,
464
      sk_o       => sk_o,
465
      sk_en_o    => sk_en_o
466
    );
467
 
468
end struct;
469
 
470
 
471
-------------------------------------------------------------------------------
472
-- File History:
473
--
474
-- $Log: not supported by cvs2svn $
475
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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