OpenCores

Subversion Repositories openmsp430

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

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

Line No. Rev Author Line
1 2 olivier.girard
//----------------------------------------------------------------------------
2
// Copyright (C) 2001 Authors
3
//
4
// This source file may be used and distributed without restriction provided
5
// that this copyright statement is not removed from the file and that any
6
// derivative work contains the original copyright notice and the associated
7
// disclaimer.
8
//
9
// This source file is free software; you can redistribute it and/or modify
10
// it under the terms of the GNU Lesser General Public License as published
11
// by the Free Software Foundation; either version 2.1 of the License, or
12
// (at your option) any later version.
13
//
14
// This source is distributed in the hope that it will be useful, but WITHOUT
15
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17
// License for more details.
18
//
19
// You should have received a copy of the GNU Lesser General Public License
20
// along with this source; if not, write to the Free Software Foundation,
21
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
//
23
//----------------------------------------------------------------------------
24
// 
25 23 olivier.girard
// *File Name: openMSP430_defines.v
26 2 olivier.girard
// 
27
// *Module Description:
28
//                      openMSP430 Configuration file
29
//
30
// *Author(s):
31
//              - Olivier Girard,    olgirard@gmail.com
32
//
33
//----------------------------------------------------------------------------
34 17 olivier.girard
// $Rev: 111 $
35
// $LastChangedBy: olivier.girard $
36
// $LastChangedDate: 2011-05-20 22:39:02 +0200 (Fri, 20 May 2011) $
37
//----------------------------------------------------------------------------
38 103 olivier.girard
//`define OMSP_NO_INCLUDE
39
`ifdef OMSP_NO_INCLUDE
40
`else
41 33 olivier.girard
`include "openMSP430_undefines.v"
42 103 olivier.girard
`endif
43 2 olivier.girard
 
44 111 olivier.girard
//============================================================================
45
//============================================================================
46
// BASIC SYSTEM CONFIGURATION
47
//============================================================================
48
//============================================================================
49 72 olivier.girard
//
50 111 olivier.girard
// Note: the sum of program, data and peripheral memory spaces must not
51
//      exceed 64 kB
52 72 olivier.girard
//
53 2 olivier.girard
 
54 33 olivier.girard
// Program Memory Size:
55 72 olivier.girard
//                     Uncomment the required memory size
56
//-------------------------------------------------------
57
//`define PMEM_SIZE_59_KB
58
//`define PMEM_SIZE_55_KB
59
//`define PMEM_SIZE_54_KB
60
//`define PMEM_SIZE_51_KB
61
//`define PMEM_SIZE_48_KB
62
//`define PMEM_SIZE_41_KB
63
//`define PMEM_SIZE_32_KB
64
//`define PMEM_SIZE_24_KB
65
//`define PMEM_SIZE_16_KB
66
//`define PMEM_SIZE_12_KB
67
//`define PMEM_SIZE_8_KB
68
//`define PMEM_SIZE_4_KB
69
`define PMEM_SIZE_2_KB
70
//`define PMEM_SIZE_1_KB
71 2 olivier.girard
 
72 111 olivier.girard
 
73 33 olivier.girard
// Data Memory Size:
74 72 olivier.girard
//                     Uncomment the required memory size
75
//-------------------------------------------------------
76
//`define DMEM_SIZE_32_KB
77
//`define DMEM_SIZE_24_KB
78
//`define DMEM_SIZE_16_KB
79
//`define DMEM_SIZE_10_KB
80
//`define DMEM_SIZE_8_KB
81
//`define DMEM_SIZE_5_KB
82
//`define DMEM_SIZE_4_KB
83
//`define DMEM_SIZE_2p5_KB
84
//`define DMEM_SIZE_2_KB
85
//`define DMEM_SIZE_1_KB
86
//`define DMEM_SIZE_512_B
87
//`define DMEM_SIZE_256_B
88
`define DMEM_SIZE_128_B
89 2 olivier.girard
 
90 111 olivier.girard
 
91 67 olivier.girard
// Include/Exclude Hardware Multiplier
92
`define MULTIPLIER
93
 
