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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [xilinx_diligent_s3board/] [rtl/] [verilog/] [openmsp430/] [openMSP430_defines.v] - Blame information for rev 151

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

Line No. Rev Author Line
1 2 olivier.gi
//----------------------------------------------------------------------------
2 136 olivier.gi
// Copyright (C) 2009 , Olivier Girard
3 2 olivier.gi
//
4 136 olivier.gi
// Redistribution and use in source and binary forms, with or without
5
// modification, are permitted provided that the following conditions
6
// are met:
7
//     * Redistributions of source code must retain the above copyright
8
//       notice, this list of conditions and the following disclaimer.
9
//     * Redistributions in binary form must reproduce the above copyright
10
//       notice, this list of conditions and the following disclaimer in the
11
//       documentation and/or other materials provided with the distribution.
12
//     * Neither the name of the authors nor the names of its contributors
13
//       may be used to endorse or promote products derived from this software
14
//       without specific prior written permission.
15 2 olivier.gi
//
16 136 olivier.gi
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26
// THE POSSIBILITY OF SUCH DAMAGE
27 2 olivier.gi
//
28
//----------------------------------------------------------------------------
29
// 
30 23 olivier.gi
// *File Name: openMSP430_defines.v
31 2 olivier.gi
// 
32
// *Module Description:
33
//                      openMSP430 Configuration file
34
//
35
// *Author(s):
36
//              - Olivier Girard,    olgirard@gmail.com
37
//
38
//----------------------------------------------------------------------------
39 17 olivier.gi
// $Rev: 151 $
40
// $LastChangedBy: olivier.girard $
41
// $LastChangedDate: 2012-07-23 00:24:11 +0200 (Mon, 23 Jul 2012) $
42
//----------------------------------------------------------------------------
43 104 olivier.gi
//`define OMSP_NO_INCLUDE
44
`ifdef OMSP_NO_INCLUDE
45
`else
46 33 olivier.gi
`include "openMSP430_undefines.v"
47 104 olivier.gi
`endif
48 2 olivier.gi
 
49 111 olivier.gi
//============================================================================
50
//============================================================================
51
// BASIC SYSTEM CONFIGURATION
52
//============================================================================
53
//============================================================================
54 72 olivier.gi
//
55 111 olivier.gi
// Note: the sum of program, data and peripheral memory spaces must not
56
//      exceed 64 kB
57 72 olivier.gi
//
58 2 olivier.gi
 
59 33 olivier.gi
// Program Memory Size:
60 72 olivier.gi
//                     Uncomment the required memory size
61
//-------------------------------------------------------
62 151 olivier.gi
//`define PMEM_SIZE_CUSTOM
63 72 olivier.gi
//`define PMEM_SIZE_59_KB
64
//`define PMEM_SIZE_55_KB
65
//`define PMEM_SIZE_54_KB
66
//`define PMEM_SIZE_51_KB
67
//`define PMEM_SIZE_48_KB
68
//`define PMEM_SIZE_41_KB
69
//`define PMEM_SIZE_32_KB
70
//`define PMEM_SIZE_24_KB
71
//`define PMEM_SIZE_16_KB
72
//`define PMEM_SIZE_12_KB
73
//`define PMEM_SIZE_8_KB
74
`define PMEM_SIZE_4_KB
75
//`define PMEM_SIZE_2_KB
76
//`define PMEM_SIZE_1_KB
77 2 olivier.gi
 
78 111 olivier.gi
 
79 33 olivier.gi
// Data Memory Size:
80 72 olivier.gi
//                     Uncomment the required memory size
81
//-------------------------------------------------------
82 151 olivier.gi
//`define DMEM_SIZE_CUSTOM
83 72 olivier.gi
//`define DMEM_SIZE_32_KB
84
//`define DMEM_SIZE_24_KB
85
//`define DMEM_SIZE_16_KB
86
//`define DMEM_SIZE_10_KB
87
//`define DMEM_SIZE_8_KB
88
//`define DMEM_SIZE_5_KB
89
//`define DMEM_SIZE_4_KB
90
//`define DMEM_SIZE_2p5_KB
91
//`define DMEM_SIZE_2_KB
92
`define DMEM_SIZE_1_KB
93
//`define DMEM_SIZE_512_B
94
//`define DMEM_SIZE_256_B
95
//`define DMEM_SIZE_128_B
96 2 olivier.gi
 
