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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [rtl/] [verilog/] [openMSP430_defines.v] - Blame information for rev 192

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

Line No. Rev Author Line
1 2 olivier.gi
//----------------------------------------------------------------------------
2 117 olivier.gi
// Copyright (C) 2009 , Olivier Girard
3 2 olivier.gi
//
4 117 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 117 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: 192 $
40
// $LastChangedBy: olivier.girard $
41
// $LastChangedDate: 2013-12-17 21:15:28 +0100 (Tue, 17 Dec 2013) $
42
//----------------------------------------------------------------------------
43 103 olivier.gi
//`define OMSP_NO_INCLUDE
44
`ifdef OMSP_NO_INCLUDE
45
`else
46 33 olivier.gi
`include "openMSP430_undefines.v"
47 103 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 67 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
 
106 111 olivier.gi
//============================================================================
107
//============================================================================
108
// ADVANCED SYSTEM CONFIGURATION (FOR EXPERIENCED USERS)
109
//============================================================================
110
//============================================================================
111
 
112
//-------------------------------------------------------
113 134 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'b00000
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 180 olivier.gi
//-------------------------------------------------------
136 134 olivier.gi
// Include/Exclude Non-Maskable-Interrupt support
137
//-------------------------------------------------------
138
`define NMI
139
 
140
 
141
//-------------------------------------------------------
142 192 olivier.gi
// Number of available IRQs
143
//-------------------------------------------------------
144
// Indicates the number of interrupt vectors supported
145
// (16, 32 or 64).
146
//-------------------------------------------------------
147
//`define IRQ_16
148
//`define IRQ_32
149
`define IRQ_64
150
 
151
 
152
//-------------------------------------------------------
153 134 olivier.gi
// Input synchronizers
154
//-------------------------------------------------------
155
// In some cases, the asynchronous input ports might
156
// already be synchronized externally.
157
// If an extensive CDC design review showed that this
158
// is really the case,  the individual synchronizers
159
// can be disabled with the following defines.
160
//
161
// Notes:
162
//        - all three signals are all sampled in the MCLK domain
163
//
164
//        - the dbg_en signal reset the debug interface
165
//         when 0. Therefore make sure it is glitch free.
166
//
167
//-------------------------------------------------------
168
`define SYNC_NMI
169
//`define SYNC_CPU_EN
170
//`define SYNC_DBG_EN
171
 
172
 
173
//-------------------------------------------------------
174 111 olivier.gi
// Peripheral Memory Space:
175
//-------------------------------------------------------
176
// The original MSP430 architecture map the peripherals
177
// from 0x0000 to 0x01FF (i.e. 512B of the memory space).
178
// The following defines allow you to expand this space
179
// up to 32 kB (i.e. from 0x0000 to 0x7fff).
180
// As a consequence, the data memory mapping will be
181
// shifted up and a custom linker script will therefore
182
// be required by the GCC compiler.
183
//-------------------------------------------------------
184 151 olivier.gi
//`define PER_SIZE_CUSTOM
185 111 olivier.gi
//`define PER_SIZE_32_KB
186
//`define PER_SIZE_16_KB
187
//`define PER_SIZE_8_KB
188
//`define PER_SIZE_4_KB
189
//`define PER_SIZE_2_KB
190
//`define PER_SIZE_1_KB
191
`define PER_SIZE_512_B
192
 
193
 
194
//-------------------------------------------------------
195
// Defines the debugger CPU_CTL.RST_BRK_EN reset value
196
// (CPU break on PUC reset)
197
//-------------------------------------------------------
198
// When defined, the CPU will automatically break after
199 134 olivier.gi
// a PUC occurrence by default. This is typically useful
200 111 olivier.gi
// when the program memory can only be initialized through
201
// the serial debug interface.
202
//-------------------------------------------------------
203 134 olivier.gi
`define DBG_RST_BRK_EN
204 111 olivier.gi
 
205
 
