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

Subversion Repositories openmsp430

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

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

Line No. Rev Author Line
1 157 olivier.gi
//----------------------------------------------------------------------------
2
// Copyright (C) 2011 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
// *File Name: openMSP430_fpga.v
26
// 
27
// *Module Description:
28
//                      openMSP430 FPGA Top-level for the Avnet LX9 Microboard
29
//
30
// *Author(s):
31
//              - Ricardo Ribalda,    ricardo.ribalda@gmail.com
32
//              - Olivier Girard,    olgirard@gmail.com
33
//
34
//----------------------------------------------------------------------------
35
`include "openmsp430/openMSP430_defines.v"
36
 
37
module openMSP430_fpga (
38
 
39
     //----------------------------------------------
40
     // User Reset Push Button
41
     //----------------------------------------------
42
     USER_RESET,
43
 
44
     //----------------------------------------------
45
     // Micron N25Q128 SPI Flash
46
     //   This is a Multi-I/O Flash.  Several pins
47
     //  have dual purposes depending on the mode.
48
     //----------------------------------------------
49
     SPI_SCK,
50
     SPI_CS_n,
51
     SPI_MOSI_MISO0,
52
     SPI_MISO_MISO1,
53
     SPI_Wn_MISO2,
54
     SPI_HOLDn_MISO3,
55
 
56
     //----------------------------------------------
57
     // TI CDCE913 Triple-Output PLL Clock Chip
58
     //   Y1: 40 MHz, USER_CLOCK can be used as
59
     //              external configuration clock
60
     //   Y2: 66.667 MHz
61
     //   Y3: 100 MHz 
62
     //----------------------------------------------
63
     USER_CLOCK,
64
     CLOCK_Y2,
65
     CLOCK_Y3,
66
 
67
     //----------------------------------------------
68
     // The following oscillator is not populated
69
     // in production but the footprint is compatible
70
     // with the Maxim DS1088LU                 
71
     //----------------------------------------------
72
     BACKUP_CLK,
73
 
74
     //----------------------------------------------
75
     // User DIP Switch x4
76
     //----------------------------------------------
77
     GPIO_DIP1,
78
     GPIO_DIP2,
79
     GPIO_DIP3,
80
     GPIO_DIP4,
81
 
82
     //----------------------------------------------
83
     // User LEDs                       
84
     //----------------------------------------------
85
     GPIO_LED1,
86
     GPIO_LED2,
87
     GPIO_LED3,
88
     GPIO_LED4,
89
 
90
     //----------------------------------------------
91
     // Silicon Labs CP2102 USB-to-UART Bridge Chip
92
     //----------------------------------------------
93
     USB_RS232_RXD,
94
     USB_RS232_TXD,
95
 
96
     //----------------------------------------------
97
     // Texas Instruments CDCE913 programming port
98
     //----------------------------------------------
99
     SCL,
100
     SDA,
101
 
102
     //----------------------------------------------
103
     // Micron MT46H32M16LFBF-5 LPDDR                   
104
     //----------------------------------------------
105
 
106
     // Addresses
107
     LPDDR_A0,
108
     LPDDR_A1,
109
     LPDDR_A2,
110
     LPDDR_A3,
111
     LPDDR_A4,
112
     LPDDR_A5,
113
     LPDDR_A6,
114
     LPDDR_A7,
115
     LPDDR_A8,
116
     LPDDR_A9,
117
     LPDDR_A10,
118
     LPDDR_A11,
119
     LPDDR_A12,
120
     LPDDR_BA0,
121
     LPDDR_BA1,
122
 
123
     // Data                                                                  
124
     LPDDR_DQ0,
125
     LPDDR_DQ1,
126
     LPDDR_DQ2,
127
     LPDDR_DQ3,
128
     LPDDR_DQ4,
129
     LPDDR_DQ5,
130
     LPDDR_DQ6,
131
     LPDDR_DQ7,
132
     LPDDR_DQ8,
133
     LPDDR_DQ9,
134
     LPDDR_DQ10,
135
     LPDDR_DQ11,
136
     LPDDR_DQ12,
137
     LPDDR_DQ13,
138
     LPDDR_DQ14,
139
     LPDDR_DQ15,
140
     LPDDR_LDM,
141
     LPDDR_UDM,
142
     LPDDR_LDQS,
143
     LPDDR_UDQS,
144
 
145
     // Clock
146
     LPDDR_CK_N,
147
     LPDDR_CK_P,
148
     LPDDR_CKE,
149
 
150
     // Control
151
     LPDDR_CAS_n,
152
     LPDDR_RAS_n,
153
     LPDDR_WE_n,
154
     LPDDR_RZQ,
155
 
156
     //----------------------------------------------
157
     // National Semiconductor DP83848J 10/100 Ethernet PHY                     
158
     //   Pull-ups on RXD are necessary to set the PHY AD to 11110b.
159
     //   Must keep the PHY from defaulting to PHY AD = 00000b      
160
     //   because this is Isolate Mode                              
161
     //----------------------------------------------
162
     ETH_COL,
163
     ETH_CRS,
164
     ETH_MDC,
165
     ETH_MDIO,
166
     ETH_RESET_n,
167
     ETH_RX_CLK,
168
     ETH_RX_D0,
169
     ETH_RX_D1,
170
     ETH_RX_D2,
171
     ETH_RX_D3,
172
     ETH_RX_DV,
173
     ETH_RX_ER,
174
     ETH_TX_CLK,
175
     ETH_TX_D0,
176
     ETH_TX_D1,
177
     ETH_TX_D2,
178
     ETH_TX_D3,
179
     ETH_TX_EN,
180
 
181
     //----------------------------------------------
182
     // Peripheral Modules (PMODs) and GPIO
183
     //     https://www.digilentinc.com/PMODs
184
     //----------------------------------------------
185
 
186
     // Connector J5
187
     PMOD1_P1,
188
     PMOD1_P2,
189
     PMOD1_P3,
190
     PMOD1_P4,
191
     PMOD1_P7,
192
     PMOD1_P8,
193
     PMOD1_P9,
194
     PMOD1_P10,
195
 
196
     // Connector J4
197
     PMOD2_P1,
198
     PMOD2_P2,
199
     PMOD2_P3,
200
     PMOD2_P4,
201
     PMOD2_P7,
202
     PMOD2_P8,
203
     PMOD2_P9,
204
     PMOD2_P10
205
);
206
 
207
//----------------------------------------------
208
// User Reset Push Button
209
//----------------------------------------------
210
input    USER_RESET;
211
 
212
//----------------------------------------------
213
// Micron N25Q128 SPI Flash
214
//   This is a Multi-I/O Flash.  Several pins
215
//  have dual purposes depending on the mode.
216
//----------------------------------------------
217
output   SPI_SCK;
218
output   SPI_CS_n;
219
inout    SPI_MOSI_MISO0;
220
inout    SPI_MISO_MISO1;
221
output   SPI_Wn_MISO2;
222
output   SPI_HOLDn_MISO3;
223
 
224
//----------------------------------------------
225
// TI CDCE913 Triple-Output PLL Clock Chip
226
//   Y1: 40 MHz; USER_CLOCK can be used as
227
//              external configuration clock
228
//   Y2: 66.667 MHz
229
//   Y3: 100 MHz 
230
//----------------------------------------------
231
input    USER_CLOCK;
232
input    CLOCK_Y2;
233
input    CLOCK_Y3;
234
 
235
//----------------------------------------------
236
// The following oscillator is not populated
237
// in production but the footprint is compatible
238
// with the Maxim DS1088LU                      
239
//----------------------------------------------
240
input    BACKUP_CLK;
241
 
242
//----------------------------------------------
243
// User DIP Switch x4
244
//----------------------------------------------
245
input    GPIO_DIP1;
246
input    GPIO_DIP2;
247
input    GPIO_DIP3;
248
input    GPIO_DIP4;
249
 
250
//----------------------------------------------
251
// User LEDs                    
252
//----------------------------------------------
253
output   GPIO_LED1;
254
output   GPIO_LED2;
255
output   GPIO_LED3;
256
output   GPIO_LED4;
257
 
258
//----------------------------------------------
259
// Silicon Labs CP2102 USB-to-UART Bridge Chip
260
//----------------------------------------------
261
input    USB_RS232_RXD;
262
output   USB_RS232_TXD;
263
 
264
//----------------------------------------------
265
// Texas Instruments CDCE913 programming port
266
//----------------------------------------------
267
output   SCL;
268
inout    SDA;
269
 
270
//----------------------------------------------
271
// Micron MT46H32M16LFBF-5 LPDDR                        
272
//----------------------------------------------
273
 
274
// Addresses
275
output   LPDDR_A0;
276
output   LPDDR_A1;
277
output   LPDDR_A2;
278
output   LPDDR_A3;
279
output   LPDDR_A4;
280
output   LPDDR_A5;
281
output   LPDDR_A6;
282
output   LPDDR_A7;
283
output   LPDDR_A8;
284
output   LPDDR_A9;
285
output   LPDDR_A10;
286
output   LPDDR_A11;
287
output   LPDDR_A12;
288
output   LPDDR_BA0;
289
output   LPDDR_BA1;
290
 
291
// Data                                                                  
292
inout    LPDDR_DQ0;
293
inout    LPDDR_DQ1;
294
inout    LPDDR_DQ2;
295
inout    LPDDR_DQ3;
296
inout    LPDDR_DQ4;
297
inout    LPDDR_DQ5;
298
inout    LPDDR_DQ6;
299
inout    LPDDR_DQ7;
300
inout    LPDDR_DQ8;
301
inout    LPDDR_DQ9;
302
inout    LPDDR_DQ10;
303
inout    LPDDR_DQ11;
304
inout    LPDDR_DQ12;
305
inout    LPDDR_DQ13;
306
inout    LPDDR_DQ14;
307
inout    LPDDR_DQ15;
308
output   LPDDR_LDM;
309
output   LPDDR_UDM;
310
inout    LPDDR_LDQS;
311
inout    LPDDR_UDQS;
312
 
313
// Clock
314
output   LPDDR_CK_N;
315
output   LPDDR_CK_P;
316
output   LPDDR_CKE;
317
 
318
// Control
319
output   LPDDR_CAS_n;
320
output   LPDDR_RAS_n;
321
output   LPDDR_WE_n;
322
inout    LPDDR_RZQ;
323
 
324
//----------------------------------------------
325
// National Semiconductor DP83848J 10/100 Ethernet PHY                  
326
//   Pull-ups on RXD are necessary to set the PHY AD to 11110b.
327
//   Must keep the PHY from defaulting to PHY AD = 00000b      
328
//   because this is Isolate Mode                              
329
//----------------------------------------------
330
input    ETH_COL;
331
input    ETH_CRS;
332
output   ETH_MDC;
333
inout    ETH_MDIO;
334
output   ETH_RESET_n;
335
input    ETH_RX_CLK;
336
input    ETH_RX_D0;
337
input    ETH_RX_D1;
338
input    ETH_RX_D2;
339
input    ETH_RX_D3;
340
input    ETH_RX_DV;
341
input    ETH_RX_ER;
342
input    ETH_TX_CLK;
343
output   ETH_TX_D0;
344
output   ETH_TX_D1;
345
output   ETH_TX_D2;
346
output   ETH_TX_D3;
347
output   ETH_TX_EN;
348
 
349
//----------------------------------------------
350
// Peripheral Modules (PMODs) and GPIO
351
//     https://www.digilentinc.com/PMODs
352
//----------------------------------------------
353
 
354
// Connector J5
355
inout    PMOD1_P1;
356
inout    PMOD1_P2;
357
inout    PMOD1_P3;
358
input    PMOD1_P4;
359
inout    PMOD1_P7;
360
inout    PMOD1_P8;
361
inout    PMOD1_P9;
362
inout    PMOD1_P10;
363
 
364
// Connector J4
365
inout    PMOD2_P1;
366
inout    PMOD2_P2;
367
inout    PMOD2_P3;
368
inout    PMOD2_P4;
369
inout    PMOD2_P7;
370
inout    PMOD2_P8;
371
inout    PMOD2_P9;
372
inout    PMOD2_P10;
373
 
374
 
375
//=============================================================================
376
// 1)  INTERNAL WIRES/REGISTERS/PARAMETERS DECLARATION
377
//=============================================================================
378
 
379
// Clock generation
380
wire               clk_40mhz;
381
wire               dcm_locked;
382
wire               dcm_clkfx;
383
wire               dcm_clk0;
384
wire               dcm_clkfb;
385
wire               dco_clk;
386
 
387
// Reset generation
388
wire               reset_pin;
389
wire               reset_pin_n;
390
wire               reset_n;
391
 
392
// Debug interface
393 167 olivier.gi
wire               omsp_dbg_i2c_scl;
394
wire               omsp_dbg_i2c_sda_in;
395
wire               omsp_dbg_i2c_sda_out;
396 157 olivier.gi
wire               omsp0_dbg_i2c_sda_out;
397 167 olivier.gi
wire               omsp1_dbg_i2c_sda_out;
398 157 olivier.gi
wire        [23:0] chipscope_trigger;
399
 
400
// Data memory
401
wire [`DMEM_MSB:0] omsp0_dmem_addr;
402
wire               omsp0_dmem_cen;
403 167 olivier.gi
wire               omsp0_dmem_cen_sp;
404
wire               omsp0_dmem_cen_dp;
405 157 olivier.gi
wire        [15:0] omsp0_dmem_din;
406
wire         [1:0] omsp0_dmem_wen;
407
wire        [15:0] omsp0_dmem_dout;
408 167 olivier.gi
wire        [15:0] omsp0_dmem_dout_sp;
409
wire        [15:0] omsp0_dmem_dout_dp;
410
reg                omsp0_dmem_dout_sel;
411 157 olivier.gi
 