97 111 olivier.gi
 
98 71 olivier.gi
// Include/Exclude Hardware Multiplier
99
`define MULTIPLIER
100
 
101
 
102 111 olivier.gi
// Include/Exclude Serial Debug interface
103 2 olivier.gi
`define DBG_EN
104
 
105 111 olivier.gi
 
106
//============================================================================
107
//============================================================================
108
// ADVANCED SYSTEM CONFIGURATION (FOR EXPERIENCED USERS)
109
//============================================================================
110
//============================================================================
111
 
112
//-------------------------------------------------------
113 136 olivier.gi
// Custom user version number
114
//-------------------------------------------------------
115
// This 5 bit field can be freely used in order to allow
116
// custom identification of the system through the debug
117
// interface.
118
// (see CPU_ID.USER_VERSION field in the documentation)
119
//-------------------------------------------------------
120
`define USER_VERSION 5'b00001
121
 
122
 
123
//-------------------------------------------------------
124
// Include/Exclude Watchdog timer
125
//-------------------------------------------------------
126
// When excluded, the following functionality will be
127
// lost:
128
//        - Watchog (both interval and watchdog modes)
129
//        - NMI interrupt edge selection
130
//        - Possibility to generate a software PUC reset
131
//-------------------------------------------------------
132
`define WATCHDOG
133
 
134
 
135
///-------------------------------------------------------
136
// Include/Exclude Non-Maskable-Interrupt support
137
//-------------------------------------------------------
138
`define NMI
139
 
140
 
141
//-------------------------------------------------------
142
// Input synchronizers
143
//-------------------------------------------------------
144
// In some cases, the asynchronous input ports might
145
// already be synchronized externally.
146
// If an extensive CDC design review showed that this
147
// is really the case,  the individual synchronizers
148
// can be disabled with the following defines.
149
//
150
// Notes:
151
//        - all three signals are all sampled in the MCLK domain
152
//
153
//        - the dbg_en signal reset the debug interface
154
//         when 0. Therefore make sure it is glitch free.
155
//
156
//-------------------------------------------------------
157
`define SYNC_NMI
158
`define SYNC_CPU_EN
159
`define SYNC_DBG_EN
160
 
161
 
162
//-------------------------------------------------------
163 111 olivier.gi
// Peripheral Memory Space:
164
//-------------------------------------------------------
165
// The original MSP430 architecture map the peripherals
166
// from 0x0000 to 0x01FF (i.e. 512B of the memory space).
167
// The following defines allow you to expand this space
168
// up to 32 kB (i.e. from 0x0000 to 0x7fff).
169
// As a consequence, the data memory mapping will be
170
// shifted up and a custom linker script will therefore
171
// be required by the GCC compiler.
172
//-------------------------------------------------------
173 151 olivier.gi
//`define PER_SIZE_CUSTOM
174 111 olivier.gi
//`define PER_SIZE_32_KB
175
//`define PER_SIZE_16_KB
176
//`define PER_SIZE_8_KB
177
//`define PER_SIZE_4_KB
178
//`define PER_SIZE_2_KB
179
//`define PER_SIZE_1_KB
180
`define PER_SIZE_512_B
181
 
182
 
183
//-------------------------------------------------------
184
// Defines the debugger CPU_CTL.RST_BRK_EN reset value
185
// (CPU break on PUC reset)
186
//-------------------------------------------------------
187
// When defined, the CPU will automatically break after
188 136 olivier.gi
// a PUC occurrence by default. This is typically useful
189 111 olivier.gi
// when the program memory can only be initialized through
190
// the serial debug interface.
191
//-------------------------------------------------------
192
//`define DBG_RST_BRK_EN
193
 
194
 
195
//============================================================================
196
//============================================================================
197
// EXPERT SYSTEM CONFIGURATION ( !!!! EXPERTS ONLY !!!! )
198
//============================================================================
199
//============================================================================
200 2 olivier.gi
//
201 111 olivier.gi
// IMPORTANT NOTE:  Please update following configuration options ONLY if
202
//                 you have a good reason to do so... and if you know what
203
//                 you are doing :-P
204
//
205
//============================================================================
206 2 olivier.gi
 
