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

Subversion Repositories openmsp430

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

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

Line No. Rev Author Line
1 2 olivier.gi
//----------------------------------------------------------------------------
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.gi
// *File Name: openMSP430_defines.v
26 2 olivier.gi
// 
27
// *Module Description:
28
//                      openMSP430 Configuration file
29
//
30
// *Author(s):
31
//              - Olivier Girard,    olgirard@gmail.com
32
//
33
//----------------------------------------------------------------------------
34 17 olivier.gi
// $Rev: 103 $
35
// $LastChangedBy: olivier.girard $
36
// $LastChangedDate: 2011-03-05 15:44:48 +0100 (Sat, 05 Mar 2011) $
37
//----------------------------------------------------------------------------
38 103 olivier.gi
//`define OMSP_NO_INCLUDE
39
`ifdef OMSP_NO_INCLUDE
40
`else
41 33 olivier.gi
`include "openMSP430_undefines.v"
42 103 olivier.gi
`endif
43 2 olivier.gi
 
44
//----------------------------------------------------------------------------
45
// SYSTEM CONFIGURATION
46
//----------------------------------------------------------------------------
47 72 olivier.gi
//
48
// Note: the sum of both program and data memories should not exceed 63.5 kB
49
//
50 2 olivier.gi
 
51 33 olivier.gi
// Program Memory Size:
52 72 olivier.gi
//                     Uncomment the required memory size
53
//-------------------------------------------------------
54
//`define PMEM_SIZE_59_KB
55
//`define PMEM_SIZE_55_KB
56
//`define PMEM_SIZE_54_KB
57
//`define PMEM_SIZE_51_KB
58
//`define PMEM_SIZE_48_KB
59
//`define PMEM_SIZE_41_KB
60
//`define PMEM_SIZE_32_KB
61
//`define PMEM_SIZE_24_KB
62
//`define PMEM_SIZE_16_KB
63
//`define PMEM_SIZE_12_KB
64
//`define PMEM_SIZE_8_KB
65
//`define PMEM_SIZE_4_KB
66
`define PMEM_SIZE_2_KB
67
//`define PMEM_SIZE_1_KB
68 2 olivier.gi
 
69 33 olivier.gi
// Data Memory Size:
70 72 olivier.gi
//                     Uncomment the required memory size
71
//-------------------------------------------------------
72
//`define DMEM_SIZE_32_KB
73
//`define DMEM_SIZE_24_KB
74
//`define DMEM_SIZE_16_KB
75
//`define DMEM_SIZE_10_KB
76
//`define DMEM_SIZE_8_KB
77
//`define DMEM_SIZE_5_KB
78
//`define DMEM_SIZE_4_KB
79
//`define DMEM_SIZE_2p5_KB
80
//`define DMEM_SIZE_2_KB
81
//`define DMEM_SIZE_1_KB
82
//`define DMEM_SIZE_512_B
83
//`define DMEM_SIZE_256_B
84
`define DMEM_SIZE_128_B
85 2 olivier.gi
 
86 72 olivier.gi
 
87 67 olivier.gi
// Include/Exclude Hardware Multiplier
88
`define MULTIPLIER
89
 
90
 
91 2 olivier.gi
//----------------------------------------------------------------------------
92
// REMOTE DEBUGGING INTERFACE CONFIGURATION
93
//----------------------------------------------------------------------------
94
 
95
// Include Debug interface
96
`define DBG_EN
97
 
98
// Debug interface selection
99
//             `define DBG_UART -> Enable UART (8N1) debug interface
100 33 olivier.gi
//             `define DBG_JTAG -> DON'T UNCOMMENT, NOT SUPPORTED
101 2 olivier.gi
//
102
`define DBG_UART
103
//`define DBG_JTAG
104
 
105
// Number of hardware breakpoints (each unit contains 2 hw address breakpoints)
106
//             `define DBG_HWBRK_0 -> Include hardware breakpoints unit 0
107
//             `define DBG_HWBRK_1 -> Include hardware breakpoints unit 1
108
//             `define DBG_HWBRK_2 -> Include hardware breakpoints unit 2
109
//             `define DBG_HWBRK_3 -> Include hardware breakpoints unit 3
110
//
111
`define  DBG_HWBRK_0
112
`define  DBG_HWBRK_1
113
`define  DBG_HWBRK_2
114
`define  DBG_HWBRK_3
115
 