206
//============================================================================
207
//============================================================================
208
// EXPERT SYSTEM CONFIGURATION ( !!!! EXPERTS ONLY !!!! )
209
//============================================================================
210
//============================================================================
211 2 olivier.gi
//
212 111 olivier.gi
// IMPORTANT NOTE:  Please update following configuration options ONLY if
213
//                 you have a good reason to do so... and if you know what
214
//                 you are doing :-P
215
//
216
//============================================================================
217 2 olivier.gi
 
218 111 olivier.gi
//-------------------------------------------------------
219 154 olivier.gi
// Select serial debug interface protocol
220
//-------------------------------------------------------
221
//    DBG_UART -> Enable UART (8N1) debug interface
222
//    DBG_I2C  -> Enable I2C debug interface
223
//-------------------------------------------------------
224
`define DBG_UART
225
//`define DBG_I2C
226
 
227
 
228
//-------------------------------------------------------
229
// Enable the I2C broadcast address
230
//-------------------------------------------------------
231
// For multicore systems, a common I2C broadcast address
232
// can be given to all oMSP cores in order to
233
// synchronously RESET, START, STOP, or STEP all CPUs
234
// at once with a single I2C command.
235
// If you have a single openMSP430 in your system,
236
// this option can stay commented-out.
237
//-------------------------------------------------------
238
//`define DBG_I2C_BROADCAST
239
 
240
 
241
//-------------------------------------------------------
242 134 olivier.gi
// Number of hardware breakpoint/watchpoint units
243
// (each unit contains two hardware addresses available
244
// for breakpoints or watchpoints):
245 111 olivier.gi
//   - DBG_HWBRK_0 -> Include hardware breakpoints unit 0
246
//   - DBG_HWBRK_1 -> Include hardware breakpoints unit 1
247
//   - DBG_HWBRK_2 -> Include hardware breakpoints unit 2
248
//   - DBG_HWBRK_3 -> Include hardware breakpoints unit 3
249
//-------------------------------------------------------
250
// Please keep in mind that hardware breakpoints only
251
// make sense whenever the program memory is not an SRAM
252
// (i.e. Flash/OTP/ROM/...) or when you are interested
253 134 olivier.gi
// in data breakpoints.
254 111 olivier.gi
//-------------------------------------------------------
255
//`define  DBG_HWBRK_0
256
//`define  DBG_HWBRK_1
257
//`define  DBG_HWBRK_2
258
//`define  DBG_HWBRK_3
259
 
260
 
261
//-------------------------------------------------------
262
// Enable/Disable the hardware breakpoint RANGE mode
263
//-------------------------------------------------------
264
// When enabled this feature allows the hardware breakpoint
265
// units to stop the cpu whenever an instruction or data
266
// access lays within an address range.
267
// Note that this feature is not supported by GDB.
268
//-------------------------------------------------------
269
//`define DBG_HWBRK_RANGE
270
 
271
 
272
//-------------------------------------------------------
273 151 olivier.gi
// Custom Program/Data and Peripheral Memory Spaces
274
//-------------------------------------------------------
275
// The following values are valid only if the
276
// corresponding *_SIZE_CUSTOM defines are uncommented:
277
//
278
//  - *_SIZE   : size of the section in bytes.
279
//  - *_AWIDTH : address port width, this value must allow
280
//               to address all WORDS of the section
281
//               (i.e. the *_SIZE divided by 2)
282
//-------------------------------------------------------
283
 
284
// Custom Program memory (enabled with PMEM_SIZE_CUSTOM)
285
`define PMEM_CUSTOM_AWIDTH      10
286 154 olivier.gi
`define PMEM_CUSTOM_SIZE      2048
287 151 olivier.gi
 
288
// Custom Data memory    (enabled with DMEM_SIZE_CUSTOM)
289
`define DMEM_CUSTOM_AWIDTH       6
290
`define DMEM_CUSTOM_SIZE       128
291
 
292
// Custom Peripheral memory  (enabled with PER_SIZE_CUSTOM)
293
`define PER_CUSTOM_AWIDTH        8
294
`define PER_CUSTOM_SIZE        512
295
 