207 111 olivier.gi
//-------------------------------------------------------
208 136 olivier.gi
// Number of hardware breakpoint/watchpoint units
209
// (each unit contains two hardware addresses available
210
// for breakpoints or watchpoints):
211 111 olivier.gi
//   - DBG_HWBRK_0 -> Include hardware breakpoints unit 0
212
//   - DBG_HWBRK_1 -> Include hardware breakpoints unit 1
213
//   - DBG_HWBRK_2 -> Include hardware breakpoints unit 2
214
//   - DBG_HWBRK_3 -> Include hardware breakpoints unit 3
215
//-------------------------------------------------------
216
// Please keep in mind that hardware breakpoints only
217
// make sense whenever the program memory is not an SRAM
218
// (i.e. Flash/OTP/ROM/...) or when you are interested
219 136 olivier.gi
// in data breakpoints.
220 111 olivier.gi
//-------------------------------------------------------
221 2 olivier.gi
`define  DBG_HWBRK_0
222 37 olivier.gi
//`define  DBG_HWBRK_1
223
//`define  DBG_HWBRK_2
224
//`define  DBG_HWBRK_3
225 2 olivier.gi
 
226
 
227 111 olivier.gi
//-------------------------------------------------------
228
// Enable/Disable the hardware breakpoint RANGE mode
229
//-------------------------------------------------------
230
// When enabled this feature allows the hardware breakpoint
231
// units to stop the cpu whenever an instruction or data
232
// access lays within an address range.
233
// Note that this feature is not supported by GDB.
234
//-------------------------------------------------------
235
//`define DBG_HWBRK_RANGE
236
 
237
 
238
//-------------------------------------------------------
239 151 olivier.gi
// Custom Program/Data and Peripheral Memory Spaces
240
//-------------------------------------------------------
241
// The following values are valid only if the
242
// corresponding *_SIZE_CUSTOM defines are uncommented:
243
//
244
//  - *_SIZE   : size of the section in bytes.
245
//  - *_AWIDTH : address port width, this value must allow
246
//               to address all WORDS of the section
247
//               (i.e. the *_SIZE divided by 2)
248
//-------------------------------------------------------
249
 
250
// Custom Program memory (enabled with PMEM_SIZE_CUSTOM)
251
`define PMEM_CUSTOM_AWIDTH      10
252
`define PMEM_CUSTOM_SIZE      2048
253
 
254
// Custom Data memory    (enabled with DMEM_SIZE_CUSTOM)
255
`define DMEM_CUSTOM_AWIDTH       6
256
`define DMEM_CUSTOM_SIZE       128
257
 
258
// Custom Peripheral memory  (enabled with PER_SIZE_CUSTOM)
259
`define PER_CUSTOM_AWIDTH        8
260
`define PER_CUSTOM_SIZE        512
261
 
262
 
263
//-------------------------------------------------------
264 136 olivier.gi
// ASIC version
265 111 olivier.gi
//-------------------------------------------------------
266 136 olivier.gi
// When uncommented, this define will enable the
267
// ASIC system configuration section (see below) and
268
// will activate scan support for production test.
269 109 olivier.gi
//
270 136 olivier.gi
// WARNING: if you target an FPGA, leave this define
271
//          commented.
272 111 olivier.gi
//-------------------------------------------------------
273 136 olivier.gi
//`define ASIC
274 109 olivier.gi
 
275
 
276 136 olivier.gi
//============================================================================
277
//============================================================================
278
// ASIC SYSTEM CONFIGURATION ( !!!! EXPERTS/PROFESSIONALS ONLY !!!! )
279
//============================================================================
280
//============================================================================
281
`ifdef ASIC
282 111 olivier.gi
 
283 136 olivier.gi
//===============================================================
284
// FINE GRAINED CLOCK GATING
285
//===============================================================
286
 
287
//-------------------------------------------------------
288
// When uncommented, this define will enable the fine
289
// grained clock gating of all registers in the core.
290
//-------------------------------------------------------
291
`define CLOCK_GATING
292
 
293
 
294
//===============================================================
295
// LFXT CLOCK DOMAIN
296
//===============================================================
297
 