116
 
117
//==========================================================================//
118
//==========================================================================//
119
//==========================================================================//
120
//==========================================================================//
121
//=====        SYSTEM CONSTANTS --- !!!!!!!! DO NOT EDIT !!!!!!!!      =====//
122
//==========================================================================//
123
//==========================================================================//
124
//==========================================================================//
125
//==========================================================================//
126
 
127 72 olivier.gi
//
128
// PROGRAM & DATA MEMORY CONFIGURATION
129
//======================================
130 2 olivier.gi
 
131 72 olivier.gi
// Program Memory Size
132
`ifdef PMEM_SIZE_59_KB
133
  `define PMEM_AWIDTH      15
134
  `define PMEM_SIZE     60416
135
`endif
136
`ifdef PMEM_SIZE_55_KB
137
  `define PMEM_AWIDTH      15
138
  `define PMEM_SIZE     56320
139
`endif
140
`ifdef PMEM_SIZE_54_KB
141
  `define PMEM_AWIDTH      15
142
  `define PMEM_SIZE     55296
143
`endif
144
`ifdef PMEM_SIZE_51_KB
145
  `define PMEM_AWIDTH      15
146
  `define PMEM_SIZE     52224
147
`endif
148
`ifdef PMEM_SIZE_48_KB
149
  `define PMEM_AWIDTH      15
150
  `define PMEM_SIZE     49152
151
`endif
152
`ifdef PMEM_SIZE_41_KB
153
  `define PMEM_AWIDTH      15
154
  `define PMEM_SIZE     41984
155
`endif
156
`ifdef PMEM_SIZE_32_KB
157
  `define PMEM_AWIDTH      14
158
  `define PMEM_SIZE     32768
159
`endif
160
`ifdef PMEM_SIZE_24_KB
161
  `define PMEM_AWIDTH      14
162
  `define PMEM_SIZE     24576
163
`endif
164
`ifdef PMEM_SIZE_16_KB
165
  `define PMEM_AWIDTH      13
166
  `define PMEM_SIZE     16384
167
`endif
168
`ifdef PMEM_SIZE_12_KB
169
  `define PMEM_AWIDTH      13
170
  `define PMEM_SIZE     12288
171
`endif
172
`ifdef PMEM_SIZE_8_KB
173
  `define PMEM_AWIDTH      12
174
  `define PMEM_SIZE      8192
175
`endif
176
`ifdef PMEM_SIZE_4_KB
177
  `define PMEM_AWIDTH      11
178
  `define PMEM_SIZE      4096
179
`endif
180
`ifdef PMEM_SIZE_2_KB
181
  `define PMEM_AWIDTH      10
182
  `define PMEM_SIZE      2048
183
`endif
184
`ifdef PMEM_SIZE_1_KB
185
  `define PMEM_AWIDTH       9
186
  `define PMEM_SIZE      1024
187
`endif
188
 
189
// Data Memory Size
190
`ifdef DMEM_SIZE_32_KB
191
  `define DMEM_AWIDTH       14
192
  `define DMEM_SIZE      32768
193
`endif
194
`ifdef DMEM_SIZE_24_KB
195
  `define DMEM_AWIDTH       14
196
  `define DMEM_SIZE      24576
197
`endif
198
`ifdef DMEM_SIZE_16_KB
199
  `define DMEM_AWIDTH       13
200
  `define DMEM_SIZE      16384
201
`endif
202
`ifdef DMEM_SIZE_10_KB
203
  `define DMEM_AWIDTH       13
204
  `define DMEM_SIZE      10240
205
`endif
206
`ifdef DMEM_SIZE_8_KB
207
  `define DMEM_AWIDTH       12
208
  `define DMEM_SIZE       8192
209
`endif
210
`ifdef DMEM_SIZE_5_KB
211
  `define DMEM_AWIDTH       12
212
  `define DMEM_SIZE       5120
213
`endif
214
`ifdef DMEM_SIZE_4_KB
215
  `define DMEM_AWIDTH       11
216
  `define DMEM_SIZE       4096
217
`endif
218
`ifdef DMEM_SIZE_2p5_KB
219
  `define DMEM_AWIDTH       11
