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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [xilinx_avnet_lx9microbard/] [rtl/] [verilog/] [omsp_system_0.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 167 olivier.gi
// *File Name: omsp_system_1.v
26 157 olivier.gi
// 
27
// *Module Description:
28 167 olivier.gi
//                      openMSP430 System 0.
29
//                      This core is dedicated to communication and
30
//                      display (i.e. UART, LEDs and 7-segment modport)
31
//                      It can also read the switches value.
32 157 olivier.gi
//
33
// *Author(s):
34
//              - Olivier Girard,    olgirard@gmail.com
35
//
36
//----------------------------------------------------------------------------
37
`include "openmsp430/openMSP430_defines.v"
38
 
39
module omsp_system_0 (
40
 
41
// Clock & Reset
42
    dco_clk,                               // Fast oscillator (fast clock)
43
    reset_n,                               // Reset Pin (low active, asynchronous and non-glitchy)
44
 
45
// Serial Debug Interface (I2C)
46
    dbg_i2c_addr,                          // Debug interface: I2C Address
47
    dbg_i2c_broadcast,                     // Debug interface: I2C Broadcast Address (for multicore systems)
48
    dbg_i2c_scl,                           // Debug interface: I2C SCL
49
    dbg_i2c_sda_in,                        // Debug interface: I2C SDA IN
50
    dbg_i2c_sda_out,                       // Debug interface: I2C SDA OUT
51
 
52
// Data Memory
53
    dmem_addr,                             // Data Memory address
54
    dmem_cen,                              // Data Memory chip enable (low active)
55
    dmem_din,                              // Data Memory data input
56
    dmem_wen,                              // Data Memory write enable (low active)
57
    dmem_dout,                             // Data Memory data output
58
 
59
// Program Memory
60
    pmem_addr,                             // Program Memory address
61
    pmem_cen,                              // Program Memory chip enable (low active)
62
    pmem_din,                              // Program Memory data input (optional)
63
    pmem_wen,                              // Program Memory write enable (low active) (optional)
64
    pmem_dout,                             // Program Memory data output
65
 
66
// UART
67
    uart_rxd,                              // UART Data Receive (RXD)
68
    uart_txd,                              // UART Data Transmit (TXD)
69
 
70
// Switches & LEDs
71
    switch,                                // Input switches
72
    led                                    // LEDs
73
);
74
 
75
// Clock & Reset
76
input                dco_clk;              // Fast oscillator (fast clock)
77
input                reset_n;              // Reset Pin (low active, asynchronous and non-glitchy)
78
 
79
// Serial Debug Interface (I2C)
80
input          [6:0] dbg_i2c_addr;         // Debug interface: I2C Address
81
input          [6:0] dbg_i2c_broadcast;    // Debug interface: I2C Broadcast Address (for multicore systems)
82
input                dbg_i2c_scl;          // Debug interface: I2C SCL
83
input                dbg_i2c_sda_in;       // Debug interface: I2C SDA IN
84
output               dbg_i2c_sda_out;      // Debug interface: I2C SDA OUT
85
 
86
// Data Memory
87
input         [15:0] dmem_dout;            // Data Memory data output
88
output [`DMEM_MSB:0] dmem_addr;            // Data Memory address
89
output               dmem_cen;             // Data Memory chip enable (low active)
90
output        [15:0] dmem_din;             // Data Memory data input
91
output         [1:0] dmem_wen;             // Data Memory write enable (low active)
92
 
93
// Program Memory
94
input         [15:0] pmem_dout;            // Program Memory data output
95
output [`PMEM_MSB:0] pmem_addr;            // Program Memory address
96
output               pmem_cen;             // Program Memory chip enable (low active)
97
output        [15:0] pmem_din;             // Program Memory data input (optional)
98
output         [1:0] pmem_wen;             // Program Memory write enable (low active) (optional)
99
 
100
// UART
101
input                uart_rxd;             // UART Data Receive (RXD)
102
output               uart_txd;             // UART Data Transmit (TXD)
103
 
104
// Switches & LEDs
105
input          [3:0] switch;               // Input switches
106 167 olivier.gi
output         [1:0] led;                  // LEDs
107 157 olivier.gi
 
108
 
109
//=============================================================================
110
// 1)  INTERNAL WIRES/REGISTERS/PARAMETERS DECLARATION
111
//=============================================================================
112
 
113
// Clock & Reset
114
wire               mclk;
115
wire               aclk_en;
116
wire               smclk_en;
117
wire               puc_rst;
118
 
119
// Debug interface
120
wire               dbg_freeze;
121
 
122
// Data memory
123
wire [`DMEM_MSB:0] dmem_addr;
124
wire               dmem_cen;
125
wire        [15:0] dmem_din;
126
wire         [1:0] dmem_wen;
127
wire        [15:0] dmem_dout;
128
 