296
 
297
//-------------------------------------------------------
298 134 olivier.gi
// ASIC version
299 111 olivier.gi
//-------------------------------------------------------
300 134 olivier.gi
// When uncommented, this define will enable the
301
// ASIC system configuration section (see below) and
302
// will activate scan support for production test.
303 106 olivier.gi
//
304 134 olivier.gi
// WARNING: if you target an FPGA, leave this define
305
//          commented.
306 111 olivier.gi
//-------------------------------------------------------
307 134 olivier.gi
//`define ASIC
308 2 olivier.gi
 
309 106 olivier.gi
 
310 134 olivier.gi
//============================================================================
311
//============================================================================
312
// ASIC SYSTEM CONFIGURATION ( !!!! EXPERTS/PROFESSIONALS ONLY !!!! )
313
//============================================================================
314
//============================================================================
315
`ifdef ASIC
316 111 olivier.gi
 
317 134 olivier.gi
//===============================================================
318
// FINE GRAINED CLOCK GATING
319
//===============================================================
320
 
321
//-------------------------------------------------------
322
// When uncommented, this define will enable the fine
323
// grained clock gating of all registers in the core.
324
//-------------------------------------------------------
325
`define CLOCK_GATING
326
 
327
 
328
//===============================================================
329 180 olivier.gi
// ASIC CLOCKING
330
//===============================================================
331
 
332
//-------------------------------------------------------
333
// When uncommented, this define will enable the ASIC
334
// architectural clock gating as well as the advanced low
335
// power modes support (most common).
336
// Comment this out in order to get FPGA-like clocking.
337
//-------------------------------------------------------
338
`define ASIC_CLOCKING
339
 
340
 
341
`ifdef ASIC_CLOCKING
342
//===============================================================
343 134 olivier.gi
// LFXT CLOCK DOMAIN
344
//===============================================================
345
 
346
//-------------------------------------------------------
347
// When uncommented, this define will enable the lfxt_clk
348
// clock domain.
349
// When commented out, the whole chip is clocked with dco_clk.
350
//-------------------------------------------------------
351
`define LFXT_DOMAIN
352
 
353
 
354
//===============================================================
355
// CLOCK MUXES
356
//===============================================================
357
 
358
//-------------------------------------------------------
359
// MCLK: Clock Mux
360
//-------------------------------------------------------
361
// When uncommented, this define will enable the
362
// MCLK clock MUX allowing the selection between
363
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELMx register.
364
// When commented, DCO_CLK is selected.
365
//-------------------------------------------------------
366
`define MCLK_MUX
367
 
368
//-------------------------------------------------------
369
// SMCLK: Clock Mux
370
//-------------------------------------------------------
371
// When uncommented, this define will enable the
372
// SMCLK clock MUX allowing the selection between
373
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELS register.
374
// When commented, DCO_CLK is selected.
375
//-------------------------------------------------------
376
`define SMCLK_MUX
377
 
378
//-------------------------------------------------------
379
// WATCHDOG: Clock Mux
380
//-------------------------------------------------------
381
// When uncommented, this define will enable the
382
// Watchdog clock MUX allowing the selection between
383
// ACLK and SMCLK with the WDTCTL.WDTSSEL register.
384
// When commented out, ACLK is selected if the
385
// WATCHDOG_NOMUX_ACLK define is uncommented, SMCLK is
386
// selected otherwise.
387
//-------------------------------------------------------
388
`define WATCHDOG_MUX
389
//`define WATCHDOG_NOMUX_ACLK
390
 
391
 
392
//===============================================================
393
// CLOCK DIVIDERS
394
//===============================================================
395
 
396
//-------------------------------------------------------
397
// MCLK: Clock divider
398
//-------------------------------------------------------
399
// When uncommented, this define will enable the
400
// MCLK clock divider (/1/2/4/8)
401
//-------------------------------------------------------
402
`define MCLK_DIVIDER
403
 
404
//-------------------------------------------------------
405
// SMCLK: Clock divider (/1/2/4/8)
406
//-------------------------------------------------------
407
// When uncommented, this define will enable the
408
// SMCLK clock divider
409
//-------------------------------------------------------
410
`define SMCLK_DIVIDER
411
 
