| 1 |
2 |
olivier.gi |
//----------------------------------------------------------------------------
|
| 2 |
136 |
olivier.gi |
// Copyright (C) 2009 , Olivier Girard
|
| 3 |
2 |
olivier.gi |
//
|
| 4 |
136 |
olivier.gi |
// Redistribution and use in source and binary forms, with or without
|
| 5 |
|
|
// modification, are permitted provided that the following conditions
|
| 6 |
|
|
// are met:
|
| 7 |
|
|
// * Redistributions of source code must retain the above copyright
|
| 8 |
|
|
// notice, this list of conditions and the following disclaimer.
|
| 9 |
|
|
// * Redistributions in binary form must reproduce the above copyright
|
| 10 |
|
|
// notice, this list of conditions and the following disclaimer in the
|
| 11 |
|
|
// documentation and/or other materials provided with the distribution.
|
| 12 |
|
|
// * Neither the name of the authors nor the names of its contributors
|
| 13 |
|
|
// may be used to endorse or promote products derived from this software
|
| 14 |
|
|
// without specific prior written permission.
|
| 15 |
2 |
olivier.gi |
//
|
| 16 |
136 |
olivier.gi |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 17 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 18 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 19 |
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
| 20 |
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
| 21 |
|
|
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 22 |
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 23 |
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 24 |
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 25 |
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
| 26 |
|
|
// THE POSSIBILITY OF SUCH DAMAGE
|
| 27 |
2 |
olivier.gi |
//
|
| 28 |
|
|
//----------------------------------------------------------------------------
|
| 29 |
|
|
//
|
| 30 |
34 |
olivier.gi |
// *File Name: omsp_sfr.v
|
| 31 |
202 |
olivier.gi |
//
|
| 32 |
2 |
olivier.gi |
// *Module Description:
|
| 33 |
|
|
// Processor Special function register
|
| 34 |
136 |
olivier.gi |
// Non-Maskable Interrupt generation
|
| 35 |
2 |
olivier.gi |
//
|
| 36 |
|
|
// *Author(s):
|
| 37 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
| 38 |
|
|
//
|
| 39 |
|
|
//----------------------------------------------------------------------------
|
| 40 |
17 |
olivier.gi |
// $Rev: 202 $
|
| 41 |
|
|
// $LastChangedBy: olivier.girard $
|
| 42 |
|
|
// $LastChangedDate: 2015-07-01 23:13:32 +0200 (Wed, 01 Jul 2015) $
|
| 43 |
|
|
//----------------------------------------------------------------------------
|
| 44 |
104 |
olivier.gi |
`ifdef OMSP_NO_INCLUDE
|
| 45 |
|
|
`else
|
| 46 |
23 |
olivier.gi |
`include "openMSP430_defines.v"
|
| 47 |
104 |
olivier.gi |
`endif
|
| 48 |
2 |
olivier.gi |
|
| 49 |
34 |
olivier.gi |
module omsp_sfr (
|
| 50 |
2 |
olivier.gi |
|
| 51 |
|
|
// OUTPUTs
|
| 52 |
136 |
olivier.gi |
cpu_id, // CPU ID
|
| 53 |
|
|
nmi_pnd, // NMI Pending
|
| 54 |
|
|
nmi_wkup, // NMI Wakeup
|
| 55 |
2 |
olivier.gi |
per_dout, // Peripheral data output
|
| 56 |
|
|
wdtie, // Watchdog-timer interrupt enable
|
| 57 |
136 |
olivier.gi |
wdtifg_sw_clr, // Watchdog-timer interrupt flag software clear
|
| 58 |
|
|
wdtifg_sw_set, // Watchdog-timer interrupt flag software set
|
| 59 |
2 |
olivier.gi |
|
| 60 |
|
|
// INPUTs
|
| 61 |
155 |
olivier.gi |
cpu_nr_inst, // Current oMSP instance number
|
| 62 |
|
|
cpu_nr_total, // Total number of oMSP instances-1
|
| 63 |
2 |
olivier.gi |
mclk, // Main system clock
|
| 64 |
136 |
olivier.gi |
nmi, // Non-maskable interrupt (asynchronous)
|
| 65 |
2 |
olivier.gi |
nmi_acc, // Non-Maskable interrupt request accepted
|
| 66 |
|
|
per_addr, // Peripheral address
|
| 67 |
|
|
per_din, // Peripheral data input
|
| 68 |
|
|
per_en, // Peripheral enable (high active)
|
| 69 |
109 |
olivier.gi |
per_we, // Peripheral write enable (high active)
|
| 70 |
111 |
olivier.gi |
puc_rst, // Main system reset
|
| 71 |
136 |
olivier.gi |
scan_mode, // Scan mode
|
| 72 |
|
|
wdtifg, // Watchdog-timer interrupt flag
|
| 73 |
|
|
wdtnmies // Watchdog-timer NMI edge selection
|
| 74 |
2 |
olivier.gi |
);
|
| 75 |
|
|
|
| 76 |
|
|
// OUTPUTs
|
| 77 |
|
|
//=========
|
| 78 |
136 |
olivier.gi |
output [31:0] cpu_id; // CPU ID
|
| 79 |
|
|
output nmi_pnd; // NMI Pending
|
| 80 |
|
|
output nmi_wkup; // NMI Wakeup
|
| 81 |
2 |
olivier.gi |
output [15:0] per_dout; // Peripheral data output
|
| 82 |
|
|
output wdtie; // Watchdog-timer interrupt enable
|
| 83 |
136 |
olivier.gi |
output wdtifg_sw_clr;// Watchdog-timer interrupt flag software clear
|
| 84 |
|
|
output wdtifg_sw_set;// Watchdog-timer interrupt flag software set
|
| 85 |
2 |
olivier.gi |
|
| 86 |
|
|
// INPUTs
|
| 87 |
|
|
//=========
|
| 88 |
155 |
olivier.gi |
input [7:0] cpu_nr_inst; // Current oMSP instance number
|
| 89 |
|
|
input [7:0] cpu_nr_total; // Total number of oMSP instances-1
|
| 90 |
2 |
olivier.gi |
input mclk; // Main system clock
|
| 91 |
136 |
olivier.gi |
input nmi; // Non-maskable interrupt (asynchronous)
|
| 92 |
2 |
olivier.gi |
input nmi_acc; // Non-Maskable interrupt request accepted
|
| 93 |
111 |
olivier.gi |
input [13:0] per_addr; // Peripheral address
|
| 94 |
2 |
olivier.gi |
input [15:0] per_din; // Peripheral data input
|
| 95 |
|
|
input per_en; // Peripheral enable (high active)
|
| 96 |
109 |
olivier.gi |
input [1:0] per_we; // Peripheral write enable (high active)
|
| 97 |
111 |
olivier.gi |
input puc_rst; // Main system reset
|
| 98 |
136 |
olivier.gi |
input scan_mode; // Scan mode
|
| 99 |
|
|
input wdtifg; // Watchdog-timer interrupt flag
|
| 100 |
|
|
input wdtnmies; // Watchdog-timer NMI edge selection
|
| 101 |
2 |
olivier.gi |
|
| 102 |
|
|
|
| 103 |
|
|
//=============================================================================
|
| 104 |
|
|
// 1) PARAMETER DECLARATION
|
| 105 |
|
|
//=============================================================================
|
| 106 |
|
|
|
| 107 |
111 |
olivier.gi |
// Register base address (must be aligned to decoder bit width)
|
| 108 |
|
|
parameter [14:0] BASE_ADDR = 15'h0000;
|
| 109 |
2 |
olivier.gi |
|
| 110 |
111 |
olivier.gi |
// Decoder bit width (defines how many bits are considered for address decoding)
|
| 111 |
155 |
olivier.gi |
parameter DEC_WD = 4;
|
| 112 |
111 |
olivier.gi |
|
| 113 |
|
|
// Register addresses offset
|
| 114 |
|
|
parameter [DEC_WD-1:0] IE1 = 'h0,
|
| 115 |
136 |
olivier.gi |
IFG1 = 'h2,
|
| 116 |
|
|
CPU_ID_LO = 'h4,
|
| 117 |
155 |
olivier.gi |
CPU_ID_HI = 'h6,
|
| 118 |
|
|
CPU_NR = 'h8;
|
| 119 |
111 |
olivier.gi |
|
| 120 |
|
|
// Register one-hot decoder utilities
|
| 121 |
136 |
olivier.gi |
parameter DEC_SZ = (1 << DEC_WD);
|
| 122 |
111 |
olivier.gi |
parameter [DEC_SZ-1:0] BASE_REG = {{DEC_SZ-1{1'b0}}, 1'b1};
|
| 123 |
|
|
|
| 124 |
2 |
olivier.gi |
// Register one-hot decoder
|
| 125 |
111 |
olivier.gi |
parameter [DEC_SZ-1:0] IE1_D = (BASE_REG << IE1),
|
| 126 |
136 |
olivier.gi |
IFG1_D = (BASE_REG << IFG1),
|
| 127 |
|
|
CPU_ID_LO_D = (BASE_REG << CPU_ID_LO),
|
| 128 |
155 |
olivier.gi |
CPU_ID_HI_D = (BASE_REG << CPU_ID_HI),
|
| 129 |
|
|
CPU_NR_D = (BASE_REG << CPU_NR);
|
| 130 |
2 |
olivier.gi |
|
| 131 |
|
|
|
| 132 |
|
|
//============================================================================
|
| 133 |
|
|
// 2) REGISTER DECODER
|
| 134 |
|
|
//============================================================================
|
| 135 |
|
|
|
| 136 |
111 |
olivier.gi |
// Local register selection
|
| 137 |
|
|
wire reg_sel = per_en & (per_addr[13:DEC_WD-1]==BASE_ADDR[14:DEC_WD]);
|
| 138 |
|
|
|
| 139 |
|
|
// Register local address
|
| 140 |
|
|
wire [DEC_WD-1:0] reg_addr = {1'b0, per_addr[DEC_WD-2:0]};
|
| 141 |
|
|
|
| 142 |
2 |
olivier.gi |
// Register address decode
|
| 143 |
136 |
olivier.gi |
wire [DEC_SZ-1:0] reg_dec = (IE1_D & {DEC_SZ{(reg_addr==(IE1 >>1))}}) |
|
| 144 |
|
|
(IFG1_D & {DEC_SZ{(reg_addr==(IFG1 >>1))}}) |
|
| 145 |
|
|
(CPU_ID_LO_D & {DEC_SZ{(reg_addr==(CPU_ID_LO >>1))}}) |
|
| 146 |
155 |
olivier.gi |
(CPU_ID_HI_D & {DEC_SZ{(reg_addr==(CPU_ID_HI >>1))}}) |
|
| 147 |
|
|
(CPU_NR_D & {DEC_SZ{(reg_addr==(CPU_NR >>1))}});
|
| 148 |
2 |
olivier.gi |
|
| 149 |
|
|
// Read/Write probes
|
| 150 |
111 |
olivier.gi |
wire reg_lo_write = per_we[0] & reg_sel;
|
| 151 |
|
|
wire reg_hi_write = per_we[1] & reg_sel;
|
| 152 |
|
|
wire reg_read = ~|per_we & reg_sel;
|
| 153 |
2 |
olivier.gi |
|
| 154 |
|
|
// Read/Write vectors
|
| 155 |
111 |
olivier.gi |
wire [DEC_SZ-1:0] reg_hi_wr = reg_dec & {DEC_SZ{reg_hi_write}};
|
| 156 |
|
|
wire [DEC_SZ-1:0] reg_lo_wr = reg_dec & {DEC_SZ{reg_lo_write}};
|
| 157 |
|
|
wire [DEC_SZ-1:0] reg_rd = reg_dec & {DEC_SZ{reg_read}};
|
| 158 |
2 |
olivier.gi |
|
| 159 |
|
|
|
| 160 |
|
|
//============================================================================
|
| 161 |
|
|
// 3) REGISTERS
|
| 162 |
|
|
//============================================================================
|
| 163 |
|
|
|
| 164 |
|
|
// IE1 Register
|
| 165 |
|
|
//--------------
|
| 166 |
|
|
wire [7:0] ie1;
|
| 167 |
111 |
olivier.gi |
wire ie1_wr = IE1[0] ? reg_hi_wr[IE1] : reg_lo_wr[IE1];
|
| 168 |
|
|
wire [7:0] ie1_nxt = IE1[0] ? per_din[15:8] : per_din[7:0];
|
| 169 |
2 |
olivier.gi |
|
| 170 |
136 |
olivier.gi |
`ifdef NMI
|
| 171 |
2 |
olivier.gi |
reg nmie;
|
| 172 |
111 |
olivier.gi |
always @ (posedge mclk or posedge puc_rst)
|
| 173 |
|
|
if (puc_rst) nmie <= 1'b0;
|
| 174 |
202 |
olivier.gi |
else if (nmi_acc) nmie <= 1'b0;
|
| 175 |
|
|
else if (ie1_wr) nmie <= ie1_nxt[4];
|
| 176 |
136 |
olivier.gi |
`else
|
| 177 |
|
|
wire nmie = 1'b0;
|
| 178 |
|
|
`endif
|
| 179 |
2 |
olivier.gi |
|
| 180 |
136 |
olivier.gi |
`ifdef WATCHDOG
|
| 181 |
2 |
olivier.gi |
reg wdtie;
|
| 182 |
111 |
olivier.gi |
always @ (posedge mclk or posedge puc_rst)
|
| 183 |
|
|
if (puc_rst) wdtie <= 1'b0;
|
| 184 |
202 |
olivier.gi |
else if (ie1_wr) wdtie <= ie1_nxt[0];
|
| 185 |
136 |
olivier.gi |
`else
|
| 186 |
202 |
olivier.gi |
wire wdtie = 1'b0;
|
| 187 |
136 |
olivier.gi |
`endif
|
| 188 |
2 |
olivier.gi |
|
| 189 |
|
|
assign ie1 = {3'b000, nmie, 3'b000, wdtie};
|
| 190 |
|
|
|
| 191 |
|
|
|
| 192 |
|
|
// IFG1 Register
|
| 193 |
|
|
//---------------
|
| 194 |
|
|
wire [7:0] ifg1;
|
| 195 |
136 |
olivier.gi |
|
| 196 |
111 |
olivier.gi |
wire ifg1_wr = IFG1[0] ? reg_hi_wr[IFG1] : reg_lo_wr[IFG1];
|
| 197 |
|
|
wire [7:0] ifg1_nxt = IFG1[0] ? per_din[15:8] : per_din[7:0];
|
| 198 |
2 |
olivier.gi |
|
| 199 |
136 |
olivier.gi |
`ifdef NMI
|
| 200 |
2 |
olivier.gi |
reg nmiifg;
|
| 201 |
136 |
olivier.gi |
wire nmi_edge;
|
| 202 |
111 |
olivier.gi |
always @ (posedge mclk or posedge puc_rst)
|
| 203 |
|
|
if (puc_rst) nmiifg <= 1'b0;
|
| 204 |
136 |
olivier.gi |
else if (nmi_edge) nmiifg <= 1'b1;
|
| 205 |
2 |
olivier.gi |
else if (ifg1_wr) nmiifg <= ifg1_nxt[4];
|
| 206 |
136 |
olivier.gi |
`else
|
| 207 |
|
|
wire nmiifg = 1'b0;
|
| 208 |
|
|
`endif
|
| 209 |
2 |
olivier.gi |
|
| 210 |
136 |
olivier.gi |
`ifdef WATCHDOG
|
| 211 |
|
|
assign wdtifg_sw_clr = ifg1_wr & ~ifg1_nxt[0];
|
| 212 |
|
|
assign wdtifg_sw_set = ifg1_wr & ifg1_nxt[0];
|
| 213 |
|
|
`else
|
| 214 |
|
|
assign wdtifg_sw_clr = 1'b0;
|
| 215 |
|
|
assign wdtifg_sw_set = 1'b0;
|
| 216 |
|
|
`endif
|
| 217 |
2 |
olivier.gi |
|
| 218 |
|
|
assign ifg1 = {3'b000, nmiifg, 3'b000, wdtifg};
|
| 219 |
|
|
|
| 220 |
|
|
|
| 221 |
136 |
olivier.gi |
// CPU_ID Register (READ ONLY)
|
| 222 |
|
|
//-----------------------------
|
| 223 |
|
|
// -------------------------------------------------------------------
|
| 224 |
|
|
// CPU_ID_LO: | 15 14 13 12 11 10 9 | 8 7 6 5 4 | 3 | 2 1 0 |
|
| 225 |
|
|
// |----------------------------+-----------------+------+-------------|
|
| 226 |
|
|
// | PER_SPACE | USER_VERSION | ASIC | CPU_VERSION |
|
| 227 |
|
|
// --------------------------------------------------------------------
|
| 228 |
|
|
// CPU_ID_HI: | 15 14 13 12 11 10 | 9 8 7 6 5 4 3 2 1 | 0 |
|
| 229 |
|
|
// |----------------------------+-------------------------------+------|
|
| 230 |
|
|
// | PMEM_SIZE | DMEM_SIZE | MPY |
|
| 231 |
|
|
// -------------------------------------------------------------------
|
| 232 |
|
|
|
| 233 |
|
|
wire [2:0] cpu_version = `CPU_VERSION;
|
| 234 |
|
|
`ifdef ASIC
|
| 235 |
|
|
wire cpu_asic = 1'b1;
|
| 236 |
|
|
`else
|
| 237 |
|
|
wire cpu_asic = 1'b0;
|
| 238 |
|
|
`endif
|
| 239 |
|
|
wire [4:0] user_version = `USER_VERSION;
|
| 240 |
|
|
wire [6:0] per_space = (`PER_SIZE >> 9); // cpu_id_per * 512 = peripheral space size
|
| 241 |
|
|
`ifdef MULTIPLIER
|
| 242 |
|
|
wire mpy_info = 1'b1;
|
| 243 |
|
|
`else
|
| 244 |
|
|
wire mpy_info = 1'b0;
|
| 245 |
|
|
`endif
|
| 246 |
|
|
wire [8:0] dmem_size = (`DMEM_SIZE >> 7); // cpu_id_dmem * 128 = data memory size
|
| 247 |
|
|
wire [5:0] pmem_size = (`PMEM_SIZE >> 10); // cpu_id_pmem * 1024 = program memory size
|
| 248 |
|
|
|
| 249 |
|
|
assign cpu_id = {pmem_size,
|
| 250 |
202 |
olivier.gi |
dmem_size,
|
| 251 |
|
|
mpy_info,
|
| 252 |
|
|
per_space,
|
| 253 |
|
|
user_version,
|
| 254 |
|
|
cpu_asic,
|
| 255 |
136 |
olivier.gi |
cpu_version};
|
| 256 |
|
|
|
| 257 |
|
|
|
| 258 |
155 |
olivier.gi |
// CPU_NR Register (READ ONLY)
|
| 259 |
|
|
//-----------------------------
|
| 260 |
|
|
// -------------------------------------------------------------------
|
| 261 |
|
|
// | 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 |
|
| 262 |
|
|
// |---------------------------------+---------------------------------|
|
| 263 |
|
|
// | CPU_TOTAL_NR | CPU_INST_NR |
|
| 264 |
|
|
// -------------------------------------------------------------------
|
| 265 |
|
|
|
| 266 |
|
|
wire [15:0] cpu_nr = {cpu_nr_total, cpu_nr_inst};
|
| 267 |
|
|
|
| 268 |
|
|
|
| 269 |
2 |
olivier.gi |
//============================================================================
|
| 270 |
|
|
// 4) DATA OUTPUT GENERATION
|
| 271 |
|
|
//============================================================================
|
| 272 |
|
|
|
| 273 |
|
|
// Data output mux
|
| 274 |
136 |
olivier.gi |
wire [15:0] ie1_rd = {8'h00, (ie1 & {8{reg_rd[IE1]}})} << (8 & {4{IE1[0]}});
|
| 275 |
|
|
wire [15:0] ifg1_rd = {8'h00, (ifg1 & {8{reg_rd[IFG1]}})} << (8 & {4{IFG1[0]}});
|
| 276 |
|
|
wire [15:0] cpu_id_lo_rd = cpu_id[15:0] & {16{reg_rd[CPU_ID_LO]}};
|
| 277 |
|
|
wire [15:0] cpu_id_hi_rd = cpu_id[31:16] & {16{reg_rd[CPU_ID_HI]}};
|
| 278 |
155 |
olivier.gi |
wire [15:0] cpu_nr_rd = cpu_nr & {16{reg_rd[CPU_NR]}};
|
| 279 |
2 |
olivier.gi |
|
| 280 |
136 |
olivier.gi |
wire [15:0] per_dout = ie1_rd |
|
| 281 |
|
|
ifg1_rd |
|
| 282 |
|
|
cpu_id_lo_rd |
|
| 283 |
155 |
olivier.gi |
cpu_id_hi_rd |
|
| 284 |
|
|
cpu_nr_rd;
|
| 285 |
2 |
olivier.gi |
|
| 286 |
|
|
|
| 287 |
|
|
//=============================================================================
|
| 288 |
136 |
olivier.gi |
// 5) NMI GENERATION
|
| 289 |
2 |
olivier.gi |
//=============================================================================
|
| 290 |
136 |
olivier.gi |
// NOTE THAT THE NMI INPUT IS ASSUMED TO BE NON-GLITCHY
|
| 291 |
|
|
`ifdef NMI
|
| 292 |
2 |
olivier.gi |
|
| 293 |
136 |
olivier.gi |
//-----------------------------------
|
| 294 |
|
|
// Edge selection
|
| 295 |
|
|
//-----------------------------------
|
| 296 |
|
|
wire nmi_pol = nmi ^ wdtnmies;
|
| 297 |
2 |
olivier.gi |
|
| 298 |
136 |
olivier.gi |
//-----------------------------------
|
| 299 |
|
|
// Pulse capture and synchronization
|
| 300 |
|
|
//-----------------------------------
|
| 301 |
|
|
`ifdef SYNC_NMI
|
| 302 |
181 |
olivier.gi |
`ifdef ASIC_CLOCKING
|
| 303 |
136 |
olivier.gi |
// Glitch free reset for the event capture
|
| 304 |
|
|
reg nmi_capture_rst;
|
| 305 |
|
|
always @(posedge mclk or posedge puc_rst)
|
| 306 |
|
|
if (puc_rst) nmi_capture_rst <= 1'b1;
|
| 307 |
|
|
else nmi_capture_rst <= ifg1_wr & ~ifg1_nxt[4];
|
| 308 |
202 |
olivier.gi |
|
| 309 |
136 |
olivier.gi |
// NMI event capture
|
| 310 |
|
|
wire nmi_capture;
|
| 311 |
|
|
omsp_wakeup_cell wakeup_cell_nmi (
|
| 312 |
202 |
olivier.gi |
.wkup_out (nmi_capture), // Wakup signal (asynchronous)
|
| 313 |
|
|
.scan_clk (mclk), // Scan clock
|
| 314 |
|
|
.scan_mode (scan_mode), // Scan mode
|
| 315 |
|
|
.scan_rst (puc_rst), // Scan reset
|
| 316 |
|
|
.wkup_clear (nmi_capture_rst), // Glitch free wakeup event clear
|
| 317 |
|
|
.wkup_event (nmi_pol) // Glitch free asynchronous wakeup event
|
| 318 |
136 |
olivier.gi |
);
|
| 319 |
|
|
`else
|
| 320 |
202 |
olivier.gi |
wire UNUSED_scan_mode = scan_mode;
|
| 321 |
|
|
wire nmi_capture = nmi_pol;
|
| 322 |
136 |
olivier.gi |
`endif
|
| 323 |
2 |
olivier.gi |
|
| 324 |
136 |
olivier.gi |
// Synchronization
|
| 325 |
|
|
wire nmi_s;
|
| 326 |
|
|
omsp_sync_cell sync_cell_nmi (
|
| 327 |
|
|
.data_out (nmi_s),
|
| 328 |
|
|
.data_in (nmi_capture),
|
| 329 |
|
|
.clk (mclk),
|
| 330 |
|
|
.rst (puc_rst)
|
| 331 |
|
|
);
|
| 332 |
2 |
olivier.gi |
|
| 333 |
136 |
olivier.gi |
`else
|
| 334 |
202 |
olivier.gi |
wire UNUSED_scan_mode = scan_mode;
|
| 335 |
|
|
wire nmi_capture = nmi_pol;
|
| 336 |
|
|
wire nmi_s = nmi_pol;
|
| 337 |
136 |
olivier.gi |
`endif
|
| 338 |
2 |
olivier.gi |
|
| 339 |
136 |
olivier.gi |
//-----------------------------------
|
| 340 |
|
|
// NMI Pending flag
|
| 341 |
|
|
//-----------------------------------
|
| 342 |
|
|
|
| 343 |
|
|
// Delay
|
| 344 |
|
|
reg nmi_dly;
|
| 345 |
|
|
always @ (posedge mclk or posedge puc_rst)
|
| 346 |
|
|
if (puc_rst) nmi_dly <= 1'b0;
|
| 347 |
|
|
else nmi_dly <= nmi_s;
|
| 348 |
|
|
|
| 349 |
|
|
// Edge detection
|
| 350 |
|
|
assign nmi_edge = ~nmi_dly & nmi_s;
|
| 351 |
|
|
|
| 352 |
|
|
// NMI pending
|
| 353 |
|
|
wire nmi_pnd = nmiifg & nmie;
|
| 354 |
|
|
|
| 355 |
|
|
// NMI wakeup
|
| 356 |
181 |
olivier.gi |
`ifdef ASIC_CLOCKING
|
| 357 |
136 |
olivier.gi |
wire nmi_wkup;
|
| 358 |
|
|
omsp_and_gate and_nmi_wkup (.y(nmi_wkup), .a(nmi_capture ^ nmi_dly), .b(nmie));
|
| 359 |
|
|
`else
|
| 360 |
|
|
wire nmi_wkup = 1'b0;
|
| 361 |
|
|
`endif
|
| 362 |
|
|
|
| 363 |
|
|
`else
|
| 364 |
|
|
|
| 365 |
202 |
olivier.gi |
wire nmi_pnd = 1'b0;
|
| 366 |
|
|
wire nmi_wkup = 1'b0;
|
| 367 |
|
|
wire UNUSED_scan_mode = scan_mode;
|
| 368 |
|
|
wire UNUSED_nmi = nmi;
|
| 369 |
|
|
wire UNUSED_nmi_acc = nmi_acc;
|
| 370 |
|
|
wire UNUSED_wdtnmies = wdtnmies;
|
| 371 |
136 |
olivier.gi |
`endif
|
| 372 |
|
|
|
| 373 |
202 |
olivier.gi |
// LINT cleanup
|
| 374 |
|
|
wire [7:0] UNUSED_per_din_15_8 = per_din[15:8];
|
| 375 |
|
|
|
| 376 |
34 |
olivier.gi |
endmodule // omsp_sfr
|
| 377 |
33 |
olivier.gi |
|
| 378 |
104 |
olivier.gi |
`ifdef OMSP_NO_INCLUDE
|
| 379 |
|
|
`else
|
| 380 |
33 |
olivier.gi |
`include "openMSP430_undefines.v"
|
| 381 |
104 |
olivier.gi |
`endif
|