1 |
2 |
olivier.gi |
//----------------------------------------------------------------------------
|
2 |
|
|
// Copyright (C) 2001 Authors
|
3 |
|
|
//
|
4 |
|
|
// This source file may be used and distributed without restriction provided
|
5 |
|
|
// that this copyright statement is not removed from the file and that any
|
6 |
|
|
// derivative work contains the original copyright notice and the associated
|
7 |
|
|
// disclaimer.
|
8 |
|
|
//
|
9 |
|
|
// This source file is free software; you can redistribute it and/or modify
|
10 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
11 |
|
|
// by the Free Software Foundation; either version 2.1 of the License, or
|
12 |
|
|
// (at your option) any later version.
|
13 |
|
|
//
|
14 |
|
|
// This source is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
16 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
17 |
|
|
// License for more details.
|
18 |
|
|
//
|
19 |
|
|
// You should have received a copy of the GNU Lesser General Public License
|
20 |
|
|
// along with this source; if not, write to the Free Software Foundation,
|
21 |
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22 |
|
|
//
|
23 |
|
|
//----------------------------------------------------------------------------
|
24 |
|
|
//
|
25 |
|
|
// *File Name: openMSP430.v
|
26 |
|
|
//
|
27 |
|
|
// *Module Description:
|
28 |
|
|
// openMSP430 Top level file
|
29 |
|
|
//
|
30 |
|
|
// *Author(s):
|
31 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
32 |
|
|
//
|
33 |
|
|
//----------------------------------------------------------------------------
|
34 |
17 |
olivier.gi |
// $Rev: 17 $
|
35 |
|
|
// $LastChangedBy: olivier.girard $
|
36 |
|
|
// $LastChangedDate: 2009-08-04 23:15:39 +0200 (Tue, 04 Aug 2009) $
|
37 |
|
|
//----------------------------------------------------------------------------
|
38 |
2 |
olivier.gi |
`timescale 1ns / 100ps
|
39 |
|
|
|
40 |
|
|
module openMSP430 (
|
41 |
|
|
|
42 |
|
|
// OUTPUTs
|
43 |
|
|
aclk_en, // ACLK enable
|
44 |
|
|
dbg_freeze, // Freeze peripherals
|
45 |
|
|
dbg_uart_txd, // Debug interface: UART TXD
|
46 |
|
|
irq_acc, // Interrupt request accepted (one-hot signal)
|
47 |
|
|
mclk, // Main system clock
|
48 |
|
|
per_addr, // Peripheral address
|
49 |
|
|
per_din, // Peripheral data input
|
50 |
|
|
per_wen, // Peripheral write enable (high active)
|
51 |
|
|
per_en, // Peripheral enable (high active)
|
52 |
|
|
puc, // Main system reset
|
53 |
|
|
ram_addr, // RAM address
|
54 |
|
|
ram_cen, // RAM chip enable (low active)
|
55 |
|
|
ram_din, // RAM data input
|
56 |
|
|
ram_wen, // RAM write enable (low active)
|
57 |
|
|
rom_addr, // ROM address
|
58 |
|
|
rom_cen, // ROM chip enable (low active)
|
59 |
|
|
rom_din_dbg, // ROM data input --FOR DEBUG INTERFACE--
|
60 |
|
|
rom_wen_dbg, // ROM write enable (low active) --FOR DBG IF--
|
61 |
|
|
smclk_en, // SMCLK enable
|
62 |
|
|
|
63 |
|
|
// INPUTs
|
64 |
|
|
dbg_uart_rxd, // Debug interface: UART RXD
|
65 |
|
|
dco_clk, // Fast oscillator (fast clock)
|
66 |
|
|
irq, // Maskable interrupts
|
67 |
|
|
lfxt_clk, // Low frequency oscillator (typ 32kHz)
|
68 |
|
|
nmi, // Non-maskable interrupt (asynchronous)
|
69 |
|
|
per_dout, // Peripheral data output
|
70 |
|
|
ram_dout, // RAM data output
|
71 |
|
|
reset_n, // Reset Pin (low active)
|
72 |
|
|
rom_dout // ROM data output
|
73 |
|
|
);
|
74 |
|
|
|
75 |
|
|
// OUTPUTs
|
76 |
|
|
//=========
|
77 |
|
|
output aclk_en; // ACLK enable
|
78 |
|
|
output dbg_freeze; // Freeze peripherals
|
79 |
|
|
output dbg_uart_txd; // Debug interface: UART TXD
|
80 |
|
|
output [13:0] irq_acc; // Interrupt request accepted (one-hot signal)
|
81 |
|
|
output mclk; // Main system clock
|
82 |
|
|
output [7:0] per_addr; // Peripheral address
|
83 |
|
|
output [15:0] per_din; // Peripheral data input
|
84 |
|
|
output [1:0] per_wen; // Peripheral write enable (high active)
|
85 |
|
|
output per_en; // Peripheral enable (high active)
|
86 |
|
|
output puc; // Main system reset
|
87 |
|
|
output [`RAM_MSB:0] ram_addr; // RAM address
|
88 |
|
|
output ram_cen; // RAM chip enable (low active)
|
89 |
|
|
output [15:0] ram_din; // RAM data input
|
90 |
|
|
output [1:0] ram_wen; // RAM write enable (low active)
|
91 |
|
|
output [`ROM_MSB:0] rom_addr; // ROM address
|
92 |
|
|
output rom_cen; // ROM chip enable (low active)
|
93 |
|
|
output [15:0] rom_din_dbg; // ROM data input --FOR DEBUG INTERFACE--
|
94 |
|
|
output [1:0] rom_wen_dbg; // ROM write enable (low active) --FOR DBG IF--
|
95 |
|
|
output smclk_en; // SMCLK enable
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
// INPUTs
|
99 |
|
|
//=========
|
100 |
|
|
input dbg_uart_rxd; // Debug interface: UART RXD
|
101 |
|
|
input dco_clk; // Fast oscillator (fast clock)
|
102 |
|
|
input [13:0] irq; // Maskable interrupts
|
103 |
|
|
input lfxt_clk; // Low frequency oscillator (typ 32kHz)
|
104 |
|
|
input nmi; // Non-maskable interrupt (asynchronous)
|
105 |
|
|
input [15:0] per_dout; // Peripheral data output
|
106 |
|
|
input [15:0] ram_dout; // RAM data output
|
107 |
|
|
input reset_n; // Reset Pin (active low)
|
108 |
|
|
input [15:0] rom_dout; // ROM data output
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
//=============================================================================
|
113 |
|
|
// 1) INTERNAL WIRES/REGISTERS/PARAMETERS DECLARATION
|
114 |
|
|
//=============================================================================
|
115 |
|
|
|
116 |
|
|
wire [7:0] inst_ad;
|
117 |
|
|
wire [7:0] inst_as;
|
118 |
|
|
wire [11:0] inst_alu;
|
119 |
|
|
wire inst_bw;
|
120 |
|
|
wire [15:0] inst_dest;
|
121 |
|
|
wire [15:0] inst_dext;
|
122 |
|
|
wire [15:0] inst_sext;
|
123 |
|
|
wire [7:0] inst_so;
|
124 |
|
|
wire [15:0] inst_src;
|
125 |
|
|
wire [2:0] inst_type;
|
126 |
|
|
wire [3:0] e_state;
|
127 |
|
|
wire exec_done;
|
128 |
|
|
|
129 |
|
|
wire [15:0] eu_mab;
|
130 |
|
|
wire [15:0] eu_mdb_in;
|
131 |
|
|
wire [15:0] eu_mdb_out;
|
132 |
|
|
wire [1:0] eu_mb_wr;
|
133 |
|
|
wire [15:0] fe_mab;
|
134 |
|
|
wire [15:0] fe_mdb_in;
|
135 |
|
|
|
136 |
|
|
wire [15:0] pc_sw;
|
137 |
|
|
wire [7:0] inst_jmp;
|
138 |
|
|
wire [15:0] pc;
|
139 |
|
|
wire [15:0] pc_nxt;
|
140 |
|
|
|
141 |
|
|
wire [15:0] dbg_mem_addr;
|
142 |
|
|
wire [15:0] dbg_mem_dout;
|
143 |
|
|
wire [15:0] dbg_mem_din;
|
144 |
|
|
wire [15:0] dbg_reg_din;
|
145 |
|
|
wire [1:0] dbg_mem_wr;
|
146 |
|
|
|
147 |
|
|
wire [15:0] per_dout_or;
|
148 |
|
|
wire [15:0] per_dout_sfr;
|
149 |
|
|
wire [15:0] per_dout_wdog;
|
150 |
|
|
wire [15:0] per_dout_clk;
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
//=============================================================================
|
154 |
|
|
// 2) GLOBAL CLOCK & RESET MANAGEMENT
|
155 |
|
|
//=============================================================================
|
156 |
|
|
|
157 |
|
|
clock_module clock_module_0 (
|
158 |
|
|
|
159 |
|
|
// OUTPUTs
|
160 |
|
|
.aclk_en (aclk_en), // ACLK enablex
|
161 |
|
|
.mclk (mclk), // Main system clock
|
162 |
|
|
.per_dout (per_dout_clk), // Peripheral data output
|
163 |
|
|
.por (por), // Power-on reset
|
164 |
|
|
.puc (puc), // Main system reset
|
165 |
|
|
.smclk_en (smclk_en), // SMCLK enable
|
166 |
|
|
|
167 |
|
|
// INPUTs
|
168 |
|
|
.dbg_reset (dbg_reset), // Reset CPU from debug interface
|
169 |
|
|
.dco_clk (dco_clk), // Fast oscillator (fast clock)
|
170 |
|
|
.lfxt_clk (lfxt_clk), // Low frequency oscillator (typ 32kHz)
|
171 |
|
|
.oscoff (oscoff), // Turns off LFXT1 clock input
|
172 |
|
|
.per_addr (per_addr), // Peripheral address
|
173 |
|
|
.per_din (per_din), // Peripheral data input
|
174 |
|
|
.per_en (per_en), // Peripheral enable (high active)
|
175 |
|
|
.per_wen (per_wen), // Peripheral write enable (high active)
|
176 |
|
|
.reset_n (reset_n), // Reset Pin (low active)
|
177 |
|
|
.scg1 (scg1), // System clock generator 1. Turns off the SMCLK
|
178 |
|
|
.wdt_reset (wdt_reset) // Watchdog-timer reset
|
179 |
|
|
);
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
//=============================================================================
|
183 |
|
|
// 3) FRONTEND (<=> FETCH & DECODE)
|
184 |
|
|
//=============================================================================
|
185 |
|
|
|
186 |
|
|
frontend frontend_0 (
|
187 |
|
|
|
188 |
|
|
// OUTPUTs
|
189 |
|
|
.dbg_halt_st (dbg_halt_st), // Halt/Run status from CPU
|
190 |
|
|
.decode (decode), // Frontend decode instruction
|
191 |
|
|
.e_state (e_state), // Execution state
|
192 |
|
|
.exec_done (exec_done), // Execution completed
|
193 |
|
|
.inst_ad (inst_ad), // Decoded Inst: destination addressing mode
|
194 |
|
|
.inst_as (inst_as), // Decoded Inst: source addressing mode
|
195 |
|
|
.inst_alu (inst_alu), // ALU control signals
|
196 |
|
|
.inst_bw (inst_bw), // Decoded Inst: byte width
|
197 |
|
|
.inst_dest (inst_dest), // Decoded Inst: destination (one hot)
|
198 |
|
|
.inst_dext (inst_dext), // Decoded Inst: destination extended instruction word
|
199 |
|
|
.inst_irq_rst (inst_irq_rst), // Decoded Inst: Reset interrupt
|
200 |
|
|
.inst_jmp (inst_jmp), // Decoded Inst: Conditional jump
|
201 |
|
|
.inst_sext (inst_sext), // Decoded Inst: source extended instruction word
|
202 |
|
|
.inst_so (inst_so), // Decoded Inst: Single-operand arithmetic
|
203 |
|
|
.inst_src (inst_src), // Decoded Inst: source (one hot)
|
204 |
|
|
.inst_type (inst_type), // Decoded Instruction type
|
205 |
|
|
.irq_acc (irq_acc), // Interrupt request accepted
|
206 |
|
|
.mab (fe_mab), // Frontend Memory address bus
|
207 |
|
|
.mb_en (fe_mb_en), // Frontend Memory bus enable
|
208 |
|
|
.nmi_acc (nmi_acc), // Non-Maskable interrupt request accepted
|
209 |
|
|
.pc (pc), // Program counter
|
210 |
|
|
.pc_nxt (pc_nxt), // Next PC value (for CALL & IRQ)
|
211 |
|
|
|
212 |
|
|
// INPUTs
|
213 |
|
|
.cpuoff (cpuoff), // Turns off the CPU
|
214 |
|
|
.dbg_halt_cmd (dbg_halt_cmd), // Halt CPU command
|
215 |
|
|
.dbg_reg_sel (dbg_mem_addr[3:0]), // Debug selected register for rd/wr access
|
216 |
|
|
.fe_rom_wait (fe_rom_wait), // Frontend wait for ROM
|
217 |
|
|
.gie (gie), // General interrupt enable
|
218 |
|
|
.irq (irq), // Maskable interrupts
|
219 |
|
|
.mclk (mclk), // Main system clock
|
220 |
|
|
.mdb_in (fe_mdb_in), // Frontend Memory data bus input
|
221 |
|
|
.nmi_evt (nmi_evt), // Non-maskable interrupt event
|
222 |
|
|
.pc_sw (pc_sw), // Program counter software value
|
223 |
|
|
.pc_sw_wr (pc_sw_wr), // Program counter software write
|
224 |
|
|
.puc (puc), // Main system reset
|
225 |
|
|
.wdt_irq (wdt_irq) // Watchdog-timer interrupt
|
226 |
|
|
);
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
//=============================================================================
|
230 |
|
|
// 4) EXECUTION UNIT
|
231 |
|
|
//=============================================================================
|
232 |
|
|
|
233 |
|
|
execution_unit execution_unit_0 (
|
234 |
|
|
|
235 |
|
|
// OUTPUTs
|
236 |
|
|
.cpuoff (cpuoff), // Turns off the CPU
|
237 |
|
|
.dbg_reg_din (dbg_reg_din), // Debug unit CPU register data input
|
238 |
|
|
.mab (eu_mab), // Memory address bus
|
239 |
|
|
.mb_en (eu_mb_en), // Memory bus enable
|
240 |
|
|
.mb_wr (eu_mb_wr), // Memory bus write transfer
|
241 |
|
|
.mdb_out (eu_mdb_out), // Memory data bus output
|
242 |
|
|
.oscoff (oscoff), // Turns off LFXT1 clock input
|
243 |
|
|
.pc_sw (pc_sw), // Program counter software value
|
244 |
|
|
.pc_sw_wr (pc_sw_wr), // Program counter software write
|
245 |
|
|
.scg1 (scg1), // System clock generator 1. Turns off the SMCLK
|
246 |
|
|
|
247 |
|
|
// INPUTs
|
248 |
|
|
.dbg_halt_st (dbg_halt_st), // Halt/Run status from CPU
|
249 |
|
|
.dbg_mem_dout (dbg_mem_dout), // Debug unit data output
|
250 |
|
|
.dbg_reg_wr (dbg_reg_wr), // Debug unit CPU register write
|
251 |
|
|
.e_state (e_state), // Execution state
|
252 |
|
|
.exec_done (exec_done), // Execution completed
|
253 |
|
|
.gie (gie), // General interrupt enable
|
254 |
|
|
.inst_ad (inst_ad), // Decoded Inst: destination addressing mode
|
255 |
|
|
.inst_as (inst_as), // Decoded Inst: source addressing mode
|
256 |
|
|
.inst_alu (inst_alu), // ALU control signals
|
257 |
|
|
.inst_bw (inst_bw), // Decoded Inst: byte width
|
258 |
|
|
.inst_dest (inst_dest), // Decoded Inst: destination (one hot)
|
259 |
|
|
.inst_dext (inst_dext), // Decoded Inst: destination extended instruction word
|
260 |
|
|
.inst_irq_rst (inst_irq_rst), // Decoded Inst: reset interrupt
|
261 |
|
|
.inst_jmp (inst_jmp), // Decoded Inst: Conditional jump
|
262 |
|
|
.inst_sext (inst_sext), // Decoded Inst: source extended instruction word
|
263 |
|
|
.inst_so (inst_so), // Decoded Inst: Single-operand arithmetic
|
264 |
|
|
.inst_src (inst_src), // Decoded Inst: source (one hot)
|
265 |
|
|
.inst_type (inst_type), // Decoded Instruction type
|
266 |
|
|
.mclk (mclk), // Main system clock
|
267 |
|
|
.mdb_in (eu_mdb_in), // Memory data bus input
|
268 |
|
|
.pc (pc), // Program counter
|
269 |
|
|
.pc_nxt (pc_nxt), // Next PC value (for CALL & IRQ)
|
270 |
|
|
.puc (puc) // Main system reset
|
271 |
|
|
);
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
//=============================================================================
|
275 |
|
|
// 5) MEMORY BACKBONE
|
276 |
|
|
//=============================================================================
|
277 |
|
|
|
278 |
|
|
mem_backbone mem_backbone_0 (
|
279 |
|
|
|
280 |
|
|
// OUTPUTs
|
281 |
|
|
.dbg_mem_din (dbg_mem_din), // Debug unit Memory data input
|
282 |
|
|
.eu_mdb_in (eu_mdb_in), // Execution Unit Memory data bus input
|
283 |
|
|
.fe_mdb_in (fe_mdb_in), // Frontend Memory data bus input
|
284 |
|
|
.fe_rom_wait (fe_rom_wait), // Frontend wait for ROM
|
285 |
|
|
.per_addr (per_addr), // Peripheral address
|
286 |
|
|
.per_din (per_din), // Peripheral data input
|
287 |
|
|
.per_wen (per_wen), // Peripheral write enable (high active)
|
288 |
|
|
.per_en (per_en), // Peripheral enable (high active)
|
289 |
|
|
.ram_addr (ram_addr), // RAM address
|
290 |
|
|
.ram_cen (ram_cen), // RAM chip enable (low active)
|
291 |
|
|
.ram_din (ram_din), // RAM data input
|
292 |
|
|
.ram_wen (ram_wen), // RAM write enable (low active)
|
293 |
|
|
.rom_addr (rom_addr), // ROM address
|
294 |
|
|
.rom_cen (rom_cen), // ROM chip enable (low active)
|
295 |
|
|
.rom_din_dbg (rom_din_dbg), // ROM data input --FOR DEBUG INTERFACE--
|
296 |
|
|
.rom_wen_dbg (rom_wen_dbg), // ROM write enable (low active) --FOR DBG IF--
|
297 |
|
|
|
298 |
|
|
// INPUTs
|
299 |
|
|
.dbg_halt_st (dbg_halt_st), // Halt/Run status from CPU
|
300 |
|
|
.dbg_mem_addr (dbg_mem_addr), // Debug address for rd/wr access
|
301 |
|
|
.dbg_mem_dout (dbg_mem_dout), // Debug unit data output
|
302 |
|
|
.dbg_mem_en (dbg_mem_en), // Debug unit memory enable
|
303 |
|
|
.dbg_mem_wr (dbg_mem_wr), // Debug unit memory write
|
304 |
|
|
.eu_mab (eu_mab[15:1]), // Execution Unit Memory address bus
|
305 |
|
|
.eu_mb_en (eu_mb_en), // Execution Unit Memory bus enable
|
306 |
|
|
.eu_mb_wr (eu_mb_wr), // Execution Unit Memory bus write transfer
|
307 |
|
|
.eu_mdb_out (eu_mdb_out), // Execution Unit Memory data bus output
|
308 |
|
|
.fe_mab (fe_mab[15:1]), // Frontend Memory address bus
|
309 |
|
|
.fe_mb_en (fe_mb_en), // Frontend Memory bus enable
|
310 |
|
|
.mclk (mclk), // Main system clock
|
311 |
|
|
.per_dout (per_dout_or), // Peripheral data output
|
312 |
|
|
.puc (puc), // Main system reset
|
313 |
|
|
.ram_dout (ram_dout), // RAM data output
|
314 |
|
|
.rom_dout (rom_dout) // ROM data output
|
315 |
|
|
);
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
//=============================================================================
|
319 |
|
|
// 6) SPECIAL FUNCTION REGISTERS
|
320 |
|
|
//=============================================================================
|
321 |
|
|
|
322 |
|
|
sfr sfr_0 (
|
323 |
|
|
|
324 |
|
|
// OUTPUTs
|
325 |
|
|
.nmie (nmie), // Non-maskable interrupt enable
|
326 |
|
|
.per_dout (per_dout_sfr), // Peripheral data output
|
327 |
|
|
.wdt_irq (wdt_irq), // Watchdog-timer interrupt
|
328 |
|
|
.wdt_reset (wdt_reset), // Watchdog-timer reset
|
329 |
|
|
.wdtie (wdtie), // Watchdog-timer interrupt enable
|
330 |
|
|
|
331 |
|
|
// INPUTs
|
332 |
|
|
.mclk (mclk), // Main system clock
|
333 |
|
|
.nmi_acc (nmi_acc), // Non-Maskable interrupt request accepted
|
334 |
|
|
.per_addr (per_addr), // Peripheral address
|
335 |
|
|
.per_din (per_din), // Peripheral data input
|
336 |
|
|
.per_en (per_en), // Peripheral enable (high active)
|
337 |
|
|
.per_wen (per_wen), // Peripheral write enable (high active)
|
338 |
|
|
.por (por), // Power-on reset
|
339 |
|
|
.puc (puc), // Main system reset
|
340 |
|
|
.wdtifg_clr (irq_acc[10]), // Clear Watchdog-timer interrupt flag
|
341 |
|
|
.wdtifg_set (wdtifg_set), // Set Watchdog-timer interrupt flag
|
342 |
|
|
.wdtpw_error (wdtpw_error), // Watchdog-timer password error
|
343 |
|
|
.wdttmsel (wdttmsel) // Watchdog-timer mode select
|
344 |
|
|
);
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
//=============================================================================
|
348 |
|
|
// 7) WATCHDOG TIMER
|
349 |
|
|
//=============================================================================
|
350 |
|
|
|
351 |
|
|
watchdog watchdog_0 (
|
352 |
|
|
|
353 |
|
|
// OUTPUTs
|
354 |
|
|
.nmi_evt (nmi_evt), // NMI Event
|
355 |
|
|
.per_dout (per_dout_wdog), // Peripheral data output
|
356 |
|
|
.wdtifg_set (wdtifg_set), // Set Watchdog-timer interrupt flag
|
357 |
|
|
.wdtpw_error (wdtpw_error), // Watchdog-timer password error
|
358 |
|
|
.wdttmsel (wdttmsel), // Watchdog-timer mode select
|
359 |
|
|
|
360 |
|
|
// INPUTs
|
361 |
|
|
.aclk_en (aclk_en), // ACLK enable
|
362 |
|
|
.dbg_freeze (dbg_freeze), // Freeze Watchdog counter
|
363 |
|
|
.mclk (mclk), // Main system clock
|
364 |
|
|
.nmi (nmi), // Non-maskable interrupt (asynchronous)
|
365 |
|
|
.nmie (nmie), // Non-maskable interrupt enable
|
366 |
|
|
.per_addr (per_addr), // Peripheral address
|
367 |
|
|
.per_din (per_din), // Peripheral data input
|
368 |
|
|
.per_en (per_en), // Peripheral enable (high active)
|
369 |
|
|
.per_wen (per_wen), // Peripheral write enable (high active)
|
370 |
|
|
.puc (puc), // Main system reset
|
371 |
|
|
.smclk_en (smclk_en), // SMCLK enable
|
372 |
|
|
.wdtie (wdtie) // Watchdog-timer interrupt enable
|
373 |
|
|
);
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
//=============================================================================
|
377 |
|
|
// 8) PERIPHERALS' OUTPUT BUS
|
378 |
|
|
//=============================================================================
|
379 |
|
|
|
380 |
|
|
assign per_dout_or = per_dout |
|
381 |
|
|
per_dout_clk |
|
382 |
|
|
per_dout_sfr |
|
383 |
|
|
per_dout_wdog;
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
//=============================================================================
|
387 |
|
|
// 9) DEBUG INTERFACE
|
388 |
|
|
//=============================================================================
|
389 |
|
|
|
390 |
|
|
`ifdef DBG_EN
|
391 |
|
|
dbg dbg_0 (
|
392 |
|
|
|
393 |
|
|
// OUTPUTs
|
394 |
|
|
.dbg_freeze (dbg_freeze), // Freeze peripherals
|
395 |
|
|
.dbg_halt_cmd (dbg_halt_cmd), // Halt CPU command
|
396 |
|
|
.dbg_mem_addr (dbg_mem_addr), // Debug address for rd/wr access
|
397 |
|
|
.dbg_mem_dout (dbg_mem_dout), // Debug unit data output
|
398 |
|
|
.dbg_mem_en (dbg_mem_en), // Debug unit memory enable
|
399 |
|
|
.dbg_mem_wr (dbg_mem_wr), // Debug unit memory write
|
400 |
|
|
.dbg_reg_wr (dbg_reg_wr), // Debug unit CPU register write
|
401 |
|
|
.dbg_reset (dbg_reset), // Reset CPU from debug interface
|
402 |
|
|
.dbg_uart_txd (dbg_uart_txd), // Debug interface: UART TXD
|
403 |
|
|
|
404 |
|
|
// INPUTs
|
405 |
|
|
.dbg_halt_st (dbg_halt_st), // Halt/Run status from CPU
|
406 |
|
|
.dbg_mem_din (dbg_mem_din), // Debug unit Memory data input
|
407 |
|
|
.dbg_reg_din (dbg_reg_din), // Debug unit CPU register data input
|
408 |
|
|
.dbg_uart_rxd (dbg_uart_rxd), // Debug interface: UART RXD
|
409 |
|
|
.decode (decode), // Frontend decode instruction
|
410 |
|
|
.eu_mab (eu_mab), // Execution-Unit Memory address bus
|
411 |
|
|
.eu_mb_en (eu_mb_en), // Execution-Unit Memory bus enable
|
412 |
|
|
.eu_mb_wr (eu_mb_wr), // Execution-Unit Memory bus write transfer
|
413 |
|
|
.eu_mdb_in (eu_mdb_in), // Memory data bus input
|
414 |
|
|
.eu_mdb_out (eu_mdb_out), // Memory data bus output
|
415 |
|
|
.exec_done (exec_done), // Execution completed
|
416 |
|
|
.fe_mb_en (fe_mb_en), // Frontend Memory bus enable
|
417 |
|
|
.fe_mdb_in (fe_mdb_in), // Frontend Memory data bus input
|
418 |
|
|
.mclk (mclk), // Main system clock
|
419 |
|
|
.pc (pc), // Program counter
|
420 |
|
|
.por (por), // Power on reset
|
421 |
|
|
.puc (puc) // Main system reset
|
422 |
|
|
);
|
423 |
|
|
|
424 |
|
|
`else
|
425 |
|
|
assign dbg_freeze = 1'b0;
|
426 |
|
|
assign dbg_halt_cmd = 1'b0;
|
427 |
|
|
assign dbg_mem_addr = 16'h0000;
|
428 |
|
|
assign dbg_mem_dout = 16'h0000;
|
429 |
|
|
assign dbg_mem_en = 1'b0;
|
430 |
|
|
assign dbg_mem_wr = 2'b00;
|
431 |
|
|
assign dbg_reg_wr = 1'b0;
|
432 |
|
|
assign dbg_reset = 1'b0;
|
433 |
|
|
assign dbg_uart_txd = 1'b0;
|
434 |
|
|
`endif
|
435 |
|
|
|
436 |
|
|
|
437 |
|
|
endmodule // openMSP430
|
438 |
|
|
|