412
//-------------------------------------------------------
413
// ACLK: Clock divider (/1/2/4/8)
414
//-------------------------------------------------------
415
// When uncommented, this define will enable the
416
// ACLK clock divider
417
//-------------------------------------------------------
418
`define ACLK_DIVIDER
419
 
420
 
421
//===============================================================
422
// LOW POWER MODES
423
//===============================================================
424
 
425
//-------------------------------------------------------
426
// LOW POWER MODE: CPUOFF
427
//-------------------------------------------------------
428
// When uncommented, this define will include the
429
// clock gate allowing to switch off MCLK in
430
// all low power modes: LPM0, LPM1, LPM2, LPM3, LPM4
431
//-------------------------------------------------------
432
`define CPUOFF_EN
433
 
434
//-------------------------------------------------------
435
// LOW POWER MODE: SCG0
436
//-------------------------------------------------------
437
// When uncommented, this define will enable the
438
// DCO_ENABLE/WKUP port control (always 1 when commented).
439
// This allows to switch off the DCO oscillator in the
440
// following low power modes: LPM1, LPM3, LPM4
441
//-------------------------------------------------------
442
`define SCG0_EN
443
 
444
//-------------------------------------------------------
445
// LOW POWER MODE: SCG1
446
//-------------------------------------------------------
447
// When uncommented, this define will include the
448
// clock gate allowing to switch off SMCLK in
449
// the following low power modes: LPM2, LPM3, LPM4
450
//-------------------------------------------------------
451
`define SCG1_EN
452
 
453
//-------------------------------------------------------
454
// LOW POWER MODE: OSCOFF
455
//-------------------------------------------------------
456
// When uncommented, this define will include the
457
// LFXT_CLK clock gate and enable the LFXT_ENABLE/WKUP
458
// port control (always 1 when commented).
459
// This allows to switch off the low frequency oscillator
460
// in the following low power modes: LPM4
461
//-------------------------------------------------------
462
`define OSCOFF_EN
463
 
464
 
465
`endif
466 180 olivier.gi
`endif
467 134 olivier.gi
 
468 2 olivier.gi
//==========================================================================//
469
//==========================================================================//
470
//==========================================================================//
471
//==========================================================================//
472
//=====        SYSTEM CONSTANTS --- !!!!!!!! DO NOT EDIT !!!!!!!!      =====//
473
//==========================================================================//
474
//==========================================================================//
475
//==========================================================================//
476
//==========================================================================//
477
 
478 72 olivier.gi
//
479 111 olivier.gi
// PROGRAM, DATA & PERIPHERAL MEMORY CONFIGURATION
480
//==================================================
481 2 olivier.gi
 
482 72 olivier.gi
// Program Memory Size
483
`ifdef PMEM_SIZE_59_KB
484
  `define PMEM_AWIDTH      15
485
  `define PMEM_SIZE     60416
486
`endif
487
`ifdef PMEM_SIZE_55_KB
488
  `define PMEM_AWIDTH      15
489
  `define PMEM_SIZE     56320
490
`endif
491
`ifdef PMEM_SIZE_54_KB
492
  `define PMEM_AWIDTH      15
493
  `define PMEM_SIZE     55296
494
`endif
495
`ifdef PMEM_SIZE_51_KB
496
  `define PMEM_AWIDTH      15
497
  `define PMEM_SIZE     52224
498
`endif
499
`ifdef PMEM_SIZE_48_KB
500
  `define PMEM_AWIDTH      15
501
  `define PMEM_SIZE     49152
502
`endif
503
`ifdef PMEM_SIZE_41_KB
504
  `define PMEM_AWIDTH      15
505
  `define PMEM_SIZE     41984
506
`endif
507
`ifdef PMEM_SIZE_32_KB
508
  `define PMEM_AWIDTH      14
509
  `define PMEM_SIZE     32768