298
//-------------------------------------------------------
299
// When uncommented, this define will enable the lfxt_clk
300
// clock domain.
301
// When commented out, the whole chip is clocked with dco_clk.
302
//-------------------------------------------------------
303
`define LFXT_DOMAIN
304
 
305
 
306
//===============================================================
307
// CLOCK MUXES
308
//===============================================================
309
 
310
//-------------------------------------------------------
311
// MCLK: Clock Mux
312
//-------------------------------------------------------
313
// When uncommented, this define will enable the
314
// MCLK clock MUX allowing the selection between
315
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELMx register.
316
// When commented, DCO_CLK is selected.
317
//-------------------------------------------------------
318
`define MCLK_MUX
319
 
320
//-------------------------------------------------------
321
// SMCLK: Clock Mux
322
//-------------------------------------------------------
323
// When uncommented, this define will enable the
324
// SMCLK clock MUX allowing the selection between
325
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELS register.
326
// When commented, DCO_CLK is selected.
327
//-------------------------------------------------------
328
`define SMCLK_MUX
329
 
330
//-------------------------------------------------------
331
// WATCHDOG: Clock Mux
332
//-------------------------------------------------------
333
// When uncommented, this define will enable the
334
// Watchdog clock MUX allowing the selection between
335
// ACLK and SMCLK with the WDTCTL.WDTSSEL register.
336
// When commented out, ACLK is selected if the
337
// WATCHDOG_NOMUX_ACLK define is uncommented, SMCLK is
338
// selected otherwise.
339
//-------------------------------------------------------
340
`define WATCHDOG_MUX
341
//`define WATCHDOG_NOMUX_ACLK
342
 
343
 
344
//===============================================================
345
// CLOCK DIVIDERS
346
//===============================================================
347
 
348
//-------------------------------------------------------
349
// MCLK: Clock divider
350
//-------------------------------------------------------
351
// When uncommented, this define will enable the
352
// MCLK clock divider (/1/2/4/8)
353
//-------------------------------------------------------
354
`define MCLK_DIVIDER
355
 
356
//-------------------------------------------------------
357
// SMCLK: Clock divider (/1/2/4/8)
358
//-------------------------------------------------------
359
// When uncommented, this define will enable the
360
// SMCLK clock divider
361
//-------------------------------------------------------
362
`define SMCLK_DIVIDER
363
 
364
//-------------------------------------------------------
365
// ACLK: Clock divider (/1/2/4/8)
366
//-------------------------------------------------------
367
// When uncommented, this define will enable the
368
// ACLK clock divider
369
//-------------------------------------------------------
370
`define ACLK_DIVIDER
371
 
372
 
373
//===============================================================
374
// LOW POWER MODES
375
//===============================================================
376
 
377
//-------------------------------------------------------
378
// LOW POWER MODE: CPUOFF
379
//-------------------------------------------------------
380
// When uncommented, this define will include the
381
// clock gate allowing to switch off MCLK in
382
// all low power modes: LPM0, LPM1, LPM2, LPM3, LPM4
383
//-------------------------------------------------------
384
`define CPUOFF_EN
385
 
386
//-------------------------------------------------------
387
// LOW POWER MODE: SCG0
388
//-------------------------------------------------------
389
// When uncommented, this define will enable the
390
// DCO_ENABLE/WKUP port control (always 1 when commented).
391
// This allows to switch off the DCO oscillator in the
392
// following low power modes: LPM1, LPM3, LPM4
393
//-------------------------------------------------------
394
`define SCG0_EN
395
 
396
//-------------------------------------------------------
397
// LOW POWER MODE: SCG1
398
//-------------------------------------------------------
399
// When uncommented, this define will include the
400
// clock gate allowing to switch off SMCLK in
401
// the following low power modes: LPM2, LPM3, LPM4
402
//-------------------------------------------------------
403
`define SCG1_EN
404
 
405
//-------------------------------------------------------
406
// LOW POWER MODE: OSCOFF
407
//-------------------------------------------------------
408
// When uncommented, this define will include the
409
// LFXT_CLK clock gate and enable the LFXT_ENABLE/WKUP
410
// port control (always 1 when commented).
411
// This allows to switch off the low frequency oscillator
412
// in the following low power modes: LPM4
413
//-------------------------------------------------------
414
`define OSCOFF_EN
415
 
416
 
417
 
418
`endif
419
 