412 167 olivier.gi
wire [`DMEM_MSB:0] omsp1_dmem_addr;
413
wire               omsp1_dmem_cen;
414
wire               omsp1_dmem_cen_sp;
415
wire               omsp1_dmem_cen_dp;
416
wire        [15:0] omsp1_dmem_din;
417
wire         [1:0] omsp1_dmem_wen;
418
wire        [15:0] omsp1_dmem_dout;
419
wire        [15:0] omsp1_dmem_dout_sp;
420
wire        [15:0] omsp1_dmem_dout_dp;
421
reg                omsp1_dmem_dout_sel;
422
 
423 157 olivier.gi
// Program memory
424
wire [`PMEM_MSB:0] omsp0_pmem_addr;
425
wire               omsp0_pmem_cen;
426
wire        [15:0] omsp0_pmem_din;
427
wire         [1:0] omsp0_pmem_wen;
428
wire        [15:0] omsp0_pmem_dout;
429
 
430 167 olivier.gi
wire [`PMEM_MSB:0] omsp1_pmem_addr;
431
wire               omsp1_pmem_cen;
432
wire        [15:0] omsp1_pmem_din;
433
wire         [1:0] omsp1_pmem_wen;
434
wire        [15:0] omsp1_pmem_dout;
435
 
436 157 olivier.gi
// UART
437
wire               omsp0_uart_rxd;
438
wire               omsp0_uart_txd;
439
 
440
// LEDs & Switches
441 167 olivier.gi
wire         [3:0] omsp_switch;
442
wire         [1:0] omsp0_led;
443
wire         [1:0] omsp1_led;
444 157 olivier.gi
 
445
 
446
//=============================================================================
447
// 2)  RESET GENERATION & FPGA STARTUP
448
//=============================================================================
449
 
450
// Reset input buffer
451
IBUF   ibuf_reset_n   (.O(reset_pin), .I(USER_RESET));
452
assign reset_pin_n = ~reset_pin;
453
 
454
// Release the reset only, if the DCM is locked
455
assign  reset_n = reset_pin_n & dcm_locked;
456
 
457
// Top level reset generation
458
wire dco_rst;
459
omsp_sync_reset sync_reset_dco (.rst_s (dco_rst), .clk(dco_clk), .rst_a(!reset_n));
460
 
461
 
462
//=============================================================================
463
// 3)  CLOCK GENERATION
464
//=============================================================================
465
 
466
// Input buffers
467
//------------------------
468
IBUFG ibuf_clk_main   (.O(clk_40mhz),    .I(USER_CLOCK));
469
IBUFG ibuf_clk_y2     (.O(),             .I(CLOCK_Y2));
470
IBUFG ibuf_clk_y3     (.O(),             .I(CLOCK_Y3));
471
IBUFG ibuf_clk_bkup   (.O(),             .I(BACKUP_CLK));
472
 
473
 
474
// Digital Clock Manager
475
//------------------------
476
DCM_SP #(.CLKFX_MULTIPLY(7),
477
         .CLKFX_DIVIDE(10),
478
         .CLKIN_PERIOD(25.000)) dcm_inst (
479
 
480
// OUTPUTs
481
    .CLKFX        (dcm_clkfx),
482
    .CLK0         (dcm_clk0),
483
    .LOCKED       (dcm_locked),
484
 
485
// INPUTs
486
    .CLKFB        (dcm_clkfb),
487
    .CLKIN        (clk_40mhz),
488
    .PSEN         (1'b0),
489
    .RST          (reset_pin)
490
);
491
 
492
BUFG CLK0_BUFG_INST (
493
    .I(dcm_clk0),
494
    .O(dcm_clkfb)
495
);
496
 
497
//synthesis translate_off
498
defparam dcm_inst.CLKFX_MULTIPLY  = 7;
499
defparam dcm_inst.CLKFX_DIVIDE    = 10;
500
defparam dcm_inst.CLKIN_PERIOD    = 25.000;
501
//synthesis translate_on
502
 
503
// Clock buffers
504
//------------------------
505
BUFG  buf_sys_clock  (.O(dco_clk), .I(dcm_clkfx));
506
 
507
 
508
//=============================================================================
509
// 4)  OPENMSP430 SYSTEM 0
510
//=============================================================================
511
 
512
omsp_system_0 omsp_system_0_inst (
513
 
514
// Clock & Reset
515
    .dco_clk           (dco_clk),                     // Fast oscillator (fast clock)
516
    .reset_n           (reset_n),                     // Reset Pin (low active, asynchronous and non-glitchy)
517
 
518
// Serial Debug Interface (I2C)
519 167 olivier.gi
    .dbg_i2c_addr      (7'd50),                       // Debug interface: I2C Address
520
    .dbg_i2c_broadcast (7'd49),                       // Debug interface: I2C Broadcast Address (for multicore systems)
521
    .dbg_i2c_scl       (omsp_dbg_i2c_scl),            // Debug interface: I2C SCL
522
    .dbg_i2c_sda_in    (omsp_dbg_i2c_sda_in),         // Debug interface: I2C SDA IN
523 157 olivier.gi
    .dbg_i2c_sda_out   (omsp0_dbg_i2c_sda_out),       // Debug interface: I2C SDA OUT
524
 
525
// Data Memory
526
    .dmem_addr         (omsp0_dmem_addr),             // Data Memory address
527
    .dmem_cen          (omsp0_dmem_cen),              // Data Memory chip enable (low active)
528
    .dmem_din          (omsp0_dmem_din),              // Data Memory data input
529
    .dmem_wen          (omsp0_dmem_wen),              // Data Memory write enable (low active)
530
    .dmem_dout         (omsp0_dmem_dout),             // Data Memory data output
531
 
532
// Program Memory
533
    .pmem_addr         (omsp0_pmem_addr),             // Program Memory address
534
    .pmem_cen          (omsp0_pmem_cen),              // Program Memory chip enable (low active)
535
    .pmem_din          (omsp0_pmem_din),              // Program Memory data input (optional)
536
    .pmem_wen          (omsp0_pmem_wen),              // Program Memory write enable (low active) (optional)
537
    .pmem_dout         (omsp0_pmem_dout),             // Program Memory data output
538
 
539
// UART
540
    .uart_rxd          (omsp0_uart_rxd),              // UART Data Receive (RXD)
541
    .uart_txd          (omsp0_uart_txd),              // UART Data Transmit (TXD)
542
 
543
// Switches & LEDs
544 167 olivier.gi
    .switch            (omsp_switch),                 // Input switches
545 157 olivier.gi
    .led               (omsp0_led)                    // LEDs
546
);
547
 
548
 
549
//=============================================================================
550 167 olivier.gi
// 5)  OPENMSP430 SYSTEM 1
551
//=============================================================================
552
 
553
omsp_system_1 omsp_system_1_inst (
554
 
555
// Clock & Reset
556
    .dco_clk           (dco_clk),                     // Fast oscillator (fast clock)
557
    .reset_n           (reset_n),                     // Reset Pin (low active, asynchronous and non-glitchy)
558
 
559
// Serial Debug Interface (I2C)
560
    .dbg_i2c_addr      (7'd51),                       // Debug interface: I2C Address
561
    .dbg_i2c_broadcast (7'd49),                       // Debug interface: I2C Broadcast Address (for multicore systems)
562
    .dbg_i2c_scl       (omsp_dbg_i2c_scl),            // Debug interface: I2C SCL
563
    .dbg_i2c_sda_in    (omsp_dbg_i2c_sda_in),         // Debug interface: I2C SDA IN
564
    .dbg_i2c_sda_out   (omsp1_dbg_i2c_sda_out),       // Debug interface: I2C SDA OUT
565
 
566
// Data Memory
567
    .dmem_addr         (omsp1_dmem_addr),             // Data Memory address
568
    .dmem_cen          (omsp1_dmem_cen),              // Data Memory chip enable (low active)
569
    .dmem_din          (omsp1_dmem_din),              // Data Memory data input
570
    .dmem_wen          (omsp1_dmem_wen),              // Data Memory write enable (low active)
571
    .dmem_dout         (omsp1_dmem_dout),             // Data Memory data output
572
 
573
// Program Memory
574
    .pmem_addr         (omsp1_pmem_addr),             // Program Memory address
575
    .pmem_cen          (omsp1_pmem_cen),              // Program Memory chip enable (low active)
576
    .pmem_din          (omsp1_pmem_din),              // Program Memory data input (optional)
577
    .pmem_wen          (omsp1_pmem_wen),              // Program Memory write enable (low active) (optional)
578
    .pmem_dout         (omsp1_pmem_dout),             // Program Memory data output
579
 
580
// Switches & LEDs
581
    .switch            (omsp_switch),                 // Input switches
582
    .led               (omsp1_led)                    // LEDs
583
);
584
 
585
 
586
//=============================================================================
587 157 olivier.gi
// 6)  PROGRAM AND DATA MEMORIES
588
//=============================================================================
589
 
590 167 olivier.gi
// Memory muxing (CPU 0)
591
assign omsp0_dmem_cen_sp =  omsp0_dmem_addr[`DMEM_MSB] | omsp0_dmem_cen;
592
assign omsp0_dmem_cen_dp = ~omsp0_dmem_addr[`DMEM_MSB] | omsp0_dmem_cen;
593
assign omsp0_dmem_dout   =  omsp0_dmem_dout_sel ? omsp0_dmem_dout_sp : omsp0_dmem_dout_dp;
594
 
595
always @ (posedge dco_clk or posedge dco_rst)
596
  if (dco_rst)                  omsp0_dmem_dout_sel <=  1'b1;
597
  else if (~omsp0_dmem_cen_sp)  omsp0_dmem_dout_sel <=  1'b1;
598
  else if (~omsp0_dmem_cen_dp)  omsp0_dmem_dout_sel <=  1'b0;
599
 
600
// Memory muxing (CPU 1)
601
assign omsp1_dmem_cen_sp =  omsp1_dmem_addr[`DMEM_MSB] | omsp1_dmem_cen;
602
assign omsp1_dmem_cen_dp = ~omsp1_dmem_addr[`DMEM_MSB] | omsp1_dmem_cen;
603
assign omsp1_dmem_dout   =  omsp1_dmem_dout_sel ? omsp1_dmem_dout_sp : omsp1_dmem_dout_dp;
604
 
605
always @ (posedge dco_clk or posedge dco_rst)
606
  if (dco_rst)                  omsp1_dmem_dout_sel <=  1'b1;
607
  else if (~omsp1_dmem_cen_sp)  omsp1_dmem_dout_sel <=  1'b1;
608
  else if (~omsp1_dmem_cen_dp)  omsp1_dmem_dout_sel <=  1'b0;
609
 
610
// Data Memory (CPU 0)
611
ram_16x1k_sp ram_16x1k_sp_dmem_omsp0 (
612 157 olivier.gi
    .clka           ( dco_clk),
613 167 olivier.gi
    .ena            (~omsp0_dmem_cen_sp),
614 157 olivier.gi
    .wea            (~omsp0_dmem_wen),
615 167 olivier.gi
    .addra          ( omsp0_dmem_addr[`DMEM_MSB-1:0]),