510
`endif
511
`ifdef PMEM_SIZE_24_KB
512
  `define PMEM_AWIDTH      14
513
  `define PMEM_SIZE     24576
514
`endif
515
`ifdef PMEM_SIZE_16_KB
516
  `define PMEM_AWIDTH      13
517
  `define PMEM_SIZE     16384
518
`endif
519
`ifdef PMEM_SIZE_12_KB
520
  `define PMEM_AWIDTH      13
521
  `define PMEM_SIZE     12288
522
`endif
523
`ifdef PMEM_SIZE_8_KB
524
  `define PMEM_AWIDTH      12
525
  `define PMEM_SIZE      8192
526
`endif
527
`ifdef PMEM_SIZE_4_KB
528
  `define PMEM_AWIDTH      11
529
  `define PMEM_SIZE      4096
530
`endif
531
`ifdef PMEM_SIZE_2_KB
532
  `define PMEM_AWIDTH      10
533
  `define PMEM_SIZE      2048
534
`endif
535
`ifdef PMEM_SIZE_1_KB
536
  `define PMEM_AWIDTH       9
537
  `define PMEM_SIZE      1024
538
`endif
539 151 olivier.gi
`ifdef PMEM_SIZE_CUSTOM
540
  `define PMEM_AWIDTH       `PMEM_CUSTOM_AWIDTH
541
  `define PMEM_SIZE         `PMEM_CUSTOM_SIZE
542
`endif
543 72 olivier.gi
 
544
// Data Memory Size
545
`ifdef DMEM_SIZE_32_KB
546
  `define DMEM_AWIDTH       14
547
  `define DMEM_SIZE      32768
548
`endif
549
`ifdef DMEM_SIZE_24_KB
550
  `define DMEM_AWIDTH       14
551
  `define DMEM_SIZE      24576
552
`endif
553
`ifdef DMEM_SIZE_16_KB
554
  `define DMEM_AWIDTH       13
555
  `define DMEM_SIZE      16384
556
`endif
557
`ifdef DMEM_SIZE_10_KB
558
  `define DMEM_AWIDTH       13
559
  `define DMEM_SIZE      10240
560
`endif
561
`ifdef DMEM_SIZE_8_KB
562
  `define DMEM_AWIDTH       12
563
  `define DMEM_SIZE       8192
564
`endif
565
`ifdef DMEM_SIZE_5_KB
566
  `define DMEM_AWIDTH       12
567
  `define DMEM_SIZE       5120
568
`endif
569
`ifdef DMEM_SIZE_4_KB
570
  `define DMEM_AWIDTH       11
571
  `define DMEM_SIZE       4096
572
`endif
573
`ifdef DMEM_SIZE_2p5_KB
574
  `define DMEM_AWIDTH       11
575
  `define DMEM_SIZE       2560
576
`endif
577
`ifdef DMEM_SIZE_2_KB
578
  `define DMEM_AWIDTH       10
579
  `define DMEM_SIZE       2048
580
`endif
581
`ifdef DMEM_SIZE_1_KB
582
  `define DMEM_AWIDTH        9
583
  `define DMEM_SIZE       1024
584
`endif
585
`ifdef DMEM_SIZE_512_B
586
  `define DMEM_AWIDTH        8
587
  `define DMEM_SIZE        512
588
`endif
589
`ifdef DMEM_SIZE_256_B
590
  `define DMEM_AWIDTH        7
591
  `define DMEM_SIZE        256
592
`endif
593
`ifdef DMEM_SIZE_128_B
594
  `define DMEM_AWIDTH        6
595
  `define DMEM_SIZE        128
596
`endif
597 151 olivier.gi
`ifdef DMEM_SIZE_CUSTOM
598
  `define DMEM_AWIDTH       `DMEM_CUSTOM_AWIDTH
599
  `define DMEM_SIZE         `DMEM_CUSTOM_SIZE
