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

Subversion Repositories openmsp430

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

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

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

powered by: WebSVN 2.1.0

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