94
 
95 111 olivier.girard
// Include/Exclude Serial Debug interface
96 2 olivier.girard
`define DBG_EN
97
 
98
 
99 111 olivier.girard
//============================================================================
100
//============================================================================
101
// ADVANCED SYSTEM CONFIGURATION (FOR EXPERIENCED USERS)
102
//============================================================================
103
//============================================================================
104
 
105
//-------------------------------------------------------
106
// Peripheral Memory Space:
107
//-------------------------------------------------------
108
// The original MSP430 architecture map the peripherals
109
// from 0x0000 to 0x01FF (i.e. 512B of the memory space).
110
// The following defines allow you to expand this space
111
// up to 32 kB (i.e. from 0x0000 to 0x7fff).
112
// As a consequence, the data memory mapping will be
113
// shifted up and a custom linker script will therefore
114
// be required by the GCC compiler.
115
//-------------------------------------------------------
116
//`define PER_SIZE_32_KB
117
//`define PER_SIZE_16_KB
118
//`define PER_SIZE_8_KB
119
//`define PER_SIZE_4_KB
120
//`define PER_SIZE_2_KB
121
//`define PER_SIZE_1_KB
122
`define PER_SIZE_512_B
123
 
124
 
125
//-------------------------------------------------------
126
// Defines the debugger CPU_CTL.RST_BRK_EN reset value
127
// (CPU break on PUC reset)
128
//-------------------------------------------------------
129
// When defined, the CPU will automatically break after
130
// a PUC occurrence by default. This is typically usefull
131
// when the program memory can only be initialized through
132
// the serial debug interface.
133
//-------------------------------------------------------
134
//`define DBG_RST_BRK_EN
135
 
136
 
137
//-------------------------------------------------------
138
// Custom user version number
139
//-------------------------------------------------------
140
// This 5 bit field can be freely used in order to allow
141
// custom identification of the system where the openMSP430
142
// is included through the debug interface.
143
// (see CPU_ID.USER_VERSION field in the documentation)
144
//-------------------------------------------------------
145
`define USER_VERSION 5'b00000
146
 
147
 
148
//============================================================================
149
//============================================================================
150
// EXPERT SYSTEM CONFIGURATION ( !!!! EXPERTS ONLY !!!! )
151
//============================================================================
152
//============================================================================
153 2 olivier.girard
//
154 111 olivier.girard
// IMPORTANT NOTE:  Please update following configuration options ONLY if
155
//                 you have a good reason to do so... and if you know what
156
//                 you are doing :-P
157
//
158
//============================================================================
159 2 olivier.girard
 
160 111 olivier.girard
//-------------------------------------------------------
161
// Number of hardware breakpoint units (each unit contains
162
// two hardware address breakpoints):
163
//   - DBG_HWBRK_0 -> Include hardware breakpoints unit 0
164
//   - DBG_HWBRK_1 -> Include hardware breakpoints unit 1
165
//   - DBG_HWBRK_2 -> Include hardware breakpoints unit 2
166
//   - DBG_HWBRK_3 -> Include hardware breakpoints unit 3
167
//-------------------------------------------------------
168
// Please keep in mind that hardware breakpoints only
169
// make sense whenever the program memory is not an SRAM
170
// (i.e. Flash/OTP/ROM/...) or when you are interested
171
// in data breakpoints (btw. not supported by GDB).
172
//-------------------------------------------------------
173
//`define  DBG_HWBRK_0
174
//`define  DBG_HWBRK_1
175
//`define  DBG_HWBRK_2
176
//`define  DBG_HWBRK_3
177
 
178
 