600
`endif
601 72 olivier.gi
 
602 111 olivier.gi
// Peripheral Memory Size
603
`ifdef PER_SIZE_32_KB
604
  `define PER_AWIDTH        14
605
  `define PER_SIZE       32768
606
`endif
607
`ifdef PER_SIZE_16_KB
608
  `define PER_AWIDTH        13
609
  `define PER_SIZE       16384
610
`endif
611
`ifdef PER_SIZE_8_KB
612
  `define PER_AWIDTH        12
613
  `define PER_SIZE        8192
614
`endif
615
`ifdef PER_SIZE_4_KB
616
  `define PER_AWIDTH        11
617
  `define PER_SIZE        4096
618
`endif
619
`ifdef PER_SIZE_2_KB
620
  `define PER_AWIDTH        10
621
  `define PER_SIZE        2048
622
`endif
623
`ifdef PER_SIZE_1_KB
624
  `define PER_AWIDTH         9
625
  `define PER_SIZE        1024
626
`endif
627
`ifdef PER_SIZE_512_B
628
  `define PER_AWIDTH         8
629
  `define PER_SIZE         512
630
`endif
631 151 olivier.gi
`ifdef PER_SIZE_CUSTOM
632
  `define PER_AWIDTH        `PER_CUSTOM_AWIDTH
633
  `define PER_SIZE          `PER_CUSTOM_SIZE
634
`endif
635 111 olivier.gi
 
636 33 olivier.gi
// Data Memory Base Adresses
637 111 olivier.gi
`define DMEM_BASE  `PER_SIZE
638 2 olivier.gi
 
639 33 olivier.gi
// Program & Data Memory most significant address bit (for 16 bit words)
640
`define PMEM_MSB   `PMEM_AWIDTH-1
641
`define DMEM_MSB   `DMEM_AWIDTH-1
642 111 olivier.gi
`define PER_MSB    `PER_AWIDTH-1
643 2 olivier.gi
 
644 192 olivier.gi
// Number of available IRQs
645
`ifdef  IRQ_16
646
`define IRQ_NR 16
647
`endif
648
`ifdef  IRQ_32
649
`define IRQ_NR 32
650
`define IRQ_NR_GE_32
651
`endif
652
`ifdef  IRQ_64
653
`define IRQ_NR 64
654
`define IRQ_NR_GE_32
655
`endif
656
 
657 72 olivier.gi
//
658
// STATES, REGISTER FIELDS, ...
659
//======================================
660 2 olivier.gi
 
661
// Instructions type
662
`define INST_SO  0
663
`define INST_JMP 1
664
`define INST_TO  2
665
 
666
// Single-operand arithmetic
667
`define RRC    0
668
`define SWPB   1
669
`define RRA    2
670
`define SXT    3
671
`define PUSH   4
672
`define CALL   5
673
`define RETI   6
674
`define IRQ    7
675
 
676
// Conditional jump
677
`define JNE    0
678
`define JEQ    1
679
`define JNC    2
680
`define JC     3
681
`define JN     4
682
`define JGE    5
683
`define JL     6
684
`define JMP    7
685
 
686
// Two-operand arithmetic
687
`define MOV    0
688
`define ADD    1
689
`define ADDC   2
690
`define SUBC   3
691
`define SUB    4
692
`define CMP    5
693
`define DADD   6
694
`define BIT    7
695
`define BIC    8
696
`define BIS    9
697
`define XOR   10
698
`define AND   11
699
 
700
// Addressing modes
701
`define DIR      0
702
`define IDX      1
703
`define INDIR    2
704
`define INDIR_I  3
705
`define SYMB     4
706
`define IMM      5
707
`define ABS      6
708
`define CONST    7
709
 
710 111 olivier.gi
// Instruction state machine
711
`define I_IRQ_FETCH 3'h0
712
`define I_IRQ_DONE  3'h1
713
`define I_DEC       3'h2
714
`define I_EXT1      3'h3
715
`define I_EXT2      3'h4
716
`define I_IDLE      3'h5
717
 
718 2 olivier.gi
// Execution state machine
719 134 olivier.gi
// (swapped E_IRQ_0 and E_IRQ_2 values to suppress glitch generation warning from lint tool)
720
`define E_IRQ_0     4'h2
721 111 olivier.gi
`define E_IRQ_1     4'h1
722 134 olivier.gi
`define E_IRQ_2     4'h0
723 111 olivier.gi
`define E_IRQ_3     4'h3
724
`define E_IRQ_4     4'h4
725
`define E_SRC_AD    4'h5
726
`define E_SRC_RD    4'h6
727
`define E_SRC_WR    4'h7
728
`define E_DST_AD    4'h8
729
`define E_DST_RD    4'h9
730
`define E_DST_WR    4'hA
731
`define E_EXEC      4'hB
732
`define E_JUMP      4'hC
733
`define E_IDLE      4'hD
734 2 olivier.gi
 
735
// ALU control signals
736
`define ALU_SRC_INV   0
737
`define ALU_INC       1
738
`define ALU_INC_C     2
739
`define ALU_ADD       3
740
`define ALU_AND       4
741
`define ALU_OR        5
742
`define ALU_XOR       6
743
`define ALU_DADD      7
744
`define ALU_STAT_7    8
745
`define ALU_STAT_F    9
746
`define ALU_SHIFT    10
747
`define EXEC_NO_WR   11
748
 
749
// Debug interface
750
`define DBG_UART_WR   18
751
`define DBG_UART_BW   17
752
`define DBG_UART_ADDR 16:11
753
 