420 2 olivier.gi
//==========================================================================//
421
//==========================================================================//
422
//==========================================================================//
423
//==========================================================================//
424
//=====        SYSTEM CONSTANTS --- !!!!!!!! DO NOT EDIT !!!!!!!!      =====//
425
//==========================================================================//
426
//==========================================================================//
427
//==========================================================================//
428
//==========================================================================//
429
 
430 72 olivier.gi
//
431 111 olivier.gi
// PROGRAM, DATA & PERIPHERAL MEMORY CONFIGURATION
432
//==================================================
433 2 olivier.gi
 
434 72 olivier.gi
// Program Memory Size
435
`ifdef PMEM_SIZE_59_KB
436
  `define PMEM_AWIDTH      15
437
  `define PMEM_SIZE     60416
438
`endif
439
`ifdef PMEM_SIZE_55_KB
440
  `define PMEM_AWIDTH      15
441
  `define PMEM_SIZE     56320
442
`endif
443
`ifdef PMEM_SIZE_54_KB
444
  `define PMEM_AWIDTH      15
445
  `define PMEM_SIZE     55296
446
`endif
447
`ifdef PMEM_SIZE_51_KB
448
  `define PMEM_AWIDTH      15
449
  `define PMEM_SIZE     52224
450
`endif
451
`ifdef PMEM_SIZE_48_KB
452
  `define PMEM_AWIDTH      15
453
  `define PMEM_SIZE     49152
454
`endif
455
`ifdef PMEM_SIZE_41_KB
456
  `define PMEM_AWIDTH      15
457
  `define PMEM_SIZE     41984
458
`endif
459
`ifdef PMEM_SIZE_32_KB
460
  `define PMEM_AWIDTH      14
461
  `define PMEM_SIZE     32768
462
`endif
463
`ifdef PMEM_SIZE_24_KB
464
  `define PMEM_AWIDTH      14
465
  `define PMEM_SIZE     24576
466
`endif
467
`ifdef PMEM_SIZE_16_KB
468
  `define PMEM_AWIDTH      13
469
  `define PMEM_SIZE     16384
470
`endif
471
`ifdef PMEM_SIZE_12_KB
472
  `define PMEM_AWIDTH      13
473
  `define PMEM_SIZE     12288
474
`endif
475
`ifdef PMEM_SIZE_8_KB
476
  `define PMEM_AWIDTH      12
477
  `define PMEM_SIZE      8192
478
`endif
479
`ifdef PMEM_SIZE_4_KB
480
  `define PMEM_AWIDTH      11
481
  `define PMEM_SIZE      4096
482
`endif
483
`ifdef PMEM_SIZE_2_KB
484
  `define PMEM_AWIDTH      10
485
  `define PMEM_SIZE      2048
486
`endif
487
`ifdef PMEM_SIZE_1_KB
488
  `define PMEM_AWIDTH       9
489
  `define PMEM_SIZE      1024
490
`endif
491 151 olivier.gi
`ifdef PMEM_SIZE_CUSTOM
492
  `define PMEM_AWIDTH       `PMEM_CUSTOM_AWIDTH
493
  `define PMEM_SIZE         `PMEM_CUSTOM_SIZE
494
`endif
495 72 olivier.gi
 
496
// Data Memory Size
497
`ifdef DMEM_SIZE_32_KB
498
  `define DMEM_AWIDTH       14
499
  `define DMEM_SIZE      32768
500
`endif
501
`ifdef DMEM_SIZE_24_KB
502
  `define DMEM_AWIDTH       14
503
  `define DMEM_SIZE      24576
504
`endif
505
`ifdef DMEM_SIZE_16_KB
506
  `define DMEM_AWIDTH       13
507
  `define DMEM_SIZE      16384
508
`endif
509
`ifdef DMEM_SIZE_10_KB
510
  `define DMEM_AWIDTH       13
511
  `define DMEM_SIZE      10240
512
`endif
513
`ifdef DMEM_SIZE_8_KB
514
  `define DMEM_AWIDTH       12
515
  `define DMEM_SIZE       8192
516
`endif
517
`ifdef DMEM_SIZE_5_KB
518
  `define DMEM_AWIDTH       12