129
// Program memory
130
wire [`PMEM_MSB:0] pmem_addr;
131
wire               pmem_cen;
132
wire        [15:0] pmem_din;
133
wire         [1:0] pmem_wen;
134
wire        [15:0] pmem_dout;
135
 
136
// Peripheral bus
137
wire        [13:0] per_addr;
138
wire        [15:0] per_din;
139
wire         [1:0] per_we;
140
wire               per_en;
141
wire        [15:0] per_dout;
142
 
143
// Interrupts
144
wire        [13:0] irq_acc;
145
wire        [13:0] irq_bus;
146
wire               nmi;
147
 
148
// GPIO
149
wire         [7:0] p1_din;
150
wire         [7:0] p1_dout;
151
wire         [7:0] p1_dout_en;
152
wire         [7:0] p1_sel;
153
wire         [7:0] p2_din;
154
wire         [7:0] p2_dout;
155
wire         [7:0] p2_dout_en;
156
wire         [7:0] p2_sel;
157
wire        [15:0] per_dout_gpio;
158
 
159
// Timer A
160
wire        [15:0] per_dout_tA;
161
 
162
// Hardware UART
163
wire        [15:0] per_dout_uart;
164
 
165
 
166
//=============================================================================
167
// 2)  OPENMSP430 CORE
168
//=============================================================================
169
 
170
openMSP430 #(.INST_NR (0),
171 167 olivier.gi
             .TOTAL_NR(1)) openMSP430_0 (
172 157 olivier.gi
 
173
// OUTPUTs
174
    .aclk              (),                   // ASIC ONLY: ACLK
175
    .aclk_en           (aclk_en),            // FPGA ONLY: ACLK enable
176
    .dbg_freeze        (dbg_freeze),         // Freeze peripherals
177
    .dbg_i2c_sda_out   (dbg_i2c_sda_out),    // Debug interface: I2C SDA OUT
178 167 olivier.gi
    .dbg_uart_txd      (),                   // Debug interface: UART TXD
179 157 olivier.gi
    .dco_enable        (),                   // ASIC ONLY: Fast oscillator enable
180
    .dco_wkup          (),                   // ASIC ONLY: Fast oscillator wake-up (asynchronous)
181
    .dmem_addr         (dmem_addr),          // Data Memory address
182
    .dmem_cen          (dmem_cen),           // Data Memory chip enable (low active)
183
    .dmem_din          (dmem_din),           // Data Memory data input
184
    .dmem_wen          (dmem_wen),           // Data Memory write enable (low active)
185
    .irq_acc           (irq_acc),            // Interrupt request accepted (one-hot signal)
186
    .lfxt_enable       (),                   // ASIC ONLY: Low frequency oscillator enable
187
    .lfxt_wkup         (),                   // ASIC ONLY: Low frequency oscillator wake-up (asynchronous)
188
    .mclk              (mclk),               // Main system clock
189
    .per_addr          (per_addr),           // Peripheral address
190
    .per_din           (per_din),            // Peripheral data input
191
    .per_we            (per_we),             // Peripheral write enable (high active)
192
    .per_en            (per_en),             // Peripheral enable (high active)
193
    .pmem_addr         (pmem_addr),          // Program Memory address
194
    .pmem_cen          (pmem_cen),           // Program Memory chip enable (low active)
195
    .pmem_din          (pmem_din),           // Program Memory data input (optional)
196
    .pmem_wen          (pmem_wen),           // Program Memory write enable (low active) (optional)
197
    .puc_rst           (puc_rst),            // Main system reset
198
    .smclk             (),                   // ASIC ONLY: SMCLK
199
    .smclk_en          (smclk_en),           // FPGA ONLY: SMCLK enable
200
 
201
// INPUTs
202
    .cpu_en            (1'b1),               // Enable CPU code execution (asynchronous and non-glitchy)
203
    .dbg_en            (1'b1),               // Debug interface enable (asynchronous and non-glitchy)
204
    .dbg_i2c_addr      (dbg_i2c_addr),       // Debug interface: I2C Address
205
    .dbg_i2c_broadcast (dbg_i2c_broadcast),  // Debug interface: I2C Broadcast Address (for multicore systems)
206
    .dbg_i2c_scl       (dbg_i2c_scl),        // Debug interface: I2C SCL
207
    .dbg_i2c_sda_in    (dbg_i2c_sda_in),     // Debug interface: I2C SDA IN
208 167 olivier.gi
    .dbg_uart_rxd      (1'b1),               // Debug interface: UART RXD (asynchronous)
209 157 olivier.gi
    .dco_clk           (dco_clk),            // Fast oscillator (fast clock)
210
    .dmem_dout         (dmem_dout),          // Data Memory data output
211
    .irq               (irq_bus),            // Maskable interrupts
212
    .lfxt_clk          (1'b0),               // Low frequency oscillator (typ 32kHz)
213
    .nmi               (nmi),                // Non-maskable interrupt (asynchronous)
214
    .per_dout          (per_dout),           // Peripheral data output
215
    .pmem_dout         (pmem_dout),          // Program Memory data output
216
    .reset_n           (reset_n),            // Reset Pin (low active, asynchronous and non-glitchy)
217
    .scan_enable       (1'b0),               // ASIC ONLY: Scan enable (active during scan shifting)
218
    .scan_mode         (1'b0),               // ASIC ONLY: Scan mode
219
    .wkup              (1'b0)                // ASIC ONLY: System Wake-up (asynchronous and non-glitchy)
220
);
221
 
222
 
223
//=============================================================================
224
// 3)  OPENMSP430 PERIPHERALS
225
//=============================================================================
226
 
227
//
228
// Digital I/O
229
//-------------------------------
230
 
231
omsp_gpio #(.P1_EN(1),
232
            .P2_EN(1),
233
            .P3_EN(0),
234
            .P4_EN(0),
235
            .P5_EN(0),
236
            .P6_EN(0)) gpio_0 (
237
 
238
// OUTPUTs
239
    .irq_port1    (irq_port1),             // Port 1 interrupt
240
    .irq_port2    (irq_port2),             // Port 2 interrupt
241
    .p1_dout      (p1_dout),               // Port 1 data output
242
    .p1_dout_en   (p1_dout_en),            // Port 1 data output enable
243
    .p1_sel       (p1_sel),                // Port 1 function select
244
    .p2_dout      (p2_dout),               // Port 2 data output
245
    .p2_dout_en   (p2_dout_en),            // Port 2 data output enable
246
    .p2_sel       (p2_sel),                // Port 2 function select
247
    .p3_dout      (),                      // Port 3 data output
248
    .p3_dout_en   (),                      // Port 3 data output enable
249
    .p3_sel       (),                      // Port 3 function select
250
    .p4_dout      (),                      // Port 4 data output
251
    .p4_dout_en   (),                      // Port 4 data output enable
252
    .p4_sel       (),                      // Port 4 function select
253
    .p5_dout      (),                      // Port 5 data output
254
    .p5_dout_en   (),                      // Port 5 data output enable
255
    .p5_sel       (),                      // Port 5 function select
256
    .p6_dout      (),                      // Port 6 data output
257
    .p6_dout_en   (),                      // Port 6 data output enable
258
    .p6_sel       (),                      // Port 6 function select
259
    .per_dout     (per_dout_gpio),         // Peripheral data output
260
 
261
// INPUTs
262
    .mclk         (mclk),                  // Main system clock
263
    .p1_din       (p1_din),                // Port 1 data input
264
    .p2_din       (p2_din),                // Port 2 data input
265
    .p3_din       (8'h00),                 // Port 3 data input
266
    .p4_din       (8'h00),                 // Port 4 data input
267
    .p5_din       (8'h00),                 // Port 5 data input
268
    .p6_din       (8'h00),                 // Port 6 data input
269
    .per_addr     (per_addr),              // Peripheral address
270
    .per_din      (per_din),               // Peripheral data input
271
    .per_en       (per_en),                // Peripheral enable (high active)
272
    .per_we       (per_we),                // Peripheral write enable (high active)
273
    .puc_rst      (puc_rst)                // Main system reset
274
);
275
 
276
// Assign LEDs
277 167 olivier.gi
assign  led         = p2_dout[1:0] & p2_dout_en[1:0];
278 157 olivier.gi
 
279
// Assign Switches
280
assign  p1_din[7:4] = 4'h0;
281
assign  p1_din[3:0] = switch;
282
 
283
 
284
//
285
// Timer A
286
//----------------------------------------------
287
 
288
omsp_timerA timerA_0 (
289
 
290
// OUTPUTs
291
    .irq_ta0      (irq_ta0),               // Timer A interrupt: TACCR0
292
    .irq_ta1      (irq_ta1),               // Timer A interrupt: TAIV, TACCR1, TACCR2
293
    .per_dout     (per_dout_tA),           // Peripheral data output
294
    .ta_out0      (),                      // Timer A output 0
295
    .ta_out0_en   (),                      // Timer A output 0 enable
296
    .ta_out1      (),                      // Timer A output 1
297
    .ta_out1_en   (),                      // Timer A output 1 enable
298
    .ta_out2      (),                      // Timer A output 2
299
    .ta_out2_en   (),                      // Timer A output 2 enable
300
 
301
// INPUTs
302
    .aclk_en      (aclk_en),               // ACLK enable (from CPU)
303
    .dbg_freeze   (dbg_freeze),            // Freeze Timer A counter
304
    .inclk        (1'b0),                  // INCLK external timer clock (SLOW)
305
    .irq_ta0_acc  (irq_acc[9]),            // Interrupt request TACCR0 accepted
306
    .mclk         (mclk),                  // Main system clock
307
    .per_addr     (per_addr),              // Peripheral address
308
    .per_din      (per_din),               // Peripheral data input
309
    .per_en       (per_en),                // Peripheral enable (high active)
310
    .per_we       (per_we),                // Peripheral write enable (high active)
311
    .puc_rst      (puc_rst),               // Main system reset
312
    .smclk_en     (smclk_en),              // SMCLK enable (from CPU)
313
    .ta_cci0a     (1'b0),                  // Timer A capture 0 input A
314
    .ta_cci0b     (1'b0),                  // Timer A capture 0 input B
315
    .ta_cci1a     (1'b0),                  // Timer A capture 1 input A
316
    .ta_cci1b     (1'b0),                  // Timer A capture 1 input B
317
    .ta_cci2a     (1'b0),                  // Timer A capture 2 input A
318
    .ta_cci2b     (1'b0),                  // Timer A capture 2 input B
319
    .taclk        (1'b0)                   // TACLK external timer clock (SLOW)
320
);
321
 
322
 
323
//
324
// Hardware UART
325
//----------------------------------------------
326
 
327
omsp_uart uart_0 (
328
 
329
// OUTPUTs
330
    .irq_uart_rx  (irq_uart_rx),           // UART receive interrupt
331
    .irq_uart_tx  (irq_uart_tx),           // UART transmit interrupt
332
    .per_dout     (per_dout_uart),         // Peripheral data output
333
    .uart_txd     (uart_txd),              // UART Data Transmit (TXD)
334
 
335
// INPUTs
336
    .mclk         (mclk),                  // Main system clock
337
    .per_addr     (per_addr),              // Peripheral address
338
    .per_din      (per_din),               // Peripheral data input
339
    .per_en       (per_en),                // Peripheral enable (high active)
340
    .per_we       (per_we),                // Peripheral write enable (high active)
341
    .puc_rst      (puc_rst),               // Main system reset
342
    .smclk_en     (smclk_en),              // SMCLK enable (from CPU)
343
    .uart_rxd     (uart_rxd)               // UART Data Receive (RXD)
344
);
345
 
346
 
347
//
348
// Combine peripheral data buses
349
//-------------------------------
350
 
351
assign per_dout = per_dout_gpio  |
352
                  per_dout_uart  |
353
                  per_dout_tA;
354
 
355
//
356
// Assign interrupts
357
//-------------------------------
358
 
359
assign nmi      =   1'b0;
360
assign irq_bus  =  {1'b0,         // Vector 13  (0xFFFA)
361
                    1'b0,         // Vector 12  (0xFFF8)
362
                    1'b0,         // Vector 11  (0xFFF6)
363
                    1'b0,         // Vector 10  (0xFFF4) - Watchdog -
364
                    irq_ta0,      // Vector  9  (0xFFF2)
365
                    irq_ta1,      // Vector  8  (0xFFF0)
366
                    irq_uart_rx,  // Vector  7  (0xFFEE)
367
                    irq_uart_tx,  // Vector  6  (0xFFEC)
368 167 olivier.gi
                    1'b0,         // Vector  5  (0xFFEA) - Reserved (Timer-A 0 from system 1)
369
                    1'b0,         // Vector  4  (0xFFE8) - Reserved (Timer-A 1 from system 1)
370 157 olivier.gi
                    irq_port2,    // Vector  3  (0xFFE6)
371
                    irq_port1,    // Vector  2  (0xFFE4)
372 167 olivier.gi
                    1'b0,         // Vector  1  (0xFFE2) - Reserved (Port 2 from system 1)
373
                    1'b0};        // Vector  0  (0xFFE0) - Reserved (Port 1 from system 1)
374 157 olivier.gi
 
375
 
376
endmodule // omsp_system_0
377
 
378
 
379
 

powered by: WebSVN 2.1.0

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