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

Subversion Repositories openmsp430

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

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

powered by: WebSVN 2.1.0

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