519
  `define DMEM_SIZE       5120
520
`endif
521
`ifdef DMEM_SIZE_4_KB
522
  `define DMEM_AWIDTH       11
523
  `define DMEM_SIZE       4096
524
`endif
525
`ifdef DMEM_SIZE_2p5_KB
526
  `define DMEM_AWIDTH       11
527
  `define DMEM_SIZE       2560
528
`endif
529
`ifdef DMEM_SIZE_2_KB
530
  `define DMEM_AWIDTH       10
531
  `define DMEM_SIZE       2048
532
`endif
533
`ifdef DMEM_SIZE_1_KB
534
  `define DMEM_AWIDTH        9
535
  `define DMEM_SIZE       1024
536
`endif
537
`ifdef DMEM_SIZE_512_B
538
  `define DMEM_AWIDTH        8
539
  `define DMEM_SIZE        512
540
`endif
541
`ifdef DMEM_SIZE_256_B
542
  `define DMEM_AWIDTH        7
543
  `define DMEM_SIZE        256
544
`endif
545
`ifdef DMEM_SIZE_128_B
546
  `define DMEM_AWIDTH        6
547
  `define DMEM_SIZE        128
548
`endif
549 151 olivier.gi
`ifdef DMEM_SIZE_CUSTOM
550
  `define DMEM_AWIDTH       `DMEM_CUSTOM_AWIDTH
551
  `define DMEM_SIZE         `DMEM_CUSTOM_SIZE
552
`endif
553 72 olivier.gi
 
554 111 olivier.gi
// Peripheral Memory Size
555
`ifdef PER_SIZE_32_KB
556
  `define PER_AWIDTH        14
557
  `define PER_SIZE       32768
558
`endif
559
`ifdef PER_SIZE_16_KB
560
  `define PER_AWIDTH        13
561
  `define PER_SIZE       16384
562
`endif
563
`ifdef PER_SIZE_8_KB
564
  `define PER_AWIDTH        12
565
  `define PER_SIZE        8192
566
`endif
567
`ifdef PER_SIZE_4_KB
568
  `define PER_AWIDTH        11
569
  `define PER_SIZE        4096
570
`endif
571
`ifdef PER_SIZE_2_KB
572
  `define PER_AWIDTH        10
573
  `define PER_SIZE        2048
574
`endif
575
`ifdef PER_SIZE_1_KB
576
  `define PER_AWIDTH         9
577
  `define PER_SIZE        1024
578
`endif
579
`ifdef PER_SIZE_512_B
580
  `define PER_AWIDTH         8
581
  `define PER_SIZE         512
582
`endif
583 151 olivier.gi
`ifdef PER_SIZE_CUSTOM
584
  `define PER_AWIDTH        `PER_CUSTOM_AWIDTH
585
  `define PER_SIZE          `PER_CUSTOM_SIZE
586
`endif
587 111 olivier.gi
 
588 33 olivier.gi
// Data Memory Base Adresses
589 111 olivier.gi
`define DMEM_BASE  `PER_SIZE
590 2 olivier.gi
 
591 33 olivier.gi
// Program & Data Memory most significant address bit (for 16 bit words)
592
`define PMEM_MSB   `PMEM_AWIDTH-1
593
`define DMEM_MSB   `DMEM_AWIDTH-1
594 111 olivier.gi
`define PER_MSB    `PER_AWIDTH-1
595 2 olivier.gi
 
596 72 olivier.gi
//
597
// STATES, REGISTER FIELDS, ...
598
//======================================
599 2 olivier.gi
 