179
//-------------------------------------------------------
180
// Enable/Disable the hardware breakpoint RANGE mode
181
//-------------------------------------------------------
182
// When enabled this feature allows the hardware breakpoint
183
// units to stop the cpu whenever an instruction or data
184
// access lays within an address range.
185
// Note that this feature is not supported by GDB.
186
//-------------------------------------------------------
187
//`define DBG_HWBRK_RANGE
188
 
189
 
190
//-------------------------------------------------------
191
// Input synchronizers
192
//-------------------------------------------------------
193
// In some cases, the asynchronous input ports might
194
// already be synchronized externally.
195
// If an extensive CDC design review showed that this
196
// is really the case,  the individual synchronizers
197
// can be disabled with the following defines.
198 106 olivier.girard
//
199 111 olivier.girard
// Notes:
200
//        - the dbg_en signal will reset the debug interface
201
//         when 0. Therefore make sure it is glitch free.
202 106 olivier.girard
//
203 111 olivier.girard
//        - the dbg_uart_rxd synchronizer must be set to 1
204
//          when its reset is active.
205
//-------------------------------------------------------
206
`define SYNC_CPU_EN
207
`define SYNC_DBG_EN
208
`define SYNC_DBG_UART_RXD
209
`define SYNC_NMI
210 2 olivier.girard
 
211 106 olivier.girard
 
212 111 olivier.girard
 
213 2 olivier.girard
//==========================================================================//
214
//==========================================================================//
215
//==========================================================================//
216
//==========================================================================//
217
//=====        SYSTEM CONSTANTS --- !!!!!!!! DO NOT EDIT !!!!!!!!      =====//
218
//==========================================================================//
219
//==========================================================================//
220
//==========================================================================//
221
//==========================================================================//
222
 
223 72 olivier.girard
//
224 111 olivier.girard
// PROGRAM, DATA & PERIPHERAL MEMORY CONFIGURATION
225
//==================================================
226 2 olivier.girard
 
227 72 olivier.girard
// Program Memory Size
228
`ifdef PMEM_SIZE_59_KB
229
  `define PMEM_AWIDTH      15
230
  `define PMEM_SIZE     60416
231
`endif
232
`ifdef PMEM_SIZE_55_KB
233
  `define PMEM_AWIDTH      15
234
  `define PMEM_SIZE     56320
235
`endif
236
`ifdef PMEM_SIZE_54_KB
237
  `define PMEM_AWIDTH      15
238
  `define PMEM_SIZE     55296
239
`endif
240
`ifdef PMEM_SIZE_51_KB
241
  `define PMEM_AWIDTH      15
242
  `define PMEM_SIZE     52224
243
`endif
244
`ifdef PMEM_SIZE_48_KB
245
  `define PMEM_AWIDTH      15
246
  `define PMEM_SIZE     49152
247
`endif
248
`ifdef PMEM_SIZE_41_KB
249
  `define PMEM_AWIDTH      15
250
  `define PMEM_SIZE     41984
251
`endif
252
`ifdef PMEM_SIZE_32_KB
253
  `define PMEM_AWIDTH      14
254
  `define PMEM_SIZE     32768
255
`endif
256
`ifdef PMEM_SIZE_24_KB
257
  `define PMEM_AWIDTH      14
258
  `define PMEM_SIZE     24576
259
`endif
260
`ifdef PMEM_SIZE_16_KB
261
  `define PMEM_AWIDTH      13
262
  `define PMEM_SIZE     16384
263
`endif
264
`ifdef PMEM_SIZE_12_KB
265
  `define PMEM_AWIDTH      13
266
  `define PMEM_SIZE     12288
267
`endif
268
`ifdef PMEM_SIZE_8_KB
269
  `define PMEM_AWIDTH      12
270
  `define PMEM_SIZE      8192
271
`endif
272
`ifdef PMEM_SIZE_4_KB
273
  `define PMEM_AWIDTH      11