220
  `define DMEM_SIZE       2560
221
`endif
222
`ifdef DMEM_SIZE_2_KB
223
  `define DMEM_AWIDTH       10
224
  `define DMEM_SIZE       2048
225
`endif
226
`ifdef DMEM_SIZE_1_KB
227
  `define DMEM_AWIDTH        9
228
  `define DMEM_SIZE       1024
229
`endif
230
`ifdef DMEM_SIZE_512_B
231
  `define DMEM_AWIDTH        8
232
  `define DMEM_SIZE        512
233
`endif
234
`ifdef DMEM_SIZE_256_B
235
  `define DMEM_AWIDTH        7
236
  `define DMEM_SIZE        256
237
`endif
238
`ifdef DMEM_SIZE_128_B
239
  `define DMEM_AWIDTH        6
240
  `define DMEM_SIZE        128
241
`endif
242
 
243 33 olivier.gi
// Data Memory Base Adresses
244
`define DMEM_BASE  16'h0200
245 2 olivier.gi
 
246 33 olivier.gi
// Program & Data Memory most significant address bit (for 16 bit words)
247
`define PMEM_MSB   `PMEM_AWIDTH-1
248
`define DMEM_MSB   `DMEM_AWIDTH-1
249 2 olivier.gi
 
250 72 olivier.gi
//
251
// STATES, REGISTER FIELDS, ...
252
//======================================
253 2 olivier.gi
 
254
// Instructions type
255
`define INST_SO  0
256
`define INST_JMP 1
257
`define INST_TO  2
258
 
259
// Single-operand arithmetic
260
`define RRC    0
261
`define SWPB   1
262
`define RRA    2
263
`define SXT    3
264
`define PUSH   4
265
`define CALL   5
266
`define RETI   6
267
`define IRQ    7
268
 
269
// Conditional jump
270
`define JNE    0
271
`define JEQ    1
272
`define JNC    2
273
`define JC     3
274
`define JN     4
275
`define JGE    5
276
`define JL     6
277
`define JMP    7
278
 
279
// Two-operand arithmetic
280
`define MOV    0
281
`define ADD    1
282
`define ADDC   2
283
`define SUBC   3
284
`define SUB    4
285
`define CMP    5
286
`define DADD   6
287
`define BIT    7
288
`define BIC    8
289
`define BIS    9
290
`define XOR   10
291
`define AND   11
292
 
293
// Addressing modes
294
`define DIR      0
295
`define IDX      1
296
`define INDIR    2
297
`define INDIR_I  3
298
`define SYMB     4
299
`define IMM      5
300
`define ABS      6
301
`define CONST    7
302
 
303
// Execution state machine
304
`define E_IRQ_0    4'h0
305
`define E_IRQ_1    4'h1
306
`define E_IRQ_2    4'h2
307
`define E_IRQ_3    4'h3
308
`define E_IRQ_4    4'h4
309
`define E_SRC_AD   4'h5
310
`define E_SRC_RD   4'h6
311
`define E_SRC_WR   4'h7
312
`define E_DST_AD   4'h8
313
`define E_DST_RD   4'h9
314
`define E_DST_WR   4'hA
315
`define E_EXEC     4'hB
316
`define E_JUMP     4'hC
317
`define E_IDLE     4'hD
318
 
319
// ALU control signals
320
`define ALU_SRC_INV   0
321
`define ALU_INC       1
322
`define ALU_INC_C     2
323
`define ALU_ADD       3
324
`define ALU_AND       4
325
`define ALU_OR        5
326
`define ALU_XOR       6
327
`define ALU_DADD      7
328
`define ALU_STAT_7    8
329
`define ALU_STAT_F    9
330
`define ALU_SHIFT    10
331
`define EXEC_NO_WR   11
332
 
333
// Debug interface
334
`define DBG_UART_WR   18
335
`define DBG_UART_BW   17
336
`define DBG_UART_ADDR 16:11
337
 
338
// Debug interface CPU_CTL register
339
`define HALT        0
340
`define RUN         1
341
`define ISTEP       2
342
`define SW_BRK_EN   3
343
`define FRZ_BRK_EN  4
344
`define RST_BRK_EN  5
345
`define CPU_RST     6
346
 