616 157 olivier.gi
    .dina           ( omsp0_dmem_din),
617 167 olivier.gi
    .douta          ( omsp0_dmem_dout_sp)
618 157 olivier.gi
);
619
 
620 167 olivier.gi
// Data Memory (CPU 1)
621
ram_16x1k_sp ram_16x1k_sp_dmem_omsp1 (
622
    .clka           ( dco_clk),
623
    .ena            (~omsp1_dmem_cen_sp),
624
    .wea            (~omsp1_dmem_wen),
625
    .addra          ( omsp1_dmem_addr[`DMEM_MSB-1:0]),
626
    .dina           ( omsp1_dmem_din),
627
    .douta          ( omsp1_dmem_dout_sp)
628
);
629 157 olivier.gi
 
630 167 olivier.gi
// Shared Data Memory
631
ram_16x1k_dp ram_16x1k_dp_dmem_shared (
632 157 olivier.gi
    .clka           ( dco_clk),
633 167 olivier.gi
    .ena            (~omsp0_dmem_cen_dp),
634
    .wea            (~omsp0_dmem_wen),
635
    .addra          ( omsp0_dmem_addr[`DMEM_MSB-1:0]),
636
    .dina           ( omsp0_dmem_din),
637
    .douta          ( omsp0_dmem_dout_dp),
638
    .clkb           ( dco_clk),
639
    .enb            (~omsp1_dmem_cen_dp),
640
    .web            (~omsp1_dmem_wen),
641
    .addrb          ( omsp1_dmem_addr[`DMEM_MSB-1:0]),
642
    .dinb           ( omsp1_dmem_din),
643
    .doutb          ( omsp1_dmem_dout_dp)
644
);
645
 
646
// Shared Program Memory
647
ram_16x8k_dp ram_16x8k_dp_pmem_shared (
648
    .clka           ( dco_clk),
649 157 olivier.gi
    .ena            (~omsp0_pmem_cen),
650
    .wea            (~omsp0_pmem_wen),
651
    .addra          ( omsp0_pmem_addr),
652
    .dina           ( omsp0_pmem_din),
653 167 olivier.gi
    .douta          ( omsp0_pmem_dout),
654
    .clkb           ( dco_clk),
655
    .enb            (~omsp1_pmem_cen),
656
    .web            (~omsp1_pmem_wen),
657
    .addrb          ( omsp1_pmem_addr),
658
    .dinb           ( omsp1_pmem_din),
659
    .doutb          ( omsp1_pmem_dout)
660 157 olivier.gi
);
661
 
662
 
663
//=============================================================================
664
// 7)  I/O CELLS
665
//=============================================================================
666
 
667
//----------------------------------------------
668
// Micron N25Q128 SPI Flash
669
//   This is a Multi-I/O Flash.  Several pins
670
//  have dual purposes depending on the mode.
671
//----------------------------------------------
672
OBUF  SPI_CLK_PIN        (.I(1'b0),                  .O(SPI_SCK));
673
OBUF  SPI_CSN_PIN        (.I(1'b1),                  .O(SPI_CS_n));
674
IOBUF SPI_MOSI_MISO0_PIN (.T(1'b0), .I(1'b0), .O(),  .IO(SPI_MOSI_MISO0));
675
IOBUF SPI_MISO_MISO1_PIN (.T(1'b0), .I(1'b0), .O(),  .IO(SPI_MISO_MISO1));
676
OBUF  SPI_WN_PIN         (.I(1'b1),                  .O(SPI_Wn_MISO2));
677
OBUF  SPI_HOLD_PIN       (.I(1'b1),                  .O(SPI_HOLDn_MISO3));
678
 
679
//----------------------------------------------
680
// User DIP Switch x4
681
//----------------------------------------------
682 167 olivier.gi
IBUF  SW3_PIN            (.O(omsp_switch[3]),        .I(GPIO_DIP4));
683
IBUF  SW2_PIN            (.O(omsp_switch[2]),        .I(GPIO_DIP3));
684
IBUF  SW1_PIN            (.O(omsp_switch[1]),        .I(GPIO_DIP2));
685
IBUF  SW0_PIN            (.O(omsp_switch[0]),        .I(GPIO_DIP1));
686 157 olivier.gi
 
687
//----------------------------------------------
688
// User LEDs                    
689
//----------------------------------------------
690 167 olivier.gi
OBUF  LED3_PIN           (.I(omsp1_led[1]),          .O(GPIO_LED4));
691
OBUF  LED2_PIN           (.I(omsp1_led[0]),          .O(GPIO_LED3));
692 157 olivier.gi
OBUF  LED1_PIN           (.I(omsp0_led[1]),          .O(GPIO_LED2));
693
OBUF  LED0_PIN           (.I(omsp0_led[0]),          .O(GPIO_LED1));
694
 
695
//----------------------------------------------
696
// Silicon Labs CP2102 USB-to-UART Bridge Chip
697
//----------------------------------------------
698
IBUF  UART_RXD_PIN       (.O(omsp0_uart_rxd),        .I(USB_RS232_RXD));
699
OBUF  UART_TXD_PIN       (.I(omsp0_uart_txd),        .O(USB_RS232_TXD));
700
 
701
//----------------------------------------------
702
// Texas Instruments CDCE913 programming port
703
//----------------------------------------------
704
IOBUF SCL_PIN            (.T(1'b0), .I(1'b1), .O(),  .IO(SCL));
705
IOBUF SDA_PIN            (.T(1'b0), .I(1'b1), .O(),  .IO(SDA));
706
 
707
//----------------------------------------------
708
// Micron MT46H32M16LFBF-5 LPDDR                        
709
//----------------------------------------------
710
 
711
// Addresses
712
OBUF  LPDDR_A0_PIN       (.I(1'b0),                  .O(LPDDR_A0));
713
OBUF  LPDDR_A1_PIN       (.I(1'b0),                  .O(LPDDR_A1));
714
OBUF  LPDDR_A2_PIN       (.I(1'b0),                  .O(LPDDR_A2));
715
OBUF  LPDDR_A3_PIN       (.I(1'b0),                  .O(LPDDR_A3));
716
OBUF  LPDDR_A4_PIN       (.I(1'b0),                  .O(LPDDR_A4));
717
OBUF  LPDDR_A5_PIN       (.I(1'b0),                  .O(LPDDR_A5));
718
OBUF  LPDDR_A6_PIN       (.I(1'b0),                  .O(LPDDR_A6));
719
OBUF  LPDDR_A7_PIN       (.I(1'b0),                  .O(LPDDR_A7));
720
OBUF  LPDDR_A8_PIN       (.I(1'b0),                  .O(LPDDR_A8));
721
OBUF  LPDDR_A9_PIN       (.I(1'b0),                  .O(LPDDR_A9));
722
OBUF  LPDDR_A10_PIN      (.I(1'b0),                  .O(LPDDR_A10));
723
OBUF  LPDDR_A11_PIN      (.I(1'b0),                  .O(LPDDR_A11));
724
OBUF  LPDDR_A12_PIN      (.I(1'b0),                  .O(LPDDR_A12));
725
OBUF  LPDDR_BA0_PIN      (.I(1'b0),                  .O(LPDDR_BA0));
726
OBUF  LPDDR_BA1_PIN      (.I(1'b0),                  .O(LPDDR_BA1));
727
 
728
// Data                                                                  
729
IOBUF LPDDR_DQ0_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ0));
730
IOBUF LPDDR_DQ1_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ1));
731
IOBUF LPDDR_DQ2_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ2));
732
IOBUF LPDDR_DQ3_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ3));
733
IOBUF LPDDR_DQ4_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ4));
734
IOBUF LPDDR_DQ5_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ5));
735
IOBUF LPDDR_DQ6_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ6));
736
IOBUF LPDDR_DQ7_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ7));
737
IOBUF LPDDR_DQ8_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ8));
738
IOBUF LPDDR_DQ9_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ9));
739
IOBUF LPDDR_DQ10_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ10));
740
IOBUF LPDDR_DQ11_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ11));
741
IOBUF LPDDR_DQ12_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ12));
742
IOBUF LPDDR_DQ13_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ13));
743
IOBUF LPDDR_DQ14_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ14));
744
IOBUF LPDDR_DQ15_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_DQ15));
745
OBUF  LPDDR_LDM_PIN      (.I(1'b0),                  .O(LPDDR_LDM));
746
OBUF  LPDDR_UDM_PIN      (.I(1'b0),                  .O(LPDDR_UDM));
747
IOBUF LPDDR_LDQS_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_LDQS));
748
IOBUF LPDDR_UDQS_PIN     (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_UDQS));
749
 
750
// Clock
751
IOBUF LPDDR_CK_N_PIN     (.T(1'b1), .I(1'b0), .O(),  .IO(LPDDR_CK_N));
752
IOBUF LPDDR_CK_P_PIN     (.T(1'b1), .I(1'b1), .O(),  .IO(LPDDR_CK_P));
753
OBUF  LPDDR_CKE_PIN      (.I(1'b0),                  .O(LPDDR_CKE));
754
 
755
// Control
756
OBUF  LPDDR_CAS_N_PIN    (.I(1'b1),                  .O(LPDDR_CAS_n));
757
OBUF  LPDDR_RAS_N_PIN    (.I(1'b1),                  .O(LPDDR_RAS_n));
758
OBUF  LPDDR_WE_N_PIN     (.I(1'b1),                  .O(LPDDR_WE_n));
759
IOBUF LPDDR_RZQ_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(LPDDR_RZQ));
760
 
761
 
762
//----------------------------------------------
763
// National Semiconductor DP83848J 10/100 Ethernet PHY                  
764
//   Pull-ups on RXD are necessary to set the PHY AD to 11110b.
765
//   Must keep the PHY from defaulting to PHY AD = 00000b      
766
//   because this is Isolate Mode                              
767
//----------------------------------------------
768
IBUF  ETH_COL_PIN        (.O(),                      .I(ETH_COL));
769
IBUF  ETH_CRS_PIN        (.O(),                      .I(ETH_CRS));
770
OBUF  ETH_MDC_PIN        (.I(1'b0),                  .O(ETH_MDC));
771
IOBUF ETH_MDIO_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(ETH_MDIO));
772
OBUF  ETH_RESET_N_PIN    (.I(1'b1),                  .O(ETH_RESET_n));
773
IBUF  ETH_RX_CLK_PIN     (.O(),                      .I(ETH_RX_CLK));
774
IBUF  ETH_RX_D0_PIN      (.O(),                      .I(ETH_RX_D0));
775
IBUF  ETH_RX_D1_PIN      (.O(),                      .I(ETH_RX_D1));
776
IBUF  ETH_RX_D2_PIN      (.O(),                      .I(ETH_RX_D2));
777
IBUF  ETH_RX_D3_PIN      (.O(),                      .I(ETH_RX_D3));
778
IBUF  ETH_RX_DV_PIN      (.O(),                      .I(ETH_RX_DV));
779
IBUF  ETH_RX_ER_PIN      (.O(),                      .I(ETH_RX_ER));
780
IBUF  ETH_TX_CLK_PIN     (.O(),                      .I(ETH_TX_CLK));
781
OBUF  ETH_TX_D0_PIN      (.I(1'b0),                  .O(ETH_TX_D0));
782
OBUF  ETH_TX_D1_PIN      (.I(1'b0),                  .O(ETH_TX_D1));
783
OBUF  ETH_TX_D2_PIN      (.I(1'b0),                  .O(ETH_TX_D2));
784
OBUF  ETH_TX_D3_PIN      (.I(1'b0),                  .O(ETH_TX_D3));
785
OBUF  ETH_TX_EN_PIN      (.I(1'b0),                  .O(ETH_TX_EN));
786
 
787
//----------------------------------------------
788
// Peripheral Modules (PMODs) and GPIO
789
//     https://www.digilentinc.com/PMODs
790
//----------------------------------------------
791
 
792 167 olivier.gi
assign omsp_dbg_i2c_sda_out = omsp0_dbg_i2c_sda_out & omsp1_dbg_i2c_sda_out;
793
 
794 157 olivier.gi
// Connector J5
795
IOBUF PMOD1_P1_PIN       (.T(1'b0),                  .I(1'b0), .O(),                     .IO(PMOD1_P1));
796
IOBUF PMOD1_P2_PIN       (.T(1'b0),                  .I(1'b0), .O(),                     .IO(PMOD1_P2));
797 167 olivier.gi
IOBUF PMOD1_P3_PIN       (.T(omsp_dbg_i2c_sda_out),  .I(1'b0), .O(omsp_dbg_i2c_sda_in),  .IO(PMOD1_P3));
798
IBUF  PMOD1_P4_PIN       (                                     .O(omsp_dbg_i2c_scl),     .I (PMOD1_P4));
799 157 olivier.gi
IOBUF PMOD1_P7_PIN       (.T(1'b0),                  .I(1'b0), .O(),                     .IO(PMOD1_P7));
800
IBUF  PMOD1_P8_PIN       (                                     .O(),                     .I (PMOD1_P8));
801
IOBUF PMOD1_P9_PIN       (.T(1'b0),                  .I(1'b0), .O(),                     .IO(PMOD1_P9));
802
IOBUF PMOD1_P10_PIN      (.T(1'b0),                  .I(1'b0), .O(),                     .IO(PMOD1_P10));
803
 
804
// Connector J4
805
IOBUF PMOD2_P1_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P1));
806
IOBUF PMOD2_P2_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P2));
807
IOBUF PMOD2_P3_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P3));
808
IOBUF PMOD2_P4_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P4));
809
IOBUF PMOD2_P7_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P7));
810
IOBUF PMOD2_P8_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P8));
811
IOBUF PMOD2_P9_PIN       (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P9));
812
IOBUF PMOD2_P10_PIN      (.T(1'b0), .I(1'b0), .O(),  .IO(PMOD2_P10));
813
 
814
 
815
//=============================================================================
816
//8)  CHIPSCOPE
817
//=============================================================================
818
//`define WITH_CHIPSCOPE
819
`ifdef WITH_CHIPSCOPE
820
 
821
// Sampling clock
822
reg [7:0] div_cnt;
823
always @ (posedge dco_clk or posedge dco_rst)
824
  if (dco_rst)           div_cnt <=  8'h00;
825
  else if (div_cnt > 10) div_cnt <=  8'h00;
826
  else                   div_cnt <=  div_cnt+8'h01;
827
 
828
reg clk_sample;
829
always @ (posedge dco_clk or posedge dco_rst)
830
  if (dco_rst) clk_sample <=  1'b0;
831
  else         clk_sample <=  (div_cnt==8'h00);
832
 
833
 
834
// ChipScope instance
835
wire        [35:0] chipscope_control;
836
chipscope_ila chipscope_ila (
837
    .CONTROL  (chipscope_control),
838
    .CLK      (clk_sample),
839
    .TRIG0    (chipscope_trigger)
840
);
841
 
842
chipscope_icon chipscope_icon (
843
    .CONTROL0 (chipscope_control)
844
);
845
 
846
 
847
assign chipscope_trigger[0]     = 1'b0;
848 167 olivier.gi
assign chipscope_trigger[1]     = 1'b0;
849
assign chipscope_trigger[2]     = 1'b0;
850 157 olivier.gi
assign chipscope_trigger[23:3]  = 21'h00_0000;
851
`endif
852
 
853
endmodule // openMSP430_fpga
854
 

powered by: WebSVN 2.1.0

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