274
  `define PMEM_SIZE      4096
275
`endif
276
`ifdef PMEM_SIZE_2_KB
277
  `define PMEM_AWIDTH      10
278
  `define PMEM_SIZE      2048
279
`endif
280
`ifdef PMEM_SIZE_1_KB
281
  `define PMEM_AWIDTH       9
282
  `define PMEM_SIZE      1024
283
`endif
284
 
285
// Data Memory Size
286
`ifdef DMEM_SIZE_32_KB
287
  `define DMEM_AWIDTH       14
288
  `define DMEM_SIZE      32768
289
`endif
290
`ifdef DMEM_SIZE_24_KB
291
  `define DMEM_AWIDTH       14
292
  `define DMEM_SIZE      24576
293
`endif
294
`ifdef DMEM_SIZE_16_KB
295
  `define DMEM_AWIDTH       13
296
  `define DMEM_SIZE      16384
297
`endif
298
`ifdef DMEM_SIZE_10_KB
299
  `define DMEM_AWIDTH       13
300
  `define DMEM_SIZE      10240
301
`endif
302
`ifdef DMEM_SIZE_8_KB
303
  `define DMEM_AWIDTH       12
304
  `define DMEM_SIZE       8192
305
`endif
306
`ifdef DMEM_SIZE_5_KB
307
  `define DMEM_AWIDTH       12
308
  `define DMEM_SIZE       5120
309
`endif
310
`ifdef DMEM_SIZE_4_KB
311
  `define DMEM_AWIDTH       11
312
  `define DMEM_SIZE       4096
313
`endif
314
`ifdef DMEM_SIZE_2p5_KB
315
  `define DMEM_AWIDTH       11
316
  `define DMEM_SIZE       2560
317
`endif
318
`ifdef DMEM_SIZE_2_KB
319
  `define DMEM_AWIDTH       10
320
  `define DMEM_SIZE       2048
321
`endif
322
`ifdef DMEM_SIZE_1_KB
323
  `define DMEM_AWIDTH        9
324
  `define DMEM_SIZE       1024
325
`endif
326
`ifdef DMEM_SIZE_512_B
327
  `define DMEM_AWIDTH        8
328
  `define DMEM_SIZE        512
329
`endif
330
`ifdef DMEM_SIZE_256_B
331
  `define DMEM_AWIDTH        7
332
  `define DMEM_SIZE        256
333
`endif
334
`ifdef DMEM_SIZE_128_B
335
  `define DMEM_AWIDTH        6
336
  `define DMEM_SIZE        128
337
`endif
338
 
339 111 olivier.girard
// Peripheral Memory Size
340
`ifdef PER_SIZE_32_KB
341
  `define PER_AWIDTH        14
342
  `define PER_SIZE       32768
343
`endif
344
`ifdef PER_SIZE_16_KB
345
  `define PER_AWIDTH        13
346
  `define PER_SIZE       16384
347
`endif
348
`ifdef PER_SIZE_8_KB
349
  `define PER_AWIDTH        12
350
  `define PER_SIZE        8192
351
`endif
352
`ifdef PER_SIZE_4_KB
353
  `define PER_AWIDTH        11
354
  `define PER_SIZE        4096
355
`endif
356
`ifdef PER_SIZE_2_KB
357
  `define PER_AWIDTH        10
358
  `define PER_SIZE        2048
359
`endif
360
`ifdef PER_SIZE_1_KB
361
  `define PER_AWIDTH         9
362
  `define PER_SIZE        1024
363
`endif
364
`ifdef PER_SIZE_512_B
365
  `define PER_AWIDTH         8
366
  `define PER_SIZE         512
367
`endif
368
 
369 33 olivier.girard
// Data Memory Base Adresses
370 111 olivier.girard
`define DMEM_BASE  `PER_SIZE
371 2 olivier.girard
 