347
// Debug interface CPU_STAT register
348
`define HALT_RUN    0
349
`define PUC_PND     1
350
`define SWBRK_PND   3
351
`define HWBRK0_PND  4
352
`define HWBRK1_PND  5
353
 
354
// Debug interface BRKx_CTL register
355
`define BRK_MODE_RD 0
356
`define BRK_MODE_WR 1
357
`define BRK_MODE    1:0
358
`define BRK_EN      2
359
`define BRK_I_EN    3
360
`define BRK_RANGE   4
361
 
362
// Basic clock module: BCSCTL1 Control Register
363
`define DIVAx       5:4
364
 
365
// Basic clock module: BCSCTL2 Control Register
366
`define SELS        3
367
`define DIVSx       2:1
368
 
369
// Timer A: TACTL Control Register
370
`define TASSELx     9:8
371
`define TAIDx       7:6
372
`define TAMCx       5:4
373
`define TACLR       2
374
`define TAIE        1
375
`define TAIFG       0
376
 
377
// Timer A: TACCTLx Capture/Compare Control Register
378
`define TACMx      15:14
379
`define TACCISx    13:12
380
`define TASCS      11
381
`define TASCCI     10
382
`define TACAP       8
383
`define TAOUTMODx   7:5
384
`define TACCIE      4
385
`define TACCI       3
386
`define TAOUT       2
387
`define TACOV       1
388
`define TACCIFG     0
389
 
390 72 olivier.gi
 
391 2 olivier.gi
//
392
// DEBUG INTERFACE EXTRA CONFIGURATION
393
//======================================
394
 
395
// Debug interface: Software breakpoint opcode
396
`define DBG_SWBRK_OP 16'h4343
397
 
398
// Debug UART interface auto data synchronization
399
// If the following define is commented out, then
400
// the DBG_UART_BAUD and DBG_DCO_FREQ need to be properly
401
// defined.
402
`define DBG_UART_AUTO_SYNC
403
 
404
// Debug UART interface data rate
405
//      In order to properly setup the UART debug interface, you
406
//      need to specify the DCO_CLK frequency (DBG_DCO_FREQ) and
407
//      the chosen BAUD rate from the UART interface.
408
//
409
//`define DBG_UART_BAUD    9600
410
//`define DBG_UART_BAUD   19200
411
//`define DBG_UART_BAUD   38400
412
//`define DBG_UART_BAUD   57600
413
//`define DBG_UART_BAUD  115200
414
//`define DBG_UART_BAUD  230400
415
//`define DBG_UART_BAUD  460800
416
//`define DBG_UART_BAUD  576000
417
//`define DBG_UART_BAUD  921600
418
`define DBG_UART_BAUD 2000000
419
`define DBG_DCO_FREQ  20000000
420
`define DBG_UART_CNT ((`DBG_DCO_FREQ/`DBG_UART_BAUD)-1)
421
 
422 57 olivier.gi
// Enable/Disable the hardware breakpoint RANGE mode
423
`define HWBRK_RANGE 1'b0
424
 
425 74 olivier.gi
// Counter width for the debug interface UART
426
`define DBG_UART_XFER_CNT_W 16
427
 
428 2 olivier.gi
// Check configuration
429
`ifdef DBG_EN
430
 `ifdef DBG_UART
431
   `ifdef DBG_JTAG
432
CONFIGURATION ERROR: JTAG AND UART DEBUG INTERFACE ARE BOTH ENABLED
433
   `endif
434
 `else
435
   `ifdef DBG_JTAG
436 33 olivier.gi
CONFIGURATION ERROR: JTAG INTERFACE NOT SUPPORTED
437 2 olivier.gi
   `else
438
CONFIGURATION ERROR: JTAG OR UART DEBUG INTERFACE SHOULD BE ENABLED
439
   `endif
440
 `endif
441
`endif
442 67 olivier.gi
 
443
//
444
// MULTIPLIER CONFIGURATION
445
//======================================
446
 
447
// If uncommented, the following define selects
448
// the 16x16 multiplier (1 cycle) instead of the
449
// default 16x8 multplier (2 cycles)
450
//`define MPY_16x16
451
 

powered by: WebSVN 2.1.0

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