754
// Debug interface CPU_CTL register
755
`define HALT        0
756
`define RUN         1
757
`define ISTEP       2
758
`define SW_BRK_EN   3
759
`define FRZ_BRK_EN  4
760
`define RST_BRK_EN  5
761
`define CPU_RST     6
762
 
763
// Debug interface CPU_STAT register
764
`define HALT_RUN    0
765
`define PUC_PND     1
766
`define SWBRK_PND   3
767
`define HWBRK0_PND  4
768
`define HWBRK1_PND  5
769
 
770
// Debug interface BRKx_CTL register
771
`define BRK_MODE_RD 0
772
`define BRK_MODE_WR 1
773
`define BRK_MODE    1:0
774
`define BRK_EN      2
775
`define BRK_I_EN    3
776
`define BRK_RANGE   4
777
 
778
// Basic clock module: BCSCTL1 Control Register
779
`define DIVAx       5:4
780
 
781
// Basic clock module: BCSCTL2 Control Register
782 134 olivier.gi
`define SELMx       7
783
`define DIVMx       5:4
784 2 olivier.gi
`define SELS        3
785
`define DIVSx       2:1
786
 
787 134 olivier.gi
// MCLK Clock gate
788
`ifdef CPUOFF_EN
789
  `define MCLK_CGATE
790
`else
791
`ifdef MCLK_DIVIDER
792
  `define MCLK_CGATE
793
`endif
794
`endif
795 2 olivier.gi
 
796 134 olivier.gi
// SMCLK Clock gate
797
`ifdef SCG1_EN
798
  `define SMCLK_CGATE
799
`else
800
`ifdef SMCLK_DIVIDER
801
  `define SMCLK_CGATE
802
`endif
803
`endif
804
 
805 2 olivier.gi
//
806
// DEBUG INTERFACE EXTRA CONFIGURATION
807
//======================================
808
 
809 111 olivier.gi
// Debug interface: CPU version
810 134 olivier.gi
`define CPU_VERSION   3'h2
811 111 olivier.gi
 
812 2 olivier.gi
// Debug interface: Software breakpoint opcode
813
`define DBG_SWBRK_OP 16'h4343
814
 
815
// Debug UART interface auto data synchronization
816
// If the following define is commented out, then
817
// the DBG_UART_BAUD and DBG_DCO_FREQ need to be properly
818
// defined.
819
`define DBG_UART_AUTO_SYNC
820
 