600
// Instructions type
601
`define INST_SO  0
602
`define INST_JMP 1
603
`define INST_TO  2
604
 
605
// Single-operand arithmetic
606
`define RRC    0
607
`define SWPB   1
608
`define RRA    2
609
`define SXT    3
610
`define PUSH   4
611
`define CALL   5
612
`define RETI   6
613
`define IRQ    7
614
 
615
// Conditional jump
616
`define JNE    0
617
`define JEQ    1
618
`define JNC    2
619
`define JC     3
620
`define JN     4
621
`define JGE    5
622
`define JL     6
623
`define JMP    7
624
 
625
// Two-operand arithmetic
626
`define MOV    0
627
`define ADD    1
628
`define ADDC   2
629
`define SUBC   3
630
`define SUB    4
631
`define CMP    5
632
`define DADD   6
633
`define BIT    7
634
`define BIC    8
635
`define BIS    9
636
`define XOR   10
637
`define AND   11
638
 
639
// Addressing modes
640
`define DIR      0
641
`define IDX      1
642
`define INDIR    2
643
`define INDIR_I  3
644
`define SYMB     4
645
`define IMM      5
646
`define ABS      6
647
`define CONST    7
648
 
649 111 olivier.gi
// Instruction state machine
650
`define I_IRQ_FETCH 3'h0
651
`define I_IRQ_DONE  3'h1
652
`define I_DEC       3'h2
653
`define I_EXT1      3'h3
654
`define I_EXT2      3'h4
655
`define I_IDLE      3'h5
656
 
657 2 olivier.gi
// Execution state machine
658 136 olivier.gi
// (swapped E_IRQ_0 and E_IRQ_2 values to suppress glitch generation warning from lint tool)
659
`define E_IRQ_0     4'h2
660 111 olivier.gi
`define E_IRQ_1     4'h1
661 136 olivier.gi
`define E_IRQ_2     4'h0
662 111 olivier.gi
`define E_IRQ_3     4'h3
663
`define E_IRQ_4     4'h4
664
`define E_SRC_AD    4'h5
665
`define E_SRC_RD    4'h6
666
`define E_SRC_WR    4'h7
667
`define E_DST_AD    4'h8
668
`define E_DST_RD    4'h9
669
`define E_DST_WR    4'hA
670
`define E_EXEC      4'hB
671
`define E_JUMP      4'hC
672
`define E_IDLE      4'hD
673 2 olivier.gi
 
674
// ALU control signals
675
`define ALU_SRC_INV   0
676
`define ALU_INC       1
677
`define ALU_INC_C     2
678
`define ALU_ADD       3
679
`define ALU_AND       4
680
`define ALU_OR        5
681
`define ALU_XOR       6
682
`define ALU_DADD      7
683
`define ALU_STAT_7    8
684
`define ALU_STAT_F    9
685
`define ALU_SHIFT    10
686
`define EXEC_NO_WR   11
687
 
688
// Debug interface
689
`define DBG_UART_WR   18
690
`define DBG_UART_BW   17
691
`define DBG_UART_ADDR 16:11
692
 
693
// Debug interface CPU_CTL register
694
`define HALT        0
695
`define RUN         1
696
`define ISTEP       2
697
`define SW_BRK_EN   3
698
`define FRZ_BRK_EN  4
699
`define RST_BRK_EN  5
700
`define CPU_RST     6
701
 
702
// Debug interface CPU_STAT register
703
`define HALT_RUN    0
704
`define PUC_PND     1
705
`define SWBRK_PND   3
706
`define HWBRK0_PND  4
707
`define HWBRK1_PND  5
708
 
709
// Debug interface BRKx_CTL register
710
`define BRK_MODE_RD 0
711
`define BRK_MODE_WR 1
712
`define BRK_MODE    1:0
713
`define BRK_EN      2
714
`define BRK_I_EN    3
715
`define BRK_RANGE   4
716
 
717
// Basic clock module: BCSCTL1 Control Register
718
`define DIVAx       5:4
719
 
720
// Basic clock module: BCSCTL2 Control Register
721 136 olivier.gi
`define SELMx       7
722
`define DIVMx       5:4
723 2 olivier.gi
`define SELS        3
724
`define DIVSx       2:1
725
 
726 136 olivier.gi
// MCLK Clock gate
727
`ifdef CPUOFF_EN
728
  `define MCLK_CGATE
729
`else
730
`ifdef MCLK_DIVIDER
731
  `define MCLK_CGATE
732
`endif
733
`endif
734 2 olivier.gi
 
735 136 olivier.gi
// SMCLK Clock gate
736
`ifdef SCG1_EN
737
  `define SMCLK_CGATE
738
`else
739
`ifdef SMCLK_DIVIDER
740
  `define SMCLK_CGATE
741
`endif
742
`endif
743
 
744 2 olivier.gi
//
745
// DEBUG INTERFACE EXTRA CONFIGURATION
746
//======================================
747
 
748 111 olivier.gi
// Debug interface: CPU version
749 136 olivier.gi
`define CPU_VERSION   3'h2
750 111 olivier.gi
 
