Line 34... |
Line 34... |
//
|
//
|
// *Author(s):
|
// *Author(s):
|
// - Olivier Girard, olgirard@gmail.com
|
// - Olivier Girard, olgirard@gmail.com
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
// $Rev: 117 $
|
// $Rev: 134 $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedDate: 2011-06-23 21:30:51 +0200 (Thu, 23 Jun 2011) $
|
// $LastChangedDate: 2012-03-22 21:31:06 +0100 (Thu, 22 Mar 2012) $
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
`ifdef OMSP_NO_INCLUDE
|
`ifdef OMSP_NO_INCLUDE
|
`else
|
`else
|
`include "openMSP430_defines.v"
|
`include "openMSP430_defines.v"
|
`endif
|
`endif
|
Line 79... |
Line 79... |
fe_mab, // Frontend Memory address bus
|
fe_mab, // Frontend Memory address bus
|
fe_mb_en, // Frontend Memory bus enable
|
fe_mb_en, // Frontend Memory bus enable
|
mclk, // Main system clock
|
mclk, // Main system clock
|
per_dout, // Peripheral data output
|
per_dout, // Peripheral data output
|
pmem_dout, // Program Memory data output
|
pmem_dout, // Program Memory data output
|
puc_rst // Main system reset
|
puc_rst, // Main system reset
|
|
scan_enable // Scan enable (active during scan shifting)
|
);
|
);
|
|
|
// OUTPUTs
|
// OUTPUTs
|
//=========
|
//=========
|
output [15:0] dbg_mem_din; // Debug unit Memory data input
|
output [15:0] dbg_mem_din; // Debug unit Memory data input
|
Line 119... |
Line 120... |
input fe_mb_en; // Frontend Memory bus enable
|
input fe_mb_en; // Frontend Memory bus enable
|
input mclk; // Main system clock
|
input mclk; // Main system clock
|
input [15:0] per_dout; // Peripheral data output
|
input [15:0] per_dout; // Peripheral data output
|
input [15:0] pmem_dout; // Program Memory data output
|
input [15:0] pmem_dout; // Program Memory data output
|
input puc_rst; // Main system reset
|
input puc_rst; // Main system reset
|
|
input scan_enable; // Scan enable (active during scan shifting)
|
|
|
|
|
//=============================================================================
|
//=============================================================================
|
// 1) DECODER
|
// 1) DECODER
|
//=============================================================================
|
//=============================================================================
|
Line 204... |
Line 206... |
else fe_pmem_cen_dly <= fe_pmem_cen;
|
else fe_pmem_cen_dly <= fe_pmem_cen;
|
|
|
wire fe_pmem_save = ( fe_pmem_cen & ~fe_pmem_cen_dly) & ~dbg_halt_st;
|
wire fe_pmem_save = ( fe_pmem_cen & ~fe_pmem_cen_dly) & ~dbg_halt_st;
|
wire fe_pmem_restore = (~fe_pmem_cen & fe_pmem_cen_dly) | dbg_halt_st;
|
wire fe_pmem_restore = (~fe_pmem_cen & fe_pmem_cen_dly) | dbg_halt_st;
|
|
|
|
`ifdef CLOCK_GATING
|
|
wire mclk_bckup;
|
|
omsp_clock_gate clock_gate_bckup (.gclk(mclk_bckup),
|
|
.clk (mclk), .enable(fe_pmem_save), .scan_enable(scan_enable));
|
|
`else
|
|
wire mclk_bckup = mclk;
|
|
`endif
|
|
|
reg [15:0] pmem_dout_bckup;
|
reg [15:0] pmem_dout_bckup;
|
always @(posedge mclk or posedge puc_rst)
|
always @(posedge mclk_bckup or posedge puc_rst)
|
if (puc_rst) pmem_dout_bckup <= 16'h0000;
|
if (puc_rst) pmem_dout_bckup <= 16'h0000;
|
|
`ifdef CLOCK_GATING
|
|
else pmem_dout_bckup <= pmem_dout;
|
|
`else
|
else if (fe_pmem_save) pmem_dout_bckup <= pmem_dout;
|
else if (fe_pmem_save) pmem_dout_bckup <= pmem_dout;
|
|
`endif
|
|
|
// Mux between the ROM data and the backup
|
// Mux between the ROM data and the backup
|
reg pmem_dout_bckup_sel;
|
reg pmem_dout_bckup_sel;
|
always @(posedge mclk or posedge puc_rst)
|
always @(posedge mclk or posedge puc_rst)
|
if (puc_rst) pmem_dout_bckup_sel <= 1'b0;
|
if (puc_rst) pmem_dout_bckup_sel <= 1'b0;
|