821
// Debug UART interface data rate
822
//      In order to properly setup the UART debug interface, you
823
//      need to specify the DCO_CLK frequency (DBG_DCO_FREQ) and
824
//      the chosen BAUD rate from the UART interface.
825
//
826
//`define DBG_UART_BAUD    9600
827
//`define DBG_UART_BAUD   19200
828
//`define DBG_UART_BAUD   38400
829
//`define DBG_UART_BAUD   57600
830
//`define DBG_UART_BAUD  115200
831
//`define DBG_UART_BAUD  230400
832
//`define DBG_UART_BAUD  460800
833
//`define DBG_UART_BAUD  576000
834
//`define DBG_UART_BAUD  921600
835
`define DBG_UART_BAUD 2000000
836
`define DBG_DCO_FREQ  20000000
837
`define DBG_UART_CNT ((`DBG_DCO_FREQ/`DBG_UART_BAUD)-1)
838
 
839 134 olivier.gi
// Debug interface input synchronizer
840
`define SYNC_DBG_UART_RXD
841
 
842 57 olivier.gi
// Enable/Disable the hardware breakpoint RANGE mode
843 111 olivier.gi
`ifdef DBG_HWBRK_RANGE
844
 `define HWBRK_RANGE 1'b1
845
`else
846
 `define HWBRK_RANGE 1'b0
847
`endif
848 57 olivier.gi
 
849 74 olivier.gi
// Counter width for the debug interface UART
850
`define DBG_UART_XFER_CNT_W 16
851
 
852 2 olivier.gi
// Check configuration
853
`ifdef DBG_EN
854
 `ifdef DBG_UART
855 154 olivier.gi
   `ifdef DBG_I2C
856
CONFIGURATION ERROR: I2C AND UART DEBUG INTERFACE ARE BOTH ENABLED
857 2 olivier.gi
   `endif
858
 `else
859 154 olivier.gi
   `ifdef DBG_I2C
860 2 olivier.gi
   `else
861 154 olivier.gi
CONFIGURATION ERROR: I2C OR UART DEBUG INTERFACE SHOULD BE ENABLED
862 2 olivier.gi
   `endif
863
 `endif
864
`endif
865 67 olivier.gi
 
866
//
867
// MULTIPLIER CONFIGURATION
868
//======================================
869
 
870
// If uncommented, the following define selects
871
// the 16x16 multiplier (1 cycle) instead of the
872
// default 16x8 multplier (2 cycles)
873
//`define MPY_16x16
874 134 olivier.gi
 
875
//======================================
876
// CONFIGURATION CHECKS
877
//======================================
878 192 olivier.gi
 
879
`ifdef  IRQ_16
880
  `ifdef  IRQ_32
881
CONFIGURATION ERROR: ONLY ONE OF THE IRQ NUMBER OPTION CAN BE SELECTED
882
  `endif
883
  `ifdef  IRQ_64
884
CONFIGURATION ERROR: ONLY ONE OF THE IRQ NUMBER OPTION CAN BE SELECTED
885
  `endif
886
`endif
887
`ifdef  IRQ_32
888
  `ifdef  IRQ_64
889
CONFIGURATION ERROR: ONLY ONE OF THE IRQ NUMBER OPTION CAN BE SELECTED
890
  `endif
891
`endif
892 134 olivier.gi
`ifdef LFXT_DOMAIN
893
`else
894
 `ifdef MCLK_MUX
895
CONFIGURATION ERROR: THE MCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
896
 `endif
897
 `ifdef SMCLK_MUX
898
CONFIGURATION ERROR: THE SMCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
899
 `endif
900
 `ifdef WATCHDOG_MUX
901
CONFIGURATION ERROR: THE WATCHDOG_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
902
 `else
903
   `ifdef WATCHDOG_NOMUX_ACLK
904
CONFIGURATION ERROR: THE WATCHDOG_NOMUX_ACLK CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
905
   `endif
906
 `endif
907
 `ifdef OSCOFF_EN
908
CONFIGURATION ERROR: THE OSCOFF LOW POWER MODE CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
909
 `endif
910
`endif

powered by: WebSVN 2.1.0

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