372 33 olivier.girard
// Program & Data Memory most significant address bit (for 16 bit words)
373
`define PMEM_MSB   `PMEM_AWIDTH-1
374
`define DMEM_MSB   `DMEM_AWIDTH-1
375 111 olivier.girard
`define PER_MSB    `PER_AWIDTH-1
376 2 olivier.girard
 
377 72 olivier.girard
//
378
// STATES, REGISTER FIELDS, ...
379
//======================================
380 2 olivier.girard
 
381
// Instructions type
382
`define INST_SO  0
383
`define INST_JMP 1
384
`define INST_TO  2
385
 
386
// Single-operand arithmetic
387
`define RRC    0
388
`define SWPB   1
389
`define RRA    2
390
`define SXT    3
391
`define PUSH   4
392
`define CALL   5
393
`define RETI   6
394
`define IRQ    7
395
 
396
// Conditional jump
397
`define JNE    0
398
`define JEQ    1
399
`define JNC    2
400
`define JC     3
401
`define JN     4
402
`define JGE    5
403
`define JL     6
404
`define JMP    7
405
 
406
// Two-operand arithmetic
407
`define MOV    0
408
`define ADD    1
409
`define ADDC   2
410
`define SUBC   3
411
`define SUB    4
412
`define CMP    5
413
`define DADD   6
414
`define BIT    7
415
`define BIC    8
416
`define BIS    9
417
`define XOR   10
418
`define AND   11
419
 
420
// Addressing modes
421
`define DIR      0
422
`define IDX      1
423
`define INDIR    2
424
`define INDIR_I  3
425
`define SYMB     4
426
`define IMM      5
427
`define ABS      6
428
`define CONST    7
429
 
430 111 olivier.girard
// Instruction state machine
431
`define I_IRQ_FETCH 3'h0
432
`define I_IRQ_DONE  3'h1
433
`define I_DEC       3'h2
434
`define I_EXT1      3'h3
435
`define I_EXT2      3'h4
436
`define I_IDLE      3'h5
437
 
438 2 olivier.girard
// Execution state machine
439 111 olivier.girard
`define E_IRQ_0     4'h0
440
`define E_IRQ_1     4'h1
441
`define E_IRQ_2     4'h2
442
`define E_IRQ_3     4'h3
443
`define E_IRQ_4     4'h4
444
`define E_SRC_AD    4'h5
445
`define E_SRC_RD    4'h6
446
`define E_SRC_WR    4'h7
447
`define E_DST_AD    4'h8
448
`define E_DST_RD    4'h9
449
`define E_DST_WR    4'hA
450
`define E_EXEC      4'hB
451
`define E_JUMP      4'hC
452
`define E_IDLE      4'hD
453 2 olivier.girard
 
454
// ALU control signals
455
`define ALU_SRC_INV   0
456
`define ALU_INC       1
457
`define ALU_INC_C     2
458
`define ALU_ADD       3
459
`define ALU_AND       4
460
`define ALU_OR        5
461
`define ALU_XOR       6
462
`define ALU_DADD      7
463
`define ALU_STAT_7    8
464
`define ALU_STAT_F    9
465
`define ALU_SHIFT    10
466
`define EXEC_NO_WR   11
467
 
468
// Debug interface
469
`define DBG_UART_WR   18
470
`define DBG_UART_BW   17
471
`define DBG_UART_ADDR 16:11
472
 
473
// Debug interface CPU_CTL register
474
`define HALT        0
475
`define RUN         1
476
`define ISTEP       2
477
`define SW_BRK_EN   3
478
`define FRZ_BRK_EN  4
479
`define RST_BRK_EN  5
480
`define CPU_RST     6
481
 
482
// Debug interface CPU_STAT register
483
`define HALT_RUN    0
484
`define PUC_PND     1
485
`define SWBRK_PND   3
486
`define HWBRK0_PND  4
487
`define HWBRK1_PND  5
488
 
489
// Debug interface BRKx_CTL register
490
`define BRK_MODE_RD 0
491
`define BRK_MODE_WR 1
492
`define BRK_MODE    1:0
493
`define BRK_EN      2
494
`define BRK_I_EN    3
495
`define BRK_RANGE   4
496
 
497
// Basic clock module: BCSCTL1 Control Register
498
`define DIVAx       5:4
499
 
500
// Basic clock module: BCSCTL2 Control Register
501
`define SELS        3
502
`define DIVSx       2:1
503
 
504
 
505
//
506
// DEBUG INTERFACE EXTRA CONFIGURATION
507
//======================================
508
 
509 111 olivier.girard
// Debug interface: CPU version
510
`define CPU_VERSION   3'h1
511
 
512 2 olivier.girard
// Debug interface: Software breakpoint opcode
513
`define DBG_SWBRK_OP 16'h4343
514
 
515
// Debug UART interface auto data synchronization
516
// If the following define is commented out, then
517
// the DBG_UART_BAUD and DBG_DCO_FREQ need to be properly
518
// defined.
519
`define DBG_UART_AUTO_SYNC
520
 
521
// Debug UART interface data rate
522
//      In order to properly setup the UART debug interface, you
523
//      need to specify the DCO_CLK frequency (DBG_DCO_FREQ) and
524
//      the chosen BAUD rate from the UART interface.
525
//
526
//`define DBG_UART_BAUD    9600
527
//`define DBG_UART_BAUD   19200
528
//`define DBG_UART_BAUD   38400
529
//`define DBG_UART_BAUD   57600
530
//`define DBG_UART_BAUD  115200
531
//`define DBG_UART_BAUD  230400
532
//`define DBG_UART_BAUD  460800
533
//`define DBG_UART_BAUD  576000
534
//`define DBG_UART_BAUD  921600
535
`define DBG_UART_BAUD 2000000
536
`define DBG_DCO_FREQ  20000000
537
`define DBG_UART_CNT ((`DBG_DCO_FREQ/`DBG_UART_BAUD)-1)
538
 
539 111 olivier.girard
// Debug interface selection
540
//             `define DBG_UART -> Enable UART (8N1) debug interface
541
//             `define DBG_JTAG -> DON'T UNCOMMENT, NOT SUPPORTED
542
//
543
`define DBG_UART
544
//`define DBG_JTAG
545
 
546 57 olivier.girard
// Enable/Disable the hardware breakpoint RANGE mode
547 111 olivier.girard
`ifdef DBG_HWBRK_RANGE
548
 `define HWBRK_RANGE 1'b1
549
`else
550
 `define HWBRK_RANGE 1'b0
551
`endif
552 57 olivier.girard
 
553 74 olivier.girard
// Counter width for the debug interface UART
554
`define DBG_UART_XFER_CNT_W 16
555
 
556 2 olivier.girard
// Check configuration
557
`ifdef DBG_EN
558
 `ifdef DBG_UART
559
   `ifdef DBG_JTAG
560
CONFIGURATION ERROR: JTAG AND UART DEBUG INTERFACE ARE BOTH ENABLED
561
   `endif
562
 `else
563
   `ifdef DBG_JTAG
564 33 olivier.girard
CONFIGURATION ERROR: JTAG INTERFACE NOT SUPPORTED
565 2 olivier.girard
   `else
566
CONFIGURATION ERROR: JTAG OR UART DEBUG INTERFACE SHOULD BE ENABLED
567
   `endif
568
 `endif
569
`endif
570 67 olivier.girard
 
571
//
572
// MULTIPLIER CONFIGURATION
573
//======================================
574
 
575
// If uncommented, the following define selects
576
// the 16x16 multiplier (1 cycle) instead of the
577
// default 16x8 multplier (2 cycles)
578
//`define MPY_16x16
579
 

powered by: WebSVN 2.1.0

© copyright 1999-2014 OpenCores.org, equivalent to ORSoC AB, all rights reserved. OpenCores®, registered trademark.