751 2 olivier.gi
// Debug interface: Software breakpoint opcode
752
`define DBG_SWBRK_OP 16'h4343
753
 
754
// Debug UART interface auto data synchronization
755
// If the following define is commented out, then
756
// the DBG_UART_BAUD and DBG_DCO_FREQ need to be properly
757
// defined.
758
`define DBG_UART_AUTO_SYNC
759
 
760
// Debug UART interface data rate
761
//      In order to properly setup the UART debug interface, you
762
//      need to specify the DCO_CLK frequency (DBG_DCO_FREQ) and
763
//      the chosen BAUD rate from the UART interface.
764
//
765
//`define DBG_UART_BAUD    9600
766
//`define DBG_UART_BAUD   19200
767
//`define DBG_UART_BAUD   38400
768
//`define DBG_UART_BAUD   57600
769
//`define DBG_UART_BAUD  115200
770
//`define DBG_UART_BAUD  230400
771
//`define DBG_UART_BAUD  460800
772
//`define DBG_UART_BAUD  576000
773
//`define DBG_UART_BAUD  921600
774
`define DBG_UART_BAUD 2000000
775
`define DBG_DCO_FREQ  20000000
776
`define DBG_UART_CNT ((`DBG_DCO_FREQ/`DBG_UART_BAUD)-1)
777
 
778 111 olivier.gi
// Debug interface selection
779
//             `define DBG_UART -> Enable UART (8N1) debug interface
780
//             `define DBG_JTAG -> DON'T UNCOMMENT, NOT SUPPORTED
781
//
782
`define DBG_UART
783
//`define DBG_JTAG
784
 
785 136 olivier.gi
// Debug interface input synchronizer
786
`define SYNC_DBG_UART_RXD
787
 
788 59 olivier.gi
// Enable/Disable the hardware breakpoint RANGE mode
789 111 olivier.gi
`ifdef DBG_HWBRK_RANGE
790
 `define HWBRK_RANGE 1'b1
791
`else
792
 `define HWBRK_RANGE 1'b0
793
`endif
794 59 olivier.gi
 
795 74 olivier.gi
// Counter width for the debug interface UART
796
`define DBG_UART_XFER_CNT_W 16
797
 
798 2 olivier.gi
// Check configuration
799
`ifdef DBG_EN
800
 `ifdef DBG_UART
801
   `ifdef DBG_JTAG
802
CONFIGURATION ERROR: JTAG AND UART DEBUG INTERFACE ARE BOTH ENABLED
803
   `endif
804
 `else
805
   `ifdef DBG_JTAG
806 33 olivier.gi
CONFIGURATION ERROR: JTAG INTERFACE NOT SUPPORTED
807 2 olivier.gi
   `else
808
CONFIGURATION ERROR: JTAG OR UART DEBUG INTERFACE SHOULD BE ENABLED
809
   `endif
810
 `endif
811
`endif
812 71 olivier.gi
 
813
//
814
// MULTIPLIER CONFIGURATION
815
//======================================
816
 
817
// If uncommented, the following define selects
818
// the 16x16 multiplier (1 cycle) instead of the
819
// default 16x8 multplier (2 cycles)
820
//`define MPY_16x16
821 136 olivier.gi
 
822
//======================================
823
// CONFIGURATION CHECKS
824
//======================================
825
`ifdef LFXT_DOMAIN
826
`else
827
 `ifdef MCLK_MUX
828
CONFIGURATION ERROR: THE MCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
829
 `endif
830
 `ifdef SMCLK_MUX
831
CONFIGURATION ERROR: THE SMCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
832
 `endif
833
 `ifdef WATCHDOG_MUX
834
CONFIGURATION ERROR: THE WATCHDOG_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
835
 `else
836
   `ifdef WATCHDOG_NOMUX_ACLK
837
CONFIGURATION ERROR: THE WATCHDOG_NOMUX_ACLK CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
838
   `endif
839
 `endif
840
 `ifdef OSCOFF_EN
841
CONFIGURATION ERROR: THE OSCOFF LOW POWER MODE CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
842
 `endif
843
`endif

powered by: WebSVN 2.1.0

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