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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [doc/] [html/] [core.html] - Blame information for rev 115

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

Line No. Rev Author Line
1 50 olivier.gi
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
<html>
3
<head>
4
<title>openMSP430 Core</title>
5
</head>
6
<body>
7
<h3>Table of content</h3>
8
<ul>
9
        <li><a href="#1. Introduction">1. Introduction</a></li>
10
        <li><a href="#2. Design">      2. Design</a>
11
        <ul>
12
      <li><a href="#2.1 Core">        2.1 Core</a>
13
                <ul>
14
           <li><a href="#2.1.1 Design structure">              2.1.1 Design structure</a></li>
15
           <li><a href="#2.1.2 Limitations">                   2.1.2 Limitations</a></li>
16
           <li><a href="#2.1.3 Configuration">                 2.1.3 Configuration</a></li>
17
           <li><a href="#2.1.4 Pinout">                        2.1.4 Pinout</a></li>
18
           <li><a href="#2.1.5 Instruction Cycles and Lengths">2.1.5 Instruction Cycles and Lengths</a></li>
19
           <li><a href="#2.1.6 Serial Debug Interface">        2.1.6 Serial Debug Interface</a></li>
20
                </ul>
21
           </li>
22
      <li><a href="#2.2 Peripherals">        2.2 Peripherals</a>
23
                <ul>
24
           <li><a href="#2.2.1 Basic Clock Module">            2.2.1 Basic Clock Module</a></li>
25
           <li><a href="#2.2.2 Watchdog Timer">                2.2.2 Watchdog Timer</a></li>
26
           <li><a href="#2.2.3 Digital I/O">                   2.2.3 Digital I/O</a></li>
27
           <li><a href="#2.2.4 Timer A">                       2.2.4 Timer A</a></li>
28 69 olivier.gi
           <li><a href="#2.2.5 16x16 Hardware Multiplier">     2.2.5 16x16 Hardware Multiplier</a></li>
29 50 olivier.gi
                </ul>
30
           </li>
31
        </ul>
32
        </li>
33
</ul>
34
 
35
<a name="1. Introduction"></a>
36
<h1>1. Introduction</h1>
37
 
38
The openMSP430 is a 16-bit microcontroller core compatible with TI's MSP430 family (note that the extended version of the architecture, the MSP430X, isn't supported by this IP). It is based on a Von Neumann architecture, with a single address space for instructions and data.
39
<br /><br />
40
This design has been implemented to be FPGA friendly. Therefore, the core doesn't contain any clock gate and has only a single clock domain. As a consequence, the clock management block has a few limitations.
41
<br /><br />
42
This IP doesn't contain the instruction and data memory blocks internally (these are technology dependent hard macros which are connected to the IP during chip integration).
43
However the core is fully configurable in regard to the supported RAM and/or ROM sizes.
44
<br /><br />
45
In addition to the CPU core itself, several peripherals are also provided and can be easily connected to the core during integration.
46
<br /><br />
47
 
48
<a name="2. Design"></a>
49
<h1>2. Design</h1>
50
 
51
<a name="2.1 Core"></a>
52
<h2>2.1 Core</h2>
53
 
54
<a name="2.1.1 Design structure"></a>
55
<h3>2.1.1 Design structure</h3>
56
 
57
The following diagram shows the openMSP430 design structure:
58
<br /><br />
59 69 olivier.gi
<img src="getimg.php?1267738921" width="100%" alt="CPU Structure" title="CPU Structure" />
60 50 olivier.gi
<br />
61
<ul>
62
        <li><b>Frontend</b>: This module performs the instruction Fetch and Decode tasks. It also contains the execution state machine.</li>
63
        <li><b>Execution unit</b>: Containing the ALU and the register file, this module executes the current decoded instruction according to the execution state.</li>
64
        <li><b>Serial Debug Interface</b>: Contains all the required logic for a Nexus class 3 debugging unit (without trace). Communication with the host is done with a standard 8N1 serial interface.</li>
65
   <li><b>Memory backbone</b>: This block performs a simple arbitration between the frontend and execution-unit for program, data and peripheral memory access.</li>
66
   <li><b>Basic Clock Module</b>: Generates the ACLK and SMCLK enable signals.</li>
67
   <li><b>SFRs</b>: The <b>S</b>pecial <b>F</b>unction <b>R</b>egister<b>s</b> block contain diverse configuration registers (NMI, Watchdog, ...).</li>
68
   <li><b>Watchdog</b>: Although it is a peripheral, the watchdog is permanently included in the core because of its tight links with the NMI interrupts and the PUC reset generation.</li>
69
</ul>
70
 
71
<a name="2.1.2 Limitations"></a>
72
<h3>2.1.2 Limitations</h3>
73
 
74
The known core limitations are the following:
75
<br />
76
<ul>
77
        <li>Instructions can't be executed from the data memory.</li>
78
        <li>SCG0 is not implemented (turns off DCO).</li>
79
        <li>MCLK can't be divided and can only have DCO_CLK as source (see <a href="#2.2.1 Basic Clock Module">Basic Clock Module</a> section).</li>
80
</ul>
81
 
82
<a name="2.1.3 Configuration"></a>
83
<h3>2.1.3 Configuration</h3>
84
 
85
It is possible to configure the openMSP430 core through the "openMSP430_defines.v" file located in the "rtl" directory (see <a href="http://www.opencores.org/project,openmsp430,file%20and%20directory%20description">file and directory description</a>).<br />
86 72 olivier.gi
Two sets of parameters can be adjusted by the user in order to define the program and data memory sizes:
87 50 olivier.gi
<br /><br />
88
<table border="0" cellspacing="4" cellpadding="0">
89
<tr>
90
<td width="35"></td>
91
<td bgcolor="#d0d0d0" width="3"></td>
92
<td width="15"></td>
93
<td>
94
        <code>
95 72 olivier.gi
            // Program Memory Size:
96
                <br />//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Uncomment the required memory size
97
                <br />//-------------------------------------------------------
98
                <br />//`define PMEM_SIZE_59_KB
99
                <br />//`define PMEM_SIZE_55_KB
100
                <br />//`define PMEM_SIZE_54_KB
101
                <br />//`define PMEM_SIZE_51_KB
102
                <br />//`define PMEM_SIZE_48_KB
103
                <br />//`define PMEM_SIZE_41_KB
104
                <br />//`define PMEM_SIZE_32_KB
105
                <br />//`define PMEM_SIZE_24_KB
106
                <br />//`define PMEM_SIZE_16_KB
107
                <br />//`define PMEM_SIZE_12_KB
108
                <br />//`define PMEM_SIZE_8_KB
109
                <br />//`define PMEM_SIZE_4_KB
110
                <br />`define PMEM_SIZE_2_KB
111
                <br />//`define PMEM_SIZE_1_KB
112 50 olivier.gi
                <br />
113 72 olivier.gi
                <br />// Data Memory Size:
114
                <br />//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Uncomment the required memory size
115
                <br />//-------------------------------------------------------
116
                <br />//`define DMEM_SIZE_32_KB
117
                <br />//`define DMEM_SIZE_24_KB
118
                <br />//`define DMEM_SIZE_16_KB
119
                <br />//`define DMEM_SIZE_10_KB
120
                <br />//`define DMEM_SIZE_8_KB
121
                <br />//`define DMEM_SIZE_5_KB
122
                <br />//`define DMEM_SIZE_4_KB
123
                <br />//`define DMEM_SIZE_2p5_KB
124
                <br />//`define DMEM_SIZE_2_KB
125
                <br />//`define DMEM_SIZE_1_KB
126
                <br />//`define DMEM_SIZE_512_B
127
                <br />//`define DMEM_SIZE_256_B
128
                <br />`define DMEM_SIZE_128_B
129 50 olivier.gi
        </code>
130
</td>
131
</tr>
132
</table>
133
<br /><br />
134 72 olivier.gi
<b>Note:</b> The sum of both program and data memories <b>SHOULD NOT</b> exceed 63.5 kB.
135 50 olivier.gi
<br /><br /><br />
136
The following parameters define if the debug interface should be included or not and how many hardware breakpoint units should be included.
137
 
138
<br /><br />
139
<table border="0" cellspacing="4" cellpadding="0">
140
<tr>
141
<td width="35"></td>
142
<td bgcolor="#d0d0d0" width="3"></td>
143
<td width="15"></td>
144
<td>
145
        <code>
146
            //----------------------------------------------------------------------------
147
                <br />// REMOTE DEBUGGING INTERFACE CONFIGURATION
148
                <br />//----------------------------------------------------------------------------
149
                <br />
150
                <br />// Include Debug interface
151
                <br />`define DBG_EN
152
                <br />
153
                <br />// Debug interface selection
154
                <br />//             `define DBG_UART -> Enable UART (8N1) debug interface
155
                <br />//             `define DBG_JTAG -> DON'T UNCOMMENT, NOT SUPPORTED
156
                <br />//
157
                <br />`define DBG_UART
158
                <br />//`define DBG_JTAG
159
                <br />
160
                <br />// Number of hardware breakpoints (each unit contains 2 hw address breakpoints)
161
                <br />//             `define DBG_HWBRK_0 -> Include hardware breakpoints unit 0
162
                <br />//             `define DBG_HWBRK_1 -> Include hardware breakpoints unit 1
163
                <br />//             `define DBG_HWBRK_2 -> Include hardware breakpoints unit 2
164
                <br />//             `define DBG_HWBRK_3 -> Include hardware breakpoints unit 3
165
                <br />//
166
                <br />`define  DBG_HWBRK_0
167
                <br />`define  DBG_HWBRK_1
168
                <br />`define  DBG_HWBRK_2
169
                <br />`define  DBG_HWBRK_3
170
        </code>
171
</td>
172
</tr>
173
</table>
174
<br /><br />
175
<b>Note:</b> Since the hardware breakpoint units are relatively big, it is recommended to include as many as you plan to use. These units are particularly useful if your instruction memory is a ROM (i.e. when you can't use software breakpoints) or if you want to be able to stop the CPU whenever some particular data addresses are accessed.
176
<br /><br /><br />
177 69 olivier.gi
At last, this parameter controls if the hardware multiplier is included or not.
178
<br /><br />
179
<table border="0" cellspacing="4" cellpadding="0">
180
<tr>
181
<td width="35"></td>
182
<td bgcolor="#d0d0d0" width="3"></td>
183
<td width="15"></td>
184
<td>
185
        <code>
186
            // Include/Exclude Hardware Multiplier
187
                <br />`define MULTIPLIER
188
        </code>
189
</td>
190
</tr>
191
</table>
192
<br /><br /><br />
193 50 olivier.gi
All remaining defines located in this file are system constants and should not be edited.
194
 
195
<a name="2.1.4 Pinout"></a>
196
<h3>2.1.4 Pinout</h3>
197
 
198
The full pinout of the openMSP430 core is provided in the following table:
199
<br /><br />
200
<table border="1">
201
        <tr> <td align="center"><b>Port Name</b></td> <td align="center"><b>Direction</b></td> <td align="center"><b>Width</b>    </td> <td align="center"><b>Description</b></td> </tr>
202
 
203
        <tr> <td colspan="4" align="center"> <b><i>Clocks</i></b>                         </td></tr>
204
        <tr>
205
             <td> dco_clk                                                          </td>
206
             <td> Input                                                            </td>
207
             <td> 1                                                                </td>
208
             <td> Fast oscillator (fast clock), CPU clock                          </td>
209
        </tr>
210
        <tr>
211
             <td> lfxt_clk                                                         </td>
212
             <td> Input                                                            </td>
213
             <td> 1                                                                </td>
214
             <td> Low frequency oscillator (typ. 32kHz)                            </td>
215
   </tr>
216
        <tr>
217
             <td> mclk                                                             </td>
218
             <td> Output                                                           </td>
219
             <td> 1                                                                </td>
220
             <td> Main system clock                                                </td>
221
        </tr>
222
        <tr>
223
             <td> aclk_en                                                          </td>
224
             <td> Output                                                           </td>
225
             <td> 1                                                                </td>
226
             <td> ACLK enable                                                      </td>
227
   </tr>
228
        <tr>
229
             <td> smclk_en                                                         </td>
230
             <td> Output                                                           </td>
231
             <td> 1                                                                </td>
232
             <td> SMCLK enable                                                     </td>
233
   </tr>
234
 
235
        <tr> <td colspan="4" align="center"> <b><i>Resets</i></b>                         </td></tr>
236
        <tr>
237
             <td> puc                                                              </td>
238
             <td> Output                                                           </td>
239
             <td> 1                                                                </td>
240
             <td> Main system reset                                                </td>
241
   </tr>
242
        <tr>
243
             <td> reset_n                                                          </td>
244
             <td> Input                                                            </td>
245
             <td> 1                                                                </td>
246
             <td> Reset Pin (low active)                                           </td>
247
        </tr>
248
 
249
 
250
        <tr> <td colspan="4" align="center"> <b><i>Program Memory interface</i></b>       </td></tr>
251
        <tr>
252
             <td> pmem_addr                                                        </td>
253
             <td> Output                                                           </td>
254
             <td> `PMEM_AWIDTH<sup>1</sup>                                        </td>
255
             <td> Program Memory address                                           </td>
256
        </tr>
257
        <tr>
258
             <td> pmem_cen                                                         </td>
259
             <td> Output                                                           </td>
260
             <td> 1                                                                </td>
261
             <td> Program Memory chip enable (low active)                          </td>
262
        </tr>
263
        <tr>
264
             <td> pmem_din                                                         </td>
265
             <td> Output                                                           </td>
266
             <td> 16                                                               </td>
267
             <td> Program Memory data input (optional<sup>2</sup>)                </td>
268
        </tr>
269
        <tr>
270
             <td> pmem_dout                                                        </td>
271
             <td> Input                                                            </td>
272
             <td> 16                                                               </td>
273
             <td> Program Memory data output                                       </td>
274
        </tr>
275
        <tr>
276
             <td> pmem_wen                                                         </td>
277
             <td> Output                                                           </td>
278
             <td> 2                                                                </td>
279
             <td> Program Memory write enable (low active) (optional<sup>2</sup>) </td>
280
        </tr>
281
 
282
        <tr> <td colspan="4" align="center"> <b><i>Data Memory interface</i></b>          </td></tr>
283
        <tr>
284
             <td> dmem_addr                                                        </td>
285
             <td> Output                                                           </td>
286
             <td> `DMEM_AWIDTH<sup>1</sup>                                        </td>
287
             <td> Data Memory address                                              </td>
288
        </tr>
289
        <tr>
290
             <td> dmem_cen                                                         </td>
291
             <td> Output                                                           </td>
292
             <td> 1                                                                </td>
293
             <td> Data Memory chip enable (low active)                             </td>
294
        </tr>
295
        <tr>
296
             <td> dmem_din                                                         </td>
297
             <td> Output                                                           </td>
298
             <td> 16                                                               </td>
299
             <td> Data Memory data input                                           </td>
300
        </tr>
301
        <tr>
302
             <td> dmem_dout                                                        </td>
303
             <td> Input                                                            </td>
304
             <td> 16                                                               </td>
305
             <td> Data Memory data output                                          </td>
306
        </tr>
307
        <tr>
308
             <td> dmem_wen                                                         </td>
309
             <td> Output                                                           </td>
310
             <td> 2                                                                </td>
311
             <td> Data Memory write enable (low active)                            </td>
312
        </tr>
313
 
314
        <tr> <td colspan="4" align="center"> <b><i>External Peripherals interface</i></b> </td></tr>
315
        <tr>
316
             <td> per_addr                                                         </td>
317
             <td> Output                                                           </td>
318
             <td> 8                                                                </td>
319
             <td> Peripheral address                                               </td>
320
        </tr>
321
        <tr>
322
             <td> per_din                                                          </td>
323
             <td> Output                                                           </td>
324
             <td> 16                                                               </td>
325
             <td> Peripheral data input                                            </td>
326
   </tr>
327
        <tr>
328
             <td> per_dout                                                         </td>
329
             <td> Input                                                            </td>
330
             <td> 16                                                               </td>
331
             <td> Peripheral data output                                           </td>
332
        </tr>
333
        <tr>
334
             <td> per_en                                                           </td>
335
             <td> Output                                                           </td>
336
             <td> 1                                                                </td>
337
             <td> Peripheral enable (high active)                                  </td>
338
        </tr>
339
        <tr>
340
             <td> per_wen                                                          </td>
341
             <td> Output                                                           </td>
342
             <td> 2                                                                </td>
343
             <td> Peripheral write enable (high active)                            </td>
344
        </tr>
345
 
346
        <tr> <td colspan="4" align="center"> <b><i>Interrupts</i></b>                     </td></tr>
347
        <tr>
348
                  <td> irq                                                              </td>
349
                  <td> Input                                                            </td>
350
                  <td> 14                                                               </td>
351
                  <td> Maskable interrupts (one-hot signal)                             </td>
352
   </tr>
353
        <tr>
354
             <td> nmi                                                              </td>
355
             <td> Input                                                            </td>
356
             <td> 1                                                                </td>
357
             <td> Non-maskable interrupt (asynchronous)                            </td>
358
        </tr>
359
        <tr>
360
             <td> irq_acc                                                          </td>
361
             <td> Output                                                           </td>
362
             <td> 14                                                               </td>
363
             <td> Interrupt request accepted (one-hot signal)                      </td>
364
        </tr>
365
 
366
        <tr> <td colspan="4" align="center"> <b><i>Serial Debug interface</i></b>         </td></tr>
367
        <tr>
368
             <td> dbg_freeze                                                       </td>
369
             <td> Output                                                           </td>
370
             <td> 1                                                                </td>
371
             <td> Freeze peripherals                                               </td>
372
        </tr>
373
        <tr>
374
             <td> dbg_uart_txd                                                     </td>
375
             <td> Output                                                           </td>
376
             <td> 1                                                                </td>
377
             <td> Debug interface: UART TXD                                        </td>
378
        </tr>
379
        <tr>
380
             <td> dbg_uart_rxd                                                     </td>
381
             <td> Input                                                            </td>
382
             <td> 1                                                                </td>
383
             <td> Debug interface: UART RXD                                        </td>
384
        </tr>
385
</table>
386
<br />
387
<sup>1</sup>: This parameter is declared in the "openMSP430_defines.v" file and defines the RAM/ROM size.<br />
388
<sup>2</sup>: These two optional ports can be connected whenever the program memory is a RAM. This will allow the user to load a program through the serial debug interface and to use software breakpoints.
389
<br /><br />
390
 
391
<a name="2.1.5 Instruction Cycles and Lengths"></a>
392
<h3>2.1.5 Instruction Cycles and Lengths</h3>
393
 
394
The number of CPU clock cycles required for an instruction depends on the instruction format and the addressing modes used, not the instruction itself.
395
<br />In the following tables, the number of clock cycles refers to the main clock (<i>MCLK</i>).
396
Differences with the original MSP430 are highlighted in green (the original value being red).
397
<ul>
398
        <li><b>Interrupt and Reset Cycles</b></li>
399
</ul>
400
<table border="1">
401
        <tr> <td align="center"><b>Action</b>  </td> <td align="center"><b>No. of Cycles</b></td> <td align="center"><b>Length of Instruction</b></td> </tr>
402
        <tr> <td> Return from interrupt (RETI) </td> <td align="center">       5            </td> <td align="center">           1                </td> </tr>
403
        <tr> <td> Interrupt accepted           </td> <td align="center">       6            </td> <td align="center">           -                </td> </tr>
404
        <tr> <td> WDT reset                    </td> <td align="center">       4            </td> <td align="center">           -                </td> </tr>
405
        <tr> <td> Reset (!RST/NMI)             </td> <td align="center">       4            </td> <td align="center">           -                </td> </tr>
406
</table>
407
 
408
<ul>
409
        <li><b>Format-II (Single Operand) Instruction Cycles and Lengths</b></li>
410
</ul>
411
<table border="1">
412
        <tr> <td rowspan="2" align="center"><b>Addressing Mode</b>  </td> <td colspan="3" align="center"><b>No. of Cycles</b></td> <td rowspan="2" align="center"><b>Length of Instruction</b></td> </tr>
413
        <tr>                                                              <td><b>RRA, RRC, SWPB, SXT</b></td> <td><b>PUSH</b></td> <td><b>CALL</b></td> </tr>
414
 
415
        <tr> <td align="center"> Rn    </td> <td align="center"> 1   </td> <td align="center"> 3 </td> <td align="center"><b><font color="green">3 </font><font color="red"> (4)</font></b></td> <td align="center"> 1 </td> </tr>
416
        <tr> <td align="center"> @Rn   </td> <td align="center"> 3   </td> <td align="center"> 4 </td> <td align="center"> 4 </td> <td align="center"> 1 </td> </tr>
417
        <tr> <td align="center"> @Rn+  </td> <td align="center"> 3   </td> <td align="center"><b><font color="green">4 </font><font color="red"> (5)</font></b></td> <td align="center"><b><font color="green">4 </font><font color="red"> (5)</font></b></td> <td align="center"> 1 </td> </tr>
418
        <tr> <td align="center"> #N    </td> <td align="center"> N/A </td> <td align="center"> 4 </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
419
        <tr> <td align="center"> X(Rn) </td> <td align="center"> 4   </td> <td align="center"> 5 </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
420
        <tr> <td align="center"> EDE   </td> <td align="center"> 4   </td> <td align="center"> 5 </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
421
        <tr> <td align="center"> &EDE  </td> <td align="center"> 4   </td> <td align="center"> 5 </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
422
</table>
423
 
424
<ul>
425
        <li><b>Format-III (Jump) Instruction Cycles and Lengths</b></li>
426
</ul>
427
All jump instructions require one code word, and take two CPU cycles to execute, regardless of whether the jump is taken or not.
428
 
429
<ul>
430
        <li><b>Format-I (Double Operand) Instruction Cycles and Lengths</b></li>
431
</ul>
432
<table border="1">
433
        <tr> <td colspan="2" align="center"><b>Addressing Mode</b>  </td> <td rowspan="2" align="center"><b>No. of Cycles</b></td> <td rowspan="2" align="center"><b>Length of Instruction</b></td> </tr>
434
        <tr> <td align="center"><b>Src</b></td> <td align="center"><b>Dst</b></td> </tr>
435
 
436
        <tr> <td rowspan="5" align="center"> Rn    </td> <td align="center"> Rm    </td> <td align="center"> 1 </td> <td align="center"> 1 </td> </tr>
437
        <tr>                                             <td align="center"> PC    </td> <td align="center"> 2 </td> <td align="center"> 1 </td> </tr>
438
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 4 </td> <td align="center"> 2 </td> </tr>
439
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 4 </td> <td align="center"> 2 </td> </tr>
440
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 4 </td> <td align="center"> 2 </td> </tr>
441
        <tr> <td rowspan="5" align="center"> @Rn   </td> <td align="center"> Rm    </td> <td align="center"> 2 </td> <td align="center"> 1 </td> </tr>
442
        <tr>                                             <td align="center"> PC    </td> <td align="center"><b><font color="green">3 </font><font color="red"> (2)</font></b></td> <td align="center"> 1 </td> </tr>
443
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
444
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
445
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
446
        <tr> <td rowspan="5" align="center"> @Rn+  </td> <td align="center"> Rm    </td> <td align="center"> 2 </td> <td align="center"> 1 </td> </tr>
447
        <tr>                                             <td align="center"> PC    </td> <td align="center"> 3 </td> <td align="center"> 1 </td> </tr>
448
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
449
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
450
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 5 </td> <td align="center"> 2 </td> </tr>
451
        <tr> <td rowspan="5" align="center"> #N    </td> <td align="center"> Rm    </td> <td align="center"> 2 </td> <td align="center"> 2 </td> </tr>
452
        <tr>                                             <td align="center"> PC    </td> <td align="center"> 3 </td> <td align="center"> 2 </td> </tr>
453
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 5 </td> <td align="center"> 3 </td> </tr>
454
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 5 </td> <td align="center"> 3 </td> </tr>
455
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 5 </td> <td align="center"> 3 </td> </tr>
456
        <tr> <td rowspan="5" align="center"> x(Rn) </td> <td align="center"> Rm    </td> <td align="center"> 3 </td> <td align="center"> 2 </td> </tr>
457
        <tr>                                             <td align="center"> PC    </td> <td align="center"><b><font color="green">3 </font><font color="red"> (4)</font></b></td> <td align="center"> 2 </td> </tr>
458
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
459
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
460
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
461
        <tr> <td rowspan="5" align="center"> EDE   </td> <td align="center"> Rm    </td> <td align="center"> 3 </td> <td align="center"> 2 </td> </tr>
462
        <tr>                                             <td align="center"> PC    </td> <td align="center"><b><font color="green">3 </font><font color="red"> (4)</font></b></td> <td align="center"> 2 </td> </tr>
463
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
464
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
465
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
466
        <tr> <td rowspan="5" align="center"> &EDE  </td> <td align="center"> Rm    </td> <td align="center"> 3 </td> <td align="center"> 2 </td> </tr>
467
        <tr>                                             <td align="center"> PC    </td> <td align="center"> 3 </td> <td align="center"> 2 </td> </tr>
468
        <tr>                                             <td align="center"> x(Rm) </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
469
        <tr>                                             <td align="center"> EDE   </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
470
        <tr>                                             <td align="center"> &EDE  </td> <td align="center"> 6 </td> <td align="center"> 3 </td> </tr>
471
</table>
472
 
473
<a name="2.1.6 Serial Debug Interface"></a>
474
<h3>2.1.6 Serial Debug Interface</h3>
475
 
476
All the details about the Serial Debug Interface are located <a href="http://www.opencores.org/project/openmsp430/serial%20debug%20interface">here</a>.
477
<a name="2.2 Peripherals"></a>
478
<h2>2.2 Peripherals</h2>
479
 
480
In addition to the CPU core itself, several peripherals are also provided and can be easily connected to the core during integration.
481
 
482
<a name="2.2.1 Basic Clock Module"></a>
483
<h3>2.2.1 Basic Clock Module</h3>
484
 
485
In order to make an FPGA implementation as simple as possible (ideally, a non-designer should be able to do it), clock gates are not used in the design and neither are clock muxes.
486
<br />
487
With these constrains, the Basic Clock Module is implemented as following:
488
<br /><br />
489
<img src="getimg.php?1249244393" alt="Clock structure diagram" title="Clock structure diagram" />
490
<br />
491
<b>Note</b>: CPUOFF doesn't switch MCLK off and will instead bring the CPU state machines in an IDLE state while MCLK will still be running.
492
<br /><br />
493
 
494
In order to '<i>clock</i>' a register with ACLK or SMCLK, the following structure needs to be implemented:
495
<br /><br />
496
<img src="getimg.php?1246434793" alt="Clock implementation example" title="Clock implementation example" />
497
<br /><br />
498
The following Verilog code would implement a counter clocked with SMCLK:
499
<br />
500
<table border="0" cellspacing="4" cellpadding="0">
501
<tr>
502
<td width="35"></td>
503
<td bgcolor="#d0d0d0" width="3"></td>
504
<td width="15"></td>
505
<td>
506
        <code>
507
                      reg  [7:0] test_cnt;
508
                <br />
509
                <br />always @ (posedge mclk or posedge puc)
510
                <br />  if (puc)           test_cnt <=  8'h00;
511
                <br />  else if (smclk_en) test_cnt <=  test_cnt + 8'h01;
512
        </code>
513
</td>
514
</tr>
515
</table>
516
<br /><br />
517
<b>Register Description</b>
518
<ul>
519
        <li>DCOCTL: Not implemented</li>
520
        <li>BCSCTL1:
521
        <ul>
522
      <li>BCSCTL1[7:6]: Unused</li>
523
      <li>BCSCTL1[5:4]: DIVAx</li>
524
      <li>BCSCTL1[4:0]: Unused</li>
525
        </ul>
526
        </li>
527
        <li>BCSCTL2:
528
        <ul>
529
      <li>BCSCTL2[7:4]: Unused</li>
530
      <li>BCSCTL2[3]&nbsp;&nbsp;&nbsp;: SELS</li>
531
      <li>BCSCTL2[2:1]: DIVSx</li>
532
      <li>BCSCTL2[0]&nbsp;&nbsp;&nbsp;: Unused</li>
533
        </ul>
534
        </li>
535
</ul>
536
 
537
<a name="2.2.2 Watchdog Timer"></a>
538
<h3>2.2.2 Watchdog Timer</h3>
539
 
540 69 olivier.gi
100% of the features advertised in the <a href="http://www.ti.com/litv/pdf/slau049f">MSP430x1xx Family User's Guide</a> (Chapter 10) have been implemented.
541 50 olivier.gi
 
542
<a name="2.2.3 Digital I/O"></a>
543
<h3>2.2.3 Digital I/O</h3>
544
 
545 69 olivier.gi
100% of the features advertised in the <a href="http://www.ti.com/litv/pdf/slau049f">MSP430x1xx Family User's Guide</a> (Chapter 9) have been implemented.
546 50 olivier.gi
<br /><br />
547
The following Verilog parameters will enable or disable the corresponding ports in order to save area (i.e. FPGA utilization):
548
<br /><br />
549
<table border="0" cellspacing="4" cellpadding="0">
550
<tr>
551
<td width="35"></td>
552
<td bgcolor="#d0d0d0" width="3"></td>
553
<td width="15"></td>
554
<td>
555
        <code>
556
                      parameter           P1_EN = 1'b1;   // Enable Port 1
557
                <br />parameter           P2_EN = 1'b1;   // Enable Port 2
558
                <br />parameter           P3_EN = 1'b0;   // Enable Port 3
559
                <br />parameter           P4_EN = 1'b0;   // Enable Port 4
560
                <br />parameter           P5_EN = 1'b0;   // Enable Port 5
561
                <br />parameter           P6_EN = 1'b0;   // Enable Port 6
562
        </code>
563
</td>
564
</tr>
565
</table>
566
<br />
567
They can be updated as following during the module instantiation (here port 1, 2 and 3 are enabled):
568
<br /><br />
569
<table border="0" cellspacing="4" cellpadding="0">
570
<tr>
571
<td width="35"></td>
572
<td bgcolor="#d0d0d0" width="3"></td>
573
<td width="15"></td>
574
<td>
575
        <code>
576
                      gpio #(.P1_EN(1),
577
                <br />       .P2_EN(1),
578
                <br />       .P3_EN(1),
579
                <br />       .P4_EN(0),
580
                <br />       .P5_EN(0),
581
                <br />       .P6_EN(0)) gpio_0 (
582
        </code>
583
</td>
584
</tr>
585
</table>
586
<br />
587
The full pinout of the GPIO module is provided in the following table:
588
<br /><br />
589
<table border="1">
590
        <tr> <td align="center"><b>Port Name</b></td> <td align="center"><b>Direction</b></td> <td align="center"><b>Width</b>    </td> <td align="center"><b>Description</b></td> </tr>
591
        <tr> <td colspan="4" align="center"> <b><i>Clocks & Resets</i></b>  </td></tr>
592
        <tr> <td> mclk           </td> <td>  Input         </td> <td>       1        </td> <td> Main system clock                           </td> </tr>
593
        <tr> <td> puc            </td> <td>  Input         </td> <td>       1        </td> <td> Main system reset                           </td> </tr>
594
        <tr> <td colspan="4" align="center"> <b><i>Interrupts</i></b>  </td></tr>
595
        <tr> <td> irq_port1      </td> <td>  Output        </td> <td>       1        </td> <td> Port 1 interrupt                            </td> </tr>
596
        <tr> <td> irq_port2      </td> <td>  Output        </td> <td>       1        </td> <td> Port 2 interrupt                            </td> </tr>
597
        <tr> <td colspan="4" align="center"> <b><i>External Peripherals interface</i></b>  </td></tr>
598
        <tr> <td> per_addr       </td> <td>  Input         </td> <td>       8        </td> <td> Peripheral address                          </td> </tr>
599
        <tr> <td> per_din        </td> <td>  Input         </td> <td>      16        </td> <td> Peripheral data input                       </td> </tr>
600
        <tr> <td> per_dout       </td> <td>  Output        </td> <td>      16        </td> <td> Peripheral data output                      </td> </tr>
601
        <tr> <td> per_en         </td> <td>  Input         </td> <td>       1        </td> <td> Peripheral enable (high active)             </td> </tr>
602
        <tr> <td> per_wen        </td> <td>  Input         </td> <td>       2        </td> <td> Peripheral write enable (high active)       </td> </tr>
603
        <tr> <td colspan="4" align="center"> <b><i>Port 1</i></b>  </td></tr>
604
        <tr> <td> p1_din         </td> <td>  Input         </td> <td>       8        </td> <td> Port 1 data input                           </td> </tr>
605
        <tr> <td> p1_dout        </td> <td>  Output        </td> <td>       8        </td> <td> Port 1 data output                          </td> </tr>
606
        <tr> <td> p1_dout_en     </td> <td>  Output        </td> <td>       8        </td> <td> Port 1 data output enable                   </td> </tr>
607
        <tr> <td> p1_sel         </td> <td>  Output        </td> <td>       8        </td> <td> Port 1 function select                      </td> </tr>
608
        <tr> <td colspan="4" align="center"> <b><i>Port 2</i></b>  </td></tr>
609
        <tr> <td> p2_din         </td> <td>  Input         </td> <td>       8        </td> <td> Port 2 data input                           </td> </tr>
610
        <tr> <td> p2_dout        </td> <td>  Output        </td> <td>       8        </td> <td> Port 2 data output                          </td> </tr>
611
        <tr> <td> p2_dout_en     </td> <td>  Output        </td> <td>       8        </td> <td> Port 2 data output enable                   </td> </tr>
612
        <tr> <td> p2_sel         </td> <td>  Output        </td> <td>       8        </td> <td> Port 2 function select                      </td> </tr>
613
        <tr> <td colspan="4" align="center"> <b><i>Port 3</i></b>  </td></tr>
614
        <tr> <td> p3_din         </td> <td>  Input         </td> <td>       8        </td> <td> Port 3 data input                           </td> </tr>
615
        <tr> <td> p3_dout        </td> <td>  Output        </td> <td>       8        </td> <td> Port 3 data output                          </td> </tr>
616
        <tr> <td> p3_dout_en     </td> <td>  Output        </td> <td>       8        </td> <td> Port 3 data output enable                   </td> </tr>
617
        <tr> <td> p3_sel         </td> <td>  Output        </td> <td>       8        </td> <td> Port 3 function select                      </td> </tr>
618
        <tr> <td colspan="4" align="center"> <b><i>Port 4</i></b>  </td></tr>
619
        <tr> <td> p4_din         </td> <td>  Input         </td> <td>       8        </td> <td> Port 4 data input                           </td> </tr>
620
        <tr> <td> p4_dout        </td> <td>  Output        </td> <td>       8        </td> <td> Port 4 data output                          </td> </tr>
621
        <tr> <td> p4_dout_en     </td> <td>  Output        </td> <td>       8        </td> <td> Port 4 data output enable                   </td> </tr>
622
        <tr> <td> p4_sel         </td> <td>  Output        </td> <td>       8        </td> <td> Port 4 function select                      </td> </tr>
623
        <tr> <td colspan="4" align="center"> <b><i>Port 5</i></b>  </td></tr>
624
        <tr> <td> p5_din         </td> <td>  Input         </td> <td>       8        </td> <td> Port 5 data input                           </td> </tr>
625
        <tr> <td> p5_dout        </td> <td>  Output        </td> <td>       8        </td> <td> Port 5 data output                          </td> </tr>
626
        <tr> <td> p5_dout_en     </td> <td>  Output        </td> <td>       8        </td> <td> Port 5 data output enable                   </td> </tr>
627
        <tr> <td> p5_sel         </td> <td>  Output        </td> <td>       8        </td> <td> Port 5 function select                      </td> </tr>
628
        <tr> <td colspan="4" align="center"> <b><i>Port 6</i></b>  </td></tr>
629
        <tr> <td> p6_din         </td> <td>  Input         </td> <td>       8        </td> <td> Port 6 data input                           </td> </tr>
630
        <tr> <td> p6_dout        </td> <td>  Output        </td> <td>       8        </td> <td> Port 6 data output                          </td> </tr>
631
        <tr> <td> p6_dout_en     </td> <td>  Output        </td> <td>       8        </td> <td> Port 6 data output enable                   </td> </tr>
632
        <tr> <td> p6_sel         </td> <td>  Output        </td> <td>       8        </td> <td> Port 6 function select                      </td> </tr>
633
      </table>
634
 
635
<a name="2.2.4 Timer A"></a>
636
<h3>2.2.4 Timer A</h3>
637
 
638 69 olivier.gi
100% of the features advertised in the <a href="http://www.ti.com/litv/pdf/slau049f">MSP430x1xx Family User's Guide</a> (Chapter 11) have been implemented.
639 50 olivier.gi
<br /><br />
640
The full pinout of the Timer A module is provided in the following table:
641
<br /><br />
642
<table border="1">
643
        <tr> <td align="center"><b>Port Name</b></td> <td align="center"><b>Direction</b></td> <td align="center"><b>Width</b>    </td> <td align="center"><b>Description</b></td> </tr>
644
        <tr> <td colspan="4" align="center"> <b><i>Clocks, Resets & Debug</i></b>  </td></tr>
645
        <tr> <td> mclk           </td> <td>  Input         </td> <td>       1        </td> <td> Main system clock                          </td> </tr>
646
        <tr> <td> aclk_en        </td> <td>  Input         </td> <td>       1        </td> <td> ACLK enable (from CPU)                     </td> </tr>
647
        <tr> <td> smclk_en       </td> <td>  Input         </td> <td>       1        </td> <td> SMCLK enable (from CPU)                    </td> </tr>
648
        <tr> <td> inclk          </td> <td>  Input         </td> <td>       1        </td> <td> INCLK external timer clock (SLOW)          </td> </tr>
649
        <tr> <td> taclk          </td> <td>  Input         </td> <td>       1        </td> <td> TACLK external timer clock (SLOW)          </td> </tr>
650
        <tr> <td> puc            </td> <td>  Input         </td> <td>       1        </td> <td> Main system reset                          </td> </tr>
651
        <tr> <td> dbg_freeze     </td> <td>  Input         </td> <td>       1        </td> <td> Freeze Timer A counter                     </td> </tr>
652
        <tr> <td colspan="4" align="center"> <b><i>Interrupts</i></b>  </td></tr>
653
        <tr> <td> irq_ta0        </td> <td>  Output        </td> <td>       1        </td> <td> Timer A interrupt: TACCR0                  </td> </tr>
654
        <tr> <td> irq_ta1        </td> <td>  Output        </td> <td>       1        </td> <td> Timer A interrupt: TAIV, TACCR1, TACCR2    </td> </tr>
655
        <tr> <td> irq_ta0_acc    </td> <td>  Input         </td> <td>       1        </td> <td> Interrupt request TACCR0 accepted          </td> </tr>
656
        <tr> <td colspan="4" align="center"> <b><i>External Peripherals interface</i></b>  </td></tr>
657
        <tr> <td> per_addr       </td> <td>  Input         </td> <td>       8        </td> <td> Peripheral address                         </td> </tr>
658
        <tr> <td> per_din        </td> <td>  Input         </td> <td>      16        </td> <td> Peripheral data input                      </td> </tr>
659
        <tr> <td> per_dout       </td> <td>  Output        </td> <td>      16        </td> <td> Peripheral data output                     </td> </tr>
660
        <tr> <td> per_en         </td> <td>  Input         </td> <td>       1        </td> <td> Peripheral enable (high active)            </td> </tr>
661
        <tr> <td> per_wen        </td> <td>  Input         </td> <td>       2        </td> <td> Peripheral write enable (high active)      </td> </tr>
662
        <tr> <td colspan="4" align="center"> <b><i>Capture/Compare Unit 0</i></b>  </td></tr>
663
        <tr> <td> ta_cci0a       </td> <td>  Input         </td> <td>       1        </td> <td> Timer A capture 0 input A                  </td> </tr>
664
        <tr> <td> ta_cci0b       </td> <td>  Input         </td> <td>       1        </td> <td> Timer A capture 0 input B                  </td> </tr>
665
        <tr> <td> ta_out0        </td> <td>  Output        </td> <td>       1        </td> <td> Timer A output 0                           </td> </tr>
666
        <tr> <td> ta_out0_en     </td> <td>  Output        </td> <td>       1        </td> <td> Timer A output 0 enable                    </td> </tr>
667
        <tr> <td colspan="4" align="center"> <b><i>Capture/Compare Unit 1</i></b>  </td></tr>
668
        <tr> <td> ta_cci1a       </td> <td>  Input         </td> <td>       1        </td> <td> Timer A capture 1 input A                  </td> </tr>
669
        <tr> <td> ta_cci1b       </td> <td>  Input         </td> <td>       1        </td> <td> Timer A capture 1 input B                  </td> </tr>
670
        <tr> <td> ta_out1        </td> <td>  Output        </td> <td>       1        </td> <td> Timer A output 1                           </td> </tr>
671
        <tr> <td> ta_out1_en     </td> <td>  Output        </td> <td>       1        </td> <td> Timer A output 1 enable                    </td> </tr>
672
        <tr> <td colspan="4" align="center"> <b><i>Capture/Compare Unit 2</i></b>  </td></tr>
673
        <tr> <td> ta_cci2a       </td> <td>  Input         </td> <td>       1        </td> <td> Timer A capture 2 input A                  </td> </tr>
674
        <tr> <td> ta_cci2b       </td> <td>  Input         </td> <td>       1        </td> <td> Timer A capture 2 input B                  </td> </tr>
675
        <tr> <td> ta_out2        </td> <td>  Output        </td> <td>       1        </td> <td> Timer A output 2                           </td> </tr>
676
        <tr> <td> ta_out2_en     </td> <td>  Output        </td> <td>       1        </td> <td> Timer A output 2 enable                    </td> </tr>
677
</table>
678
<br />
679
<b>Note</b>: for the same reason as with the Basic Clock Module, the two additional clock inputs (TACLK and INCLK) are internally synchronized with the MCLK domain.
680
As a consequence, TACLK and INCLK should be at least 2 times slowlier than MCLK, and if these clock are used toghether with the Timer A output unit, some jitter might be observed on the generated output.
681
If this jitter is critical for the application, ACLK and INCLK should idealy be derivated from DCO_CLK.
682 69 olivier.gi
<br /><br />
683
<a name="2.2.5 16x16 Hardware Multiplier"></a>
684
<h3>2.2.5 16x16 Hardware Multiplier</h3>
685 50 olivier.gi
 
686 69 olivier.gi
100% of the features advertised in the <a href="http://www.ti.com/litv/pdf/slau049f">MSP430x1xx Family User's Guide</a> (Chapter 7) have been implemented.
687
<br /><br />
688
The following parameter in the <i>openMSP430_defines.v</i> file controls if the hardware multiplier should be included or not.
689
<br /><br />
690
<table border="0" cellspacing="4" cellpadding="0">
691
<tr>
692
<td width="35"></td>
693
<td bgcolor="#d0d0d0" width="3"></td>
694
<td width="15"></td>
695
<td>
696
        <code>
697
            // Include/Exclude Hardware Multiplier
698
                <br />`define MULTIPLIER
699
        </code>
700
</td>
701
</tr>
702
</table>
703
<br /><br />
704
 
705
<br /><br />
706 50 olivier.gi
</body>
707
</html>

powered by: WebSVN